Advertisement
LaDEEKill3R

WindowsKeyInfo.vbs

Oct 4th, 2022
1,640
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 2.92 KB | Source Code | 0 0
  1. '  ##############################################################
  2. '  #        #
  3. '  # VBScript to find the DigitalProductID for your  #
  4. '  # Microsoft windows Installation and decode it to  #
  5. '  # retrieve your windows Product Key    #
  6. '  #        #
  7. '  # -----------------------------------------------  #
  8. '  #        #
  9. '  #  Created by:  Parabellum   #
  10. '  #        #
  11. '  ##############################################################
  12. '
  13. ' <--------------- Open Registry Key and populate binary data into an array -------------------------->
  14. '
  15. const HKEY_LOCAL_MACHINE = &H80000002
  16.  strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
  17.  strValueName = "DigitalProductId"
  18.  strComputer = "."
  19.  dim iValues()
  20.  Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
  21.        strComputer & "\root\default:StdRegProv")
  22.  oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,iValues
  23.  Dim arrDPID
  24.  arrDPID = Array()
  25.  For i = 52 to 66
  26.  ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
  27.  arrDPID( UBound(arrDPID) ) = iValues(i)
  28.  Next
  29.  ' <--------------- Create an array to hold the valid characters for a microsoft Product Key -------------------------->
  30. Dim arrChars
  31.  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")
  32.  
  33.  ' <--------------- The clever bit !!! (Decrypt the base24 encoded binary data)-------------------------->
  34. For i = 24 To 0 Step -1
  35.  k = 0
  36.  For j = 14 To 0 Step -1
  37.   k = k * 256 Xor arrDPID(j)
  38.   arrDPID(j) = Int(k / 24)
  39.   k = k Mod 24
  40.  Next
  41.  strProductKey = arrChars(k) & strProductKey
  42.  ' <------- add the "-" between the groups of 5 Char -------->
  43. If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
  44.  Next
  45.  strFinalKey = strProductKey
  46.  '
  47. ' <---------- This part of the script displays operating system Information and the license Key --------->
  48. '
  49. strComputer = "."
  50.  Set objWMIService = GetObject("winmgmts:" _
  51.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  52.  Set colOperatingSystems = objWMIService.ExecQuery _
  53.     ("Select * from Win32_OperatingSystem")
  54.  For Each objOperatingSystem in colOperatingSystems
  55.     strOS   = objOperatingSystem.Caption
  56.     strBuild   = objOperatingSystem.BuildNumber
  57.     strSerial   = objOperatingSystem.SerialNumber
  58.     strRegistered  = objOperatingSystem.RegisteredUser
  59.  Next
  60.  Set wshShell=CreateObject("wscript.shell")
  61.  strPopupMsg = strOS & vbNewLine & vbNewLine
  62.  strPopupMsg = strPopupMsg & "Build Number:  " & strBuild & vbNewLine
  63.  strPopupMsg = strPopupMsg & "PID:  " & strSerial & vbNewLine & vbNewLine
  64.  strPopupMsg = strPopupMsg & "Registered to:  " & strRegistered & vbNewLine & vbNewLine & vbNewLine
  65.  strPopupMsg = strPopupMsg & "Your Windows Product Key is:" & vbNewLine & vbNewLine & strFinalKey
  66.  strPopupTitle = "Microsoft Windows License Information"
  67. wshShell.Popup strPopupMsg,,strPopupTitle,vbCancelOnly+vbinformation
Tags: windows
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement