Lusien_Lashans

Ключ ВИнды

Apr 9th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.71 KB | None | 0 0
  1. Set WshShell = CreateObject("WScript.Shell")
  2.  
  3. regKey = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
  4.  
  5. DigitalProductId = WshShell.RegRead(regKey & "DigitalProductId")
  6.  
  7. Win8ProductName = "Windows Product Name: " & WshShell.RegRead(regKey & "ProductName") & vbNewLine
  8.  
  9. Win8ProductID = "Windows Product ID: " & WshShell.RegRead(regKey & "ProductID") & vbNewLine
  10.  
  11. Win8ProductKey = ConvertToKey(DigitalProductId)
  12.  
  13. strProductKey ="Windows Key: " & Win8ProductKey
  14.  
  15. Win8ProductID = Win8ProductName & Win8ProductID & strProductKey
  16.  
  17. MsgBox(Win8ProductKey)
  18.  
  19. MsgBox(Win8ProductID)
  20.  
  21. Function ConvertToKey(regKey)
  22.  
  23.    Const KeyOffset = 52
  24.  
  25.    isWin8 = (regKey(66) \ 6) And 1
  26.  
  27.    regKey(66) = (regKey(66) And &HF7) Or ((isWin8 And 2) * 4)
  28.  
  29.    j = 24
  30.  
  31.    Chars = "BCDFGHJKMPQRTVWXY2346789"
  32.  
  33.    Do
  34.  
  35.        Cur = 0
  36.  
  37.        y = 14
  38.  
  39.        Do
  40.  
  41.            Cur = Cur * 256
  42.  
  43.            Cur = regKey(y + KeyOffset) + Cur
  44.  
  45.            regKey(y + KeyOffset) = (Cur \ 24)
  46.  
  47.            Cur = Cur Mod 24
  48.  
  49.            y = y -1
  50.  
  51.        Loop While y >= 0
  52.  
  53.        j = j -1
  54.  
  55.        winKeyOutput = Mid(Chars, Cur + 1, 1) & winKeyOutput
  56.  
  57.        Last = Cur
  58.  
  59.    Loop While j >= 0
  60.  
  61.    If (isWin8 = 1) Then
  62.  
  63.        keypart1 = Mid(winKeyOutput, 2, Last)
  64.  
  65.        insert = "N"
  66.  
  67.        winKeyOutput = Replace(winKeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
  68.  
  69.        If Last = 0 Then winKeyOutput = insert & winKeyOutput
  70.  
  71.    End If
  72.  
  73.    a = Mid(winKeyOutput, 1, 5)
  74.  
  75.    b = Mid(winKeyOutput, 6, 5)
  76.  
  77.    c = Mid(winKeyOutput, 11, 5)
  78.  
  79.    d = Mid(winKeyOutput, 16, 5)
  80.  
  81.    e = Mid(winKeyOutput, 21, 5)
  82.  
  83.    ConvertToKey = a & "-" & b & "-" & c & "-" & d & "-" & e
  84.  
  85. End Function
Add Comment
Please, Sign In to add comment