中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » VBS获得Windows CD-KEY,主要是Base24算法
作者:
标题: VBS获得Windows CD-KEY,主要是Base24算法 上一主题 | 下一主题
electronixtar
铂金会员





积分 7493
发帖 2672
注册 2005-9-2
状态 离线
『楼 主』:  VBS获得Windows CD-KEY,主要是Base24算法

原帖地址:
http://www.visualbasicscript.com/m_42793/mpage_1/key_/tm.htm

这个VBS相当的经典,用到了WMI,注册表,Base24解码算法。如果知道 Office 2003 的注册表位置,也可以顺理成章的获得Office 的 CD-KEY
'  ##############################################################
'  #        #
'  # VBScript to find the DigitalProductID for your  #
'  # Microsoft windows Installation and decode it to  #
'  # retrieve your windows Product Key    #
'  #        #
'  # -----------------------------------------------  #
'  #        #
'  #  Created by:  Parabellum   #
'  #        #
'  ##############################################################
'
' <--------------- 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


   此帖被 +15 点积分        点击查看详情   
评分人:【 redtek 分数: +15  时间:2007-2-12 12:08





C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
2007-2-11 10:19
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
kk130
初级用户




积分 156
发帖 14
注册 2003-7-24
状态 离线
『第 2 楼』:  

干嘛不开REGEDIT按F3?

2007-2-11 11:02
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
kich
中级用户





积分 397
发帖 168
注册 2006-10-8
状态 离线
『第 3 楼』:  

顶啊,不管用什么了!
先看看他代码是怎么写的!究竟是不是想做什么就知道了嘛!

2007-2-12 12:03
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
eech
高级用户




积分 906
发帖 346
注册 2006-7-10
状态 离线
『第 4 楼』:  

一直是用第三方软件.没想到不用第三方软件可以/顶了

2007-2-23 02:26
查看资料  发短消息 网志   编辑帖子  回复  引用回复
newaifi
初级用户





积分 154
发帖 67
注册 2006-10-31
状态 离线
『第 5 楼』:  

强呢  !

2007-2-23 21:56
查看资料  发短消息 网志   编辑帖子  回复  引用回复
slore
铂金会员





积分 5212
发帖 2478
注册 2007-2-8
状态 离线
『第 6 楼』:  

WMI可以不用

2007-2-23 23:29
查看资料  发短消息 网志   编辑帖子  回复  引用回复
Kinglion
铂金会员

痴迷DOS者


积分 5798
发帖 1924
注册 2003-6-20
来自 金獅電腦軟體工作室
状态 离线
『第 7 楼』:  

绝对精点的代码。实际上在官方网站还有更多的好东西,就在于你是否肯花时间去掏宝了。



熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
2007-2-24 23:58
查看资料  发送邮件  访问主页  发短消息 网志  OICQ (79207959)  编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: