最新消息:

windows 系统key读取脚本(二)

cmd 永恒心锁 1880浏览 0评论
Option Explicit 

Dim objshell,path,DigitalID, Result 
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData
'Get ProductName, ProductID, ProductKey
ProductName = "Product Name: " & objshell.RegRead(Path & "ProductName")
ProductID = "Product ID: " & objshell.RegRead(Path & "ProductID")
ProductKey = "Installed Key: " & ConvertToKey(DigitalID) 
ProductData = ProductName & vbNewLine & ProductID & vbNewLine & ProductKey
'Show messbox if save to a file 
If vbYes = MsgBox(ProductData & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "BackUp Windows Key Information") then
 Save ProductData 
End If



'Convert binary to chars
Function ConvertToKey(Key)
 Const KeyOffset = 52
 Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
 'Check if OS is Windows 8
 isWin8 = (Key(66) \ 6) And 1
 Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
 i = 24
 Maps = "BCDFGHJKMPQRTVWXY2346789"
 Do
 Current= 0
 j = 14
 Do
 Current = Current* 256
 Current = Key(j + KeyOffset) + Current
 Key(j + KeyOffset) = (Current \ 24)
 Current=Current Mod 24
 j = j -1
 Loop While j >= 0
 i = i -1
 KeyOutput = Mid(Maps,Current+ 1, 1) & KeyOutput
 Last = Current
 Loop While i >= 0 
 keypart1 = Mid(KeyOutput, 2, Last)
 insert = "N"
 KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
 If Last = 0 Then KeyOutput = insert & KeyOutput
 ConvertToKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5)
 
 
End Function
'Save data to a file
Function Save(Data)
 Dim fso, fName, txt,objshell,UserName
 Set objshell = CreateObject("wscript.shell")
 'Get current user name 
 UserName = objshell.ExpandEnvironmentStrings("%UserName%") 
 'Create a text file on desktop 
 fName = "C:\Users\" & UserName & "\Desktop\WindowsKeyInfo.txt"
 Set fso = CreateObject("Scripting.FileSystemObject")
 Set txt = fso.CreateTextFile(fName)
 txt.Writeline Data
 txt.Close
End Function
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » windows 系统key读取脚本(二)

您必须 登录 才能发表评论!