本帖最后由 smooth 于 2015-3-16 09:32 编辑
回复 31# chzj589
附件为注册信息提取及注册机,你想在哪台电脑上安装,就运行“注册信息提取”工具,将得到一个DAT文件,然后运行注册码生成工具,将生成一个注册码。然后在你的脚本里获取网卡地址,并用MD5加密函数进行加密,判断得到的注册码是否与用户输入的一致,一致就允许安装,不一致就退出。
MD3加密函数:
Func _Crypt_HashData($vData, $iALG_ID, $fFinal = True, $hCryptHash = 0)
Local $iError = 0, $iExtended = 0
Local $vReturn = 0
Local $iHashSize = 0
Local $aRet
Local $hBuff = 0
_Crypt_Startup()
Do
If $hCryptHash = 0 Then
$aRet = DllCall(__Crypt_DllHandle(), "bool", "CryptCreateHash", "handle", __Crypt_Context(), "uint", $iALG_ID, "ptr", 0, "dword", 0, "handle*", 0)
If @error Or Not $aRet[0] Then
$iError = @error + 10
$iExtended = @extended
$vReturn = -1
ExitLoop
EndIf
$hCryptHash = $aRet[5]
EndIf
$hBuff = DllStructCreate("byte[" & BinaryLen($vData) & "]")
DllStructSetData($hBuff, 1, $vData)
$aRet = DllCall(__Crypt_DllHandle(), "bool", "CryptHashData", "handle", $hCryptHash, "struct*", $hBuff, "dword", DllStructGetSize($hBuff), "dword", $CRYPT_USERDATA)
If @error Or Not $aRet[0] Then
$iError = @error + 20
$iExtended = @extended
$vReturn = -1
ExitLoop
EndIf
If $fFinal Then
$aRet = DllCall(__Crypt_DllHandle(), "bool", "CryptGetHashParam", "handle", $hCryptHash, "dword", $HP_HASHSIZE, "dword*", 0, "dword*", 4, "dword", 0)
If @error Or Not $aRet[0] Then
$iError = @error + 30
$iExtended = @extended
$vReturn = -1
ExitLoop
EndIf
$iHashSize = $aRet[3]
$hBuff = DllStructCreate("byte[" & $iHashSize & "]")
$aRet = DllCall(__Crypt_DllHandle(), "bool", "CryptGetHashParam", "handle", $hCryptHash, "dword", $HP_HASHVAL, "struct*", $hBuff, "dword*", DllStructGetSize($hBuff), "dword", 0)
If @error Or Not $aRet[0] Then
$iError = @error + 40
$iExtended = @extended
$vReturn = -1
ExitLoop
EndIf
$vReturn = DllStructGetData($hBuff, 1)
Else
$vReturn = $hCryptHash
EndIf
Until True
If $hCryptHash <> 0 And $fFinal Then DllCall(__Crypt_DllHandle(), "bool", "CryptDestroyHash", "handle", $hCryptHash)
_Crypt_Shutdown()
Return SetError($iError, $iExtended, $vReturn)
EndFunc ;==>_Crypt_HashData
获取网卡地址:
#NoTrayIcon
#RequireAdmin
$aArray = _GetMACAddress()
MsgBox(0,0,$aArray[0])
Func _GetMACAddress()
local $sText, $iPID
$iPID = Run(@ComSpec & " /c ipconfig /all", '', @SW_HIDE, 6)
While 1
$sText &= StdoutRead($iPID)
If @error Then ExitLoop
WEnd
Return StringRegExp($sText, "(?s)(?i)([\w|\d]{2}\-[\w|\d]{2}\-[\w|\d]{2}\-[\w|\d]{2}\-[\w|\d]{2}\-[\w|\d]{2})", 3)
EndFunc
|