Retrieve Windows Product Key

Discussion in 'Archives' started by Waffles, Dec 1, 2007.

Thread Status:
Not open for further replies.
Retrieve Windows Product Key
  1. Unread #1 - Dec 1, 2007 at 5:44 PM
  2. Waffles
    Referrals:
    4

    Waffles Guest

    Retrieve Windows Product Key

    Basicaly this script retrieves the DigitalProductID from the registry, extracts the actual bytes which relate product Key and then decodes the base24 binary data to show the key, as you know it.

    I can't take credit for figuring out the base24 decoding...( I adapted that from a c++ app)

    Code:
    '##############################################################
    '  #        #
    '  # VBScript to find the DigitalProductID for your  #
    '  # Microsoft windows Installation and decode it to  #
    '  # retrieve your windows Product Key    #
    '  #        #
    '  # -----------------------------------------------  #
    '  #        #
    '  #  Created by:  Waffles   #
    '  #        #
    '  ##############################################################
    '
    ' <--------------- Open Registry Key and populate binary data into an array -------------------------->
    '
    const HKEY_LOCAL_MACHINE = &H80000002 
    strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
    strValueName = "DigitalProductId"
    strComputer = "."
    dim iValues()
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
         strComputer & "\root\default:StdRegProv")
    oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,iValues
    Dim arrDPID
    arrDPID = Array()
    For i = 52 to 66
    ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
    arrDPID( UBound(arrDPID) ) = iValues(i)
    Next
    ' <--------------- Create an array to hold the valid characters for a microsoft Product Key -------------------------->
    Dim arrChars
    arrChars = Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")
    
    ' <--------------- The clever bit !!! (Decrypt the base24 encoded binary data)-------------------------->
    For i = 24 To 0 Step -1
    k = 0
    For j = 14 To 0 Step -1
    k = k * 256 Xor arrDPID(j)
    arrDPID(j) = Int(k / 24)
    k = k Mod 24
    Next
    strProductKey = arrChars(k) & strProductKey
    ' <------- add the "-" between the groups of 5 Char -------->
    If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
    Next
    strFinalKey = strProductKey
    '
    ' <---------- This part of the script displays operating system Information and the license Key --------->
    '
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
      & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colOperatingSystems = objWMIService.ExecQuery _
      ("Select * from Win32_OperatingSystem")
    For Each objOperatingSystem in colOperatingSystems
      strOS   = objOperatingSystem.Caption
      strBuild   = objOperatingSystem.BuildNumber
      strSerial   = objOperatingSystem.SerialNumber
      strRegistered  = objOperatingSystem.RegisteredUser
    Next
    Set wshShell=CreateObject("wscript.shell")
    strPopupMsg = strOS & vbNewLine & vbNewLine
    strPopupMsg = strPopupMsg & "Build Number:  " & strBuild & vbNewLine
    strPopupMsg = strPopupMsg & "PID:  " & strSerial & vbNewLine & vbNewLine
    strPopupMsg = strPopupMsg & "Registered to:  " & strRegistered & vbNewLine & vbNewLine & vbNewLine
    strPopupMsg = strPopupMsg & "Your Windows Product Key is:" & vbNewLine & vbNewLine & strFinalKey
    strPopupTitle = "Microsoft Windows License Information"
    wshShell.Popup strPopupMsg,,strPopupTitle,vbCancelOnly+vbinformation
    WScript.Quit
     
  3. Unread #2 - Dec 1, 2007 at 6:10 PM
  4. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    Retrieve Windows Product Key

    Nice.
     
  5. Unread #3 - Dec 1, 2007 at 7:19 PM
  6. UmagChris
    Joined:
    Mar 13, 2007
    Posts:
    135
    Referrals:
    0
    Sythe Gold:
    0

    UmagChris Active Member

    Retrieve Windows Product Key

    Leached.. yet again?? This person has not made their own program once lol.

    http://www.visualbasicscript.com/m_42793/mpage_1/key_/tm.htm#53773

    Theres the original coder.

     
  7. Unread #4 - Dec 2, 2007 at 12:06 AM
  8. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    Retrieve Windows Product Key

  9. Unread #5 - Dec 2, 2007 at 12:39 AM
  10. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    Retrieve Windows Product Key

    Wow, he tried to pass that off as his own work too...banned for plagiarism. Nice catch guys.
     
< T>lv Female 70 Druid For Lv 70 Male Horde Warrior | Alching from 70 Mage to 82 Mage... >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site