windows 系统key读取脚本(三)

@echo off & setlocal enabledelayedexpansion
set tokens=%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat
set vbs=winkey.vbs
for /f "delims=:" %%a in ('findstr /n /b ":vbs" %0') do (more +%%a %0>"%vbs%")
for /f "delims=" %%a in ('cscript //nologo "%vbs%"') do set key=%%a
del "%vbs%"
cls
echo.&echo 提取密钥:%key%
>> .\winkey.ini echo [winkey]
>> .\winkey.ini echo key=%key%
:vbs
ON ERROR RESUME NEXT
Dim objShell
Set objShell = CreateObject("WScript.Shell")
WScript.Echo GetKey(objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function GetKey(rpk)
 Const rpkOffset=52:i=28
 szPossibleChars="BCDFGHJKMPQRTVWXY2346789"
 Do
 dwAccumulator=0 : j=14
 Do
 dwAccumulator=dwAccumulator*256
 dwAccumulator=rpk(j+rpkOffset)+dwAccumulator
 rpk(j+rpkOffset)=(dwAccumulator\24) and 255
 dwAccumulator=dwAccumulator Mod 24
 j=j-1
 Loop While j>=0
 i=i-1 : szProductKey=mid(szPossibleChars,dwAccumulator+1,1)&szProductKey
 if (((29-i) Mod 6)=0) and (i<>-1) then
 i=i-1 : szProductKey="-"&szProductKey
 End If
 Loop While i>=0
 GetKey=szProductKey
End Function

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容