Sign in to follow this  
Followers 0
vickerps

finding the windows product key

10 posts in this topic

Is it possible to retrieve the windows product from somewhere. I know there are tools out there what can do this but i was wondering if there was a autoit method.

Share this post


Link to post
Share on other sites





Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Is it possible to retrieve the windows product from somewhere. I know there are tools out there what can do this but i was wondering if there was a autoit method.

You can check my example script :)

http://www.autoitscript.com/forum/index.ph...c=39336&hl=


Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.

Share this post


Link to post
Share on other sites

Thank for the reply to both of you.

BigDod i have been looking at the CompInfo.au3 but i cannot get it to work I am probably being dumb but if you give me an example script that would be nice.

I have put in CompInfo.au3 in the include section of autoit. I thought it would be a function call something like this

#include <CompInfo.au3>

_ComputerGetOSs

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

If it is just the Windows product key that you want this will work for you.

Dim $Bin
$Bin = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","DigitalProductID")

InputBox("Product Key", "Your " & @OSVERSION & " product key is:", DecodeProductKey($bin), "", -1, 100, -1, -1)


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

Not written by me but I cant remember who.

Edit - If you still want to use CompInfo.au3 look back at the topic I posted and you will see an example.

Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

another way , not mine , i just translated into autoit code

a visual basic function founded somewhere on internet :

Func _ProductKey ( )
    Local $bDigitalProductID
    Local $bProductKey[15]
    Local $bKeyChars[24]
    Local $ilByte
    Local $nCur
    Local $sCDKey
    Local $ilKeyByte
;Local $ilBit
    Local $DigitalProductId
    $DigitalProductId = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductId")
    For $ilByte = 52 To 66
        $bProductKey [ $ilByte - 52 ] = dec ( StringMid ( $DigitalProductId, 2*$ilByte+1 , 2 ) )
    Next
;  Possible characters in the CD Key:
    $bKeyChars[0] = Asc("B")
    $bKeyChars[1] = Asc("C")
    $bKeyChars[2] = Asc("D")
    $bKeyChars[3] = Asc("F")
    $bKeyChars[4] = Asc("G")
    $bKeyChars[5] = Asc("H")
    $bKeyChars[6] = Asc("J")
    $bKeyChars[7] = Asc("K")
    $bKeyChars[8] = Asc("M")
    $bKeyChars[9] = Asc("P")
    $bKeyChars[10] = Asc("Q")
    $bKeyChars[11] = Asc("R")
    $bKeyChars[12] = Asc("T")
    $bKeyChars[13] = Asc("V")
    $bKeyChars[14] = Asc("W")
    $bKeyChars[15] = Asc("X")
    $bKeyChars[16] = Asc("Y")
    $bKeyChars[17] = Asc("2")
    $bKeyChars[18] = Asc("3")
    $bKeyChars[19] = Asc("4")
    $bKeyChars[20] = Asc("6")
    $bKeyChars[21] = Asc("7")
    $bKeyChars[22] = Asc("8")
    $bKeyChars[23] = Asc("9")
    For $ilByte = 24 To 0 Step -1
        $nCur = 0
        For $ilKeyByte = 14 To 0 Step -1
           ; Step through each byte in the Product Key
            $nCur = BitXOR ( $nCur*256 , $bProductKey[$ilKeyByte] )
            $bProductKey[$ilKeyByte] = Int ( $nCur / 24 )
            $nCur                   = Mod ( $nCur , 24 )
        Next
        $sCDKey = Chr($bKeyChars[$nCur]) & $sCDKey
        If Mod ( $ilByte , 5 ) = 0 And $ilByte <> 0 Then $sCDKey = "-" & $sCDKey
    Next
    Return $sCDKey
EndFunc

Share this post


Link to post
Share on other sites

If the product key is the Serial number of current OS, then you can try using vbs (i can not translate it to autoit, therefore i done it using temp files :whistle: ):

FileWrite(@TempDir & "\vbstemp.vbs", 'On Error Resume Next' & _
    @CRLF & 'Set Fso = CreateObject("Scripting.FileSystemObject")' & _
    @CRLF & 'Set SNSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")' & _
    @CRLF & 'Set fs = CreateObject("Scripting.FileSystemObject")' & @CRLF & _
    @CRLF & 'Set a = fs.CreateTextFile("tempvbs.tmp", True)' & _
    @CRLF & 'for each SN in SNSet' & @CRLF & _
    'a.WriteLine (SN.SerialNumber)' & @CRLF & 'next' & _
    @CRLF & 'a.Close')

RunWait("wscript.exe " & @TempDir & "\vbstemp.vbs", @TempDir)
$SN = FileReadLine(@TempDir & "\tempvbs.tmp", 1)
FileDelete(@TempDir & "\tempvbs.tmp")
FileDelete(@TempDir & "\vbstemp.vbs")
MsgBox(64, "SN", "The serial number Of current OS is: " & $SN)

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

(i can not translate it to autoit, therefore i done it using temp files :whistle: ):

Here's a stab using the translator I was writing to take care of some of it...
$sSerial = ''
$oFso = ObjCreate("Scripting.FileSystemObject")
$oSNSet = ObjGet("winmgmts:")
$oWinOS = $oSNSet.InstancesOf("Win32_OperatingSystem")
For $oSN in $oWinOS
    If $oSN.SerialNumber Then
        $sSerial = $oSN.SerialNumber
        ExitLoop
    EndIf
Next
MsgBox(64, 'Serial', $sSerial)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

HI,

you might wnat to have a look at the script in my sig. :whistle:

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Here's a stab using the translator I was writing to take care of some of it...

Wow, thanks.

you might wnat to have a look at the script in my sig.

Very Nice, thank you, this is what he need i think :whistle: .

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0