unknownwarezorg Posted November 20, 2008 Share Posted November 20, 2008 (edited) I need to extract my key. Can anyone tell me whats wrong with this? Dim $var = RegEnumKey($officeKey, $i) If @error <> 0 Then GUICtrlSetData($status_L, "Info: Unable to find REG_BINARY 'DigitalProductID', maybe no Office installed!") Return "No Office XP, 2003, or 2007 found" EndIf If $var <> "" Then $product = "2007" Dim $officeKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Registration\{91120000-0014-0000-0000-0000000FF1CE}" EndIf EndIf ;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Registration\{91120000-0014-0000-0000-0000000FF1CE} Dim $var = RegRead($officeKey,"ProductID") If @error <> 0 Then Edited November 20, 2008 by unknownwarezorg Link to comment Share on other sites More sharing options...
BrettF Posted November 20, 2008 Share Posted November 20, 2008 (edited) I am worried buy what your display name says... Care to explain why you need it? Edited November 20, 2008 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Danny35d Posted November 20, 2008 Share Posted November 20, 2008 This a set of UDF I put together while back that give you windows key or office key. Enjoy it... WAP_UDF.au3expandcollapse popup#include-once ;=============================================================================== ; ; Function Name: _GetWindowsKey() ; Description: gets the Windows DigitalProductID from the registry ; Parameter(s): none ; Requirement(s): none ; Return Value(s): Returns the binary Windows DigitalProductID as stored in the registry ; Author(s): Danny35d ; ;=============================================================================== ; TBD: Error checking and SetError Func _GetWindowsKey($sRemoteComputer = '') Dim $aKeys[2][5] If $sRemoteComputer <> '' Then $sRemoteComputer = '\\' & StringReplace($sRemoteComputer, '\', '') & '\' Local Const $sRegKey = $sRemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion' $aKeys[0][0] = 1 $aKeys[1][0] = RegRead($sRegKey, 'ProductName') $aKeys[1][1] = RegRead($sRegKey, 'ProductID') $aKeys[1][2] = _DecodeProductKey(RegRead($sRegKey, 'DigitalProductID')) $aKeys[1][3] = RegRead($sRegKey, 'RegisteredOwner') $aKeys[1][4] = RegRead($sRegKey, 'RegisteredOrganization') Return($aKeys) EndFunc ;==>_GetWindowsKey ;=============================================================================== ; ; Function Name: _GetOfficeKey() ; Description: gets the Office DigitalProductID from the registry ; Parameter(s): none ; Requirement(s): none ; Return Value(s): Returns the binary 2003 Office DigitalProductID as stored in the registry ; Author(s): Danny35d ; ;=============================================================================== ; TBD: Error checking and SetError Func _GetOfficeKey($sRemoteComputer = '') Dim $aKeys[1][3] If $sRemoteComputer <> '' Then $sRemoteComputer = '\\' & StringReplace($sRemoteComputer, '\', '') & '\' Local $sRegKey1 = $sRemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office' Local $sRegKey2 = $sRemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' Local $iCount1 = 1, $iCount2 = 1 While 1 $sKey1 = RegEnumKey($sRegKey1, $iCount1) If @error <> 0 Then ExitLoop While 1 $ProductID = '' $ProductName = '' $DigitalProductID = '' $sKey2 = RegEnumKey($sRegKey1 & '\' & $sKey1 & '\Registration', $iCount2) If @error <> 0 Then ExitLoop $ProductID = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductID') $ProductName = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName') $DigitalProductID = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'DigitalProductID') If $ProductName = '' Then $ProductName = RegRead($sRegKey2 & '\' & $sKey2, 'DisplayName') $DigitalProductID = _DecodeProductKey($DigitalProductID) If $DigitalProductID <> 'BBBBB-BBBBB-BBBBB-BBBBB-BBBBB' Then ReDim $aKeys[UBound($aKeys) + 1][3] $aKeys[0][0] = UBound($aKeys) - 1 $aKeys[UBound($aKeys) - 1][0] = $ProductName $aKeys[UBound($aKeys) - 1][1] = $ProductID $aKeys[UBound($aKeys) - 1][2] = $DigitalProductID EndIf $iCount2 += 1 WEnd $iCount1 += 1 WEnd Return($aKeys) EndFunc ;==>_GetOfficeKey ;=============================================================================== ; ; Function Name: _DecodeProductKey() ; Description: decodes the PID to get the product key ; Parameter(s): $BinaryDPID - the PID as stored in registry ; Requirement(s): none ; Return Value(s): Returns the decoded Windows/Office/Visual studio/etc. product key ; Author(s): found this in the Forum, who made it?! ; ;=============================================================================== Func _DecodeProductKey($BinaryDPID) Local $bKey[15] Local $sKey[29] Local $Digits[24] Local $Value = 0 Local $hi = 0 Local $n = 0 Local $i = 0 Local $dlen = 29 Local $slen = 15 Local $Result $Digits = StringSplit("BCDFGHJKMPQRTVWXY2346789", "") $binaryDPID = StringMid($binaryDPID, 105, 30) For $i = 1 To 29 Step 2 $bKey[Int($i / 2) ] = Dec(StringMid($binaryDPID, $i, 2)) Next For $i = $dlen - 1 To 0 Step - 1 If Mod(($i + 1), 6) = 0 Then $sKey[$i] = "-" Else $hi = 0 For $n = $slen - 1 To 0 Step - 1 $Value = BitOR(BitShift($hi, -8), $bKey[$n]) $bKey[$n] = Int($Value / 24) $hi = Mod($Value, 24) Next $sKey[$i] = $Digits[$hi + 1] EndIf Next For $i = 0 To 28 $Result = $Result & $sKey[$i] Next Return $Result EndFunc ;==>_DecodeProductKeyoÝ÷ ØLZ^jëh×6#include <Array.au3> #include 'WAP_UDF.au3' ; Get windows registration ; Return a two dimension array in which ; $WindowsKey[1][0] = ProductName ; $WindowsKey[1][1] = ProductID ; $WindowsKey[1][2] = DigitalProductID ; $WindowsKey[1][3] = RegisteredOwner ; $WindowsKey[1][4] = RegisteredOrganization $WindowsKey = _GetWindowsKey() _ArrayDisplay($WindowsKey, 'Windows Key') ;Get All Office registration. This also include any Visio, Project, etc. ; Return a two dimension array in which ; $OfficeKey[n][0] = $ProductName ; $OfficeKey[n][1] = $ProductID ; $OfficeKey[n][2] = $DigitalProductID $OfficeKey = _GetOfficeKey() _ArrayDisplay($OfficeKey, 'Office Key') AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
unknownwarezorg Posted November 20, 2008 Author Share Posted November 20, 2008 Thank you much, much appriciated Link to comment Share on other sites More sharing options...
unknownwarezorg Posted November 20, 2008 Author Share Posted November 20, 2008 (edited) Well I couldnt get that to work. Can someone look over my code? Thanks in advanced Please dont tell me what to put where... Im a noob coder. I took this and wanted to make it extract office 2007 expandcollapse popup#include <GUIConstants.au3> ;GUI $GUI = GUICreate("Windows Information", 685, 450, 158, 127) ;Labels $windowsInformation_L = GUICtrlCreateLabel("Windows Information", 8, 8, 659, 25) $status_L = GUICtrlCreateLabel("Information read out ...", 24, 80, 400, 17) $description_L = GUICtrlCreateLabel("Description", 16, 112, 103, 17) $windowsType_L = GUICtrlCreateLabel("Windows Type", 16, 152, 103, 17) $serialNumber_L = GUICtrlCreateLabel("Serial Number", 16, 192, 103, 17) $ProductKey_L = GUICtrlCreateLabel("Product Key", 16, 232, 103, 17) $InstallDate_L = GUICtrlCreateLabel("Install Date", 16, 272, 103, 17) $LastBootUpTime_L = GUICtrlCreateLabel("Last Boot Up Time", 16, 312, 103, 17) $RegisteredOwner_L = GUICtrlCreateLabel("Registered Owner", 16, 352, 103, 17) $officeKey_L = GUICtrlCreateLabel("Office Key", 16, 392, 103, 17) ;Input $description_I = GUICtrlCreateInput("Description", 130, 112, 389, 21) $windowsType_I = GUICtrlCreateInput("Windows Type", 130, 152, 389, 21) $serialNumber_I = GUICtrlCreateInput("Serial Number", 130, 192, 389, 21) $ProductKey_I = GUICtrlCreateInput("Product Key", 130, 232, 389, 21) $InstallDate_I = GUICtrlCreateInput("Install Date", 130, 272, 389, 21) $LastBootUpTime_I = GUICtrlCreateInput("Last Boot Up Time", 130, 312, 389, 21) $RegisteredOwner_I = GUICtrlCreateInput("Registered Owner", 130, 352, 389, 21) $officeKey_I = GUICtrlCreateInput("Office Key", 130, 392, 389, 21) ;Groups $informationPanel_G = GUICtrlCreateGroup("Information Panel", 8, 48, 585, 393) $status_G = GUICtrlCreateGroup("Status", 14, 64, 553, 41) $buttins_G = GUICtrlCreateGroup("Buttons", 608, 48, 65, 393) $office_G = GUICtrlCreateGroup("Microsoft Office", 14, 375, 553, 48) ;Buttons $exit_B = GUICtrlCreateButton("Exit", 616, 72, 49, 25, 0) $Description_B = GUICtrlCreateButton("Clipboard", 616, 112, 49, 25, 0) $WindowsType_B = GUICtrlCreateButton("Clipboard", 616, 152, 49, 25, 0) $SerialNumber_B = GUICtrlCreateButton("Clipboard", 616, 192, 49, 25, 0) $ProductKey_B = GUICtrlCreateButton("Clipboard", 616, 232, 49, 25, 0) $InstallDate_B = GUICtrlCreateButton("Clipboard", 616, 272, 49, 25, 0) $LastBootUpTime_B = GUICtrlCreateButton("Clipboard", 616, 312, 49, 25, 0) $registeredOwner_B = GUICtrlCreateButton("Clipboard", 616, 352, 49, 25, 0) $OfficeKey_B = GUICtrlCreateButton("Clipboard", 616, 392, 49, 25, 0) ; SetFont $font = "Comic Sans MS" GUICtrlSetFont($windowsInformation_L, 16, 400, 4, $font) ;ProgressBar $progressbar = GUICtrlCreateProgress(140, 75, 400, 25) ;Global variables Global $product = ""; Office product Version (XP or 2003) Global $counter = 3; Counter for progressBar Global $wait = 150; Wait for progessBar GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $counter = 3 Then Sleep(500) GUICtrlSetData($status_L, "Initialize... " & $counter) progress() $counter -= 1 ElseIf $counter = 2 Then GUICtrlSetData($status_L, "Initialize... " & $counter) progress() $counter -= 1 ElseIf $counter = 1 Then GUICtrlSetData($status_L, "Initialize... " & $counter) progress() $counter -= 1 ElseIf $counter = 0 Then GUICtrlSetData($status_L, "Ready ...") progress() $counter -= 1 ElseIf $counter = -1 Then $Bin = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductID") $key4RegisteredOwner = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") $colSettings = $objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") For $objOperatingSystem In $colSettings Next GUICtrlSetData($description_I, StringMid($objOperatingSystem.Description, 1)) GUICtrlSetData($windowsType_I, '(' & @OSVersion & ') ' & StringMid($objOperatingSystem.Caption, 19)) GUICtrlSetData($serialNumber_I, StringMid($objOperatingSystem.SerialNumber, 1)) GUICtrlSetData($ProductKey_I, DecodeProductKey($Bin)) GUICtrlSetData($InstallDate_I, WMIDateStringToDate($objOperatingSystem.InstallDate)) GUICtrlSetData($LastBootUpTime_I, WMIDateStringToDate($objOperatingSystem.LastBootUpTime)) GUICtrlSetData($RegisteredOwner_I, RegRead($key4RegisteredOwner, "RegisteredOwner")) GUICtrlSetData($officeKey_L, "Office " & $product) $counter -= 1 ElseIf $counter < - 1 Then Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $exit_B GUICtrlSetData($status_L, "So long, Mega") Sleep(1500) ExitLoop Case $msg = $Description_B ClipPut(StringMid($objOperatingSystem.Description, 1)) GUICtrlSetData($status_L, "Description copied to clipboard") Case $msg = $WindowsType_B ClipPut('(' & @OSVersion & ') ' & StringMid($objOperatingSystem.Caption, 19)) GUICtrlSetData($status_L, "WindowsType copied to clipboard") Case $msg = $SerialNumber_B ClipPut(StringMid($objOperatingSystem.SerialNumber, 1)) GUICtrlSetData($status_L, "SerialNumber copied to clipboard") Case $msg = $ProductKey_B ClipPut(DecodeProductKey($Bin)) GUICtrlSetData($status_L, "ProductKey copied to clipboard") Case $msg = $InstallDate_B ClipPut(WMIDateStringToDate($objOperatingSystem.InstallDate)) GUICtrlSetData($status_L, "InstallDate copied to clipboard") Case $msg = $LastBootUpTime_B ClipPut(WMIDateStringToDate($objOperatingSystem.LastBootUpTime)) GUICtrlSetData($status_L, "LastBootUpTime copied to clipboard") Case $msg = $registeredOwner_B ClipPut(RegRead($key4RegisteredOwner, "RegisteredOwner")) GUICtrlSetData($status_L, "RegisteredOwner copied to clipboard") Case $msg = $OfficeKey_B ClipPut($BinaryDPID) GUICtrlSetData($status_L, "OfficeKey copied to clipboard") Case Else ;;;;;;; EndSelect EndIf WEnd Exit Func DecodeProductKey($BinaryDPID) Local $bKey[15] Local $sKey[29] Local $Digits[24] Local $Value = 0 Local $hi = 0 Local $n = 0 Local $i = 0 Local $dlen = 29 Local $slen = 15 Local $Result $Digits = StringSplit("BCDFGHJKMPQRTVWXY2346789", "") $BinaryDPID = StringMid($BinaryDPID, 105, 30) For $i = 1 To 29 Step 2 $bKey[Int($i / 2) ] = Dec(StringMid($BinaryDPID, $i, 2)) Next For $i = $dlen - 1 To 0 Step - 1 If Mod(($i + 1), 6) = 0 Then $sKey[$i] = "-" Else $hi = 0 For $n = $slen - 1 To 0 Step - 1 $Value = BitOR(BitShift($hi, -8), $bKey[$n]) $bKey[$n] = Int($Value / 24) $hi = Mod($Value, 24) Next $sKey[$i] = $Digits[$hi + 1] EndIf Next For $i = 0 To 28 $Result = $Result & $sKey[$i] Next Return $Result EndFunc;==>DecodeProductKey Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 7, 2) & "/" & _ StringMid($dtmDate, 5, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2)) EndFunc;==>WMIDateStringToDate Func progress() If $counter = 3 Then For $i = 0 To 20 Step 1 GUICtrlSetData($progressbar, $i) Sleep($wait / 20) Next ElseIf $counter = 2 Then For $i = 20 To 50 Step 1 GUICtrlSetData($progressbar, $i) Sleep($wait / 30) Next ElseIf $counter = 1 Then For $i = 50 To 80 Step 1 GUICtrlSetData($progressbar, $i) Sleep($wait / 30) Next ElseIf $counter = 0 Then For $i = 80 To 100 Step 1 GUICtrlSetData($progressbar, $i) Sleep($wait / 20) Next GUICtrlSetState($progressbar, $GUI_HIDE) EndIf EndFunc;==>progress ;=============================================================================== ; ; Function Name: _GetOfficeKey() ; Description: gets the Office DigitalProductID from the registry ; Parameter(s): none ; Requirement(s): none ; Return Value(s): Returns the binary 2003 Office DigitalProductID as stored in the registry ; Author(s): Danny35d ; ;=============================================================================== ; TBD: Error checking and SetError Func _GetOfficeKey($sRemoteComputer = '') Dim $aKeys[1][3] If $sRemoteComputer <> '' Then $sRemoteComputer = '\\' & StringReplace($sRemoteComputer, '\', '') & '\' Local $sRegKey1 = $sRemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office' Local $sRegKey2 = $sRemoteComputer & 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' Local $iCount1 = 1, $iCount2 = 1 While 1 $sKey1 = RegEnumKey($sRegKey1, $iCount1) If @error <> 0 Then ExitLoop While 1 $ProductID = '' $ProductName = '' $DigitalProductID = '' $sKey2 = RegEnumKey($sRegKey1 & '\' & $sKey1 & '\Registration', $iCount2) If @error <> 0 Then ExitLoop $ProductID = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductID') $ProductName = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName') $DigitalProductID = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'DigitalProductID') If $ProductName = '' Then $ProductName = RegRead($sRegKey2 & '\' & $sKey2, 'DisplayName') $DigitalProductID = _DecodeProductKey($DigitalProductID) If $DigitalProductID <> 'BBBBB-BBBBB-BBBBB-BBBBB-BBBBB' Then ReDim $aKeys[UBound($aKeys) + 1][3] $aKeys[0][0] = UBound($aKeys) - 1 $aKeys[UBound($aKeys) - 1][0] = $ProductName $aKeys[UBound($aKeys) - 1][1] = $ProductID $aKeys[UBound($aKeys) - 1][2] = $DigitalProductID EndIf $iCount2 += 1 WEnd $iCount1 += 1 WEnd Return($aKeys) EndFunc ;==>_GetOfficeKey ;=============================================================================== ; ; Function Name: _DecodeProductKey() ; Description: decodes the PID to get the product key ; Parameter(s): $BinaryDPID - the PID as stored in registry ; Requirement(s): none ; Return Value(s): Returns the decoded Windows/Office/Visual studio/etc. product key ; Author(s): found this in the Forum, who made it?! ; ;=============================================================================== Func _DecodeProductKey($BinaryDPID) Local $bKey[15] Local $sKey[29] Local $Digits[24] Local $Value = 0 Local $hi = 0 Local $n = 0 Local $i = 0 Local $dlen = 29 Local $slen = 15 Local $Result $Digits = StringSplit("BCDFGHJKMPQRTVWXY2346789", "") $binaryDPID = StringMid($binaryDPID, 105, 30) For $i = 1 To 29 Step 2 $bKey[Int($i / 2) ] = Dec(StringMid($binaryDPID, $i, 2)) Next For $i = $dlen - 1 To 0 Step - 1 If Mod(($i + 1), 6) = 0 Then $sKey[$i] = "-" Else $hi = 0 For $n = $slen - 1 To 0 Step - 1 $Value = BitOR(BitShift($hi, -8), $bKey[$n]) $bKey[$n] = Int($Value / 24) $hi = Mod($Value, 24) Next $sKey[$i] = $Digits[$hi + 1] EndIf Next For $i = 0 To 28 $Result = $Result & $sKey[$i] Next Return $Result EndFunc ;==>_DecodeProductKey Edited November 20, 2008 by unknownwarezorg Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 20, 2008 Share Posted November 20, 2008 Well I couldnt get that to work. Can someone look over my code? Thanks in advanced Please dont tell me what to put where... Im a noob coder. I took this and wanted to make it extract office 2007 ; ...<snip> ;=============================================================================== ; ; Function Name: _GetOfficeKey() ; Description: gets the Office DigitalProductID from the registry ; Parameter(s): none ; Requirement(s): none ; Return Value(s): Returns the binary 2003 Office DigitalProductID as stored in the registry ; Author(s): Danny35d ; ;=============================================================================== ; ...<snip> ;=============================================================================== ; ; Function Name: _DecodeProductKey() ; Description: decodes the PID to get the product key ; Parameter(s): $BinaryDPID - the PID as stored in registry ; Requirement(s): none ; Return Value(s): Returns the decoded Windows/Office/Visual studio/etc. product key ; Author(s): found this in the Forum, who made it?! ; ;=============================================================================== ; ...<snip> Cracking product keys is not supported on this forum. Take it elsewhere. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
unknownwarezorg Posted November 20, 2008 Author Share Posted November 20, 2008 I am not cracking, I have lost my case and need my key before i reformat. Link to comment Share on other sites More sharing options...
CounterCraft Posted November 20, 2008 Share Posted November 20, 2008 (spoiler)I swear I recall something like this in other section of forum in this site... wonder what you can do to find that thread?(/spoiler) *walks away* Link to comment Share on other sites More sharing options...
Mobius Posted November 20, 2008 Share Posted November 20, 2008 I am not cracking, I have lost my case and need my key before i reformat.Dude, if you were that desperate then you wouldn't be trying to write a script to do it,You would just browse a warez site and download an office 07 key dump tool.good attempt though man, keep at it! Link to comment Share on other sites More sharing options...
Bert Posted November 21, 2008 Share Posted November 21, 2008 http://www.belarc.com/ba5.html?BInstall Belarc Adviser. It will get the key and display it in a local webpage. Free software. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now