Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[TUT] How To Get Windows OS Key (VBNet)

Since the link is dead for the other tutorial, here is another way to get the Windows OS key. This will not get the Office key though.

This is based on WMI (Windows Management Instrumentation). It queries the key from the WMI which is included in all Windows OS's (At least most) and is not encrypted. So you'll have the key all ready to be stolen.

Imports:
Code
Imports System.Management

Query Code:
Code
Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_OperatingSystem")
                    Dim i As Integer = 0
                    For Each queryObj As ManagementObject In searcher.Get()
                        i += 1
                        ListBox1.Items.Add(queryObj("SerialNumber"))
                        'Replace ListBox1 with wherever you want it.
                        If i = 1 Then Exit For
                    Next

When it queries the key it'll freeze for a couple seconds.

I'm not going to include how to actually steal the key because I don't really have a great way of doing it. My way involves streamwriting the key to a text file and uploading it to one of my webservers which is probably a fairly crappy way.
Or just use

Code
Dim TheKey as String
TheKey = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId", Nothing)
What can you do with it..?
(May 7, 2010 03:10 AM)Royal Flush Wrote:  What can you do with it..?

You use this to get the windows product key
for example u can use that code for a stealer to steal os product keys
(May 7, 2010 03:09 AM)xSilent Wrote:  Or just use

Code
Dim TheKey as String
TheKey = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId", Nothing)

Yeah, that's a quicker way but what if someone were to deny reading of the key? Not many, if anyone would actually do this though, lol. The WMI method can't be blocked.
Thanks for this. Useful.
error in windows 8 64 bit :L
How to Get the licence key with the productID :

Code
Public Function OSProductKey(ByVal KeyPath As String, ByVal ValueName As String) As String

    Dim Keystring As String = ""
    Try
    Dim HexBuf As Object = My.Computer.Registry.GetValue(KeyPath, ValueName, 0)
    If HexBuf Is Nothing Then Return "N/A"
    Dim tmp As String = ""
    For l As Integer = LBound(HexBuf) To UBound(HexBuf)
    tmp = tmp & " " & Hex(HexBuf(l))
    Next

    Dim StartOffset As Integer = 52
    Dim EndOffset As Integer = 67
    Dim Digits(24) As String

    Digits(0) = "B" : Digits(1) = "C" : Digits(2) = "D" : Digits(3) = "F"
    Digits(4) = "G" : Digits(5) = "H" : Digits(6) = "J" : Digits(7) = "K"
    Digits(8) = "M" : Digits(9) = "P" : Digits(10) = "Q" : Digits(11) = "R"
    Digits(12) = "T" : Digits(13) = "V" : Digits(14) = "W" : Digits(15) = "X"
    Digits(16) = "Y" : Digits(17) = "2" : Digits(18) = "3" : Digits(19) = "4"
    Digits(20) = "6" : Digits(21) = "7" : Digits(22) = "8" : Digits(23) = "9"

    Dim dLen As Integer = 29
    Dim sLen As Integer = 15
    Dim HexDigitalPID(15) As String
    Dim Des(30) As String

    Dim tmp2 As String = ""

    For i = StartOffset To EndOffset
    HexDigitalPID(i - StartOffset) = HexBuf(i)
    tmp2 = tmp2 & " " & Hex(HexDigitalPID(i - StartOffset))
    Next

    For i As Integer = dLen - 1 To 0 Step -1
    If ((i + 1) Mod 6) = 0 Then
    Des(i) = "-"
    Keystring = Keystring & "-"
    Else
    Dim HN As Integer = 0
    For N As Integer = (sLen - 1) To 0 Step -1
    Dim Value As Integer = ((HN * 2 ^ 8) Or HexDigitalPID(N))
    HexDigitalPID(N) = Value \ 24
    HN = (Value Mod 24)

    Next
    Des(i) = Digits(HN)
    Keystring = Keystring & Digits(HN)
    End If
    Next
    Catch ex As Exception
    Interaction.MsgBox(ex.Message, MsgBoxStyle.Information)
    End Try
    Return StrReverse(Keystring)
  End Function

How to use this function :

Code
tbxProductkey.text = OSProductKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows NT\CurrentVersion", "DigitalProductId")

I hope it will help you. ;)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Emre_Jan 12, 2021 11:16 PM 0 141 Jan 12, 2021 11:16 PM
Last Post: Emre_
[.NET] by OffCodeSep 13, 2018 03:32 PM 6 328 Sep 13, 2018 03:32 PM
Last Post: ppaida
[.NET] by invocker49Oct 21, 2016 12:38 PM 2 250 Oct 21, 2016 12:38 PM
Last Post: invocker49