Jump to content
Sign in to follow this  
Wb-FreeKill

Need script to convert Windows key to hex

Recommended Posts

I need a script that converts the code on the cd case, to hex(?), just as in regedit.

So you can input the cd-key, and replace it with the one in the regedit!

Share this post


Link to post
Share on other sites

It is a original windows key, ive got a script that converts the key from the registry to "normal" letters, but i cant fugure how to do it backwords

Share this post


Link to post
Share on other sites

Ofcourse not. The Hex function converts a number/integer.

Not regular text like a CD-key.

Do you want to write to the registry? Then you don't have to convert the string yourself.

(I'm talking about RegWrite)

I was wondering: what does RegRead return when you read the key?

Edited by SlimShady

Share this post


Link to post
Share on other sites

It is a original windows key, ive got a script that converts the key from the registry to "normal" letters, but i cant fugure how to do it backwords

<{POST_SNAPBACK}>

I have just created this UDF so I hope you find it useful...

JS

;===============================================================================
;
; Function Name:    _StrToHex()
; Description:    Convert a string of characters to hexidecimal.
; Parameter(s):  $strChar is the string you want to convert.
; Requirement(s):   String Input.
; Return Value(s):  On Success - Returns the converted string in hexidecimal.
;                  On Failure - -1  and sets @ERROR = 1
; Author(s):        Jarvis Stubblefield 
;
;===============================================================================

Func _StrToHex($strChar)
    Local $aryChar, $i, $iDec, $hChar, $file
    
    $aryChar = StringSplit($strChar, "")
    
    For $i = 1 To $aryChar[0]
        $iDec = Asc($aryChar[$i])
        $hChar = Hex($iDec, 2)
        $strHex = $strHex & $hChar
    Next
    
    If Not($strHex) Then
        SetError(1)
        Return -1
    Else
        Return $strHex
    EndIf
EndFunc

Edit: Modified code as specified below.

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

It's not @error = 1.

This is correct:

SetError(1)

<{POST_SNAPBACK}>

Thanks.. hehe I forgot to go back and check that against my last UDF :idiot:.

Appreciate it.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Ive tried your script, but it gives me an od number?

;===============================================================================
;
; Function Name:    _StrToHex()
; Description:      Convert a string of characters to hexidecimal.
; Parameter(s):     $strChar is the string you want to convert.
; Requirement(s):   String Input.
; Return Value(s):  On Success - Returns the converted string in hexidecimal.
;                   On Failure - -1  and sets @ERROR = 1
; Author(s):        Jarvis Stubblefield 
;
;===============================================================================

Dim $Bin
$Bin = "?????????????????????????????????"

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

Func _StrToHex($strChar)
    Local $aryChar, $i, $iDec, $hChar, $file
    
    $aryChar = StringSplit($strChar, "")
    
    For $i = 1 To $aryChar[0]
        $iDec = Asc($aryChar[$i])
        $hChar = Hex($iDec, 2)
        $strHex = $strHex & $hChar
    Next
    
    If Not($strHex) Then
        SetError(1)
        Return -1
    Else
        Return $strHex
    EndIf
EndFunc

Have i done everything correct, or?

Edited by Wb-FreeKill

Share this post


Link to post
Share on other sites

Ive tried your script, but it gives me an od number?

;===============================================================================
;
; Function Name:    _StrToHex()
; Description:    Convert a string of characters to hexidecimal.
; Parameter(s):  $strChar is the string you want to convert.
; Requirement(s):   String Input.
; Return Value(s):  On Success - Returns the converted string in hexidecimal.
;                  On Failure - -1  and sets @ERROR = 1
; Author(s):        Jarvis Stubblefield 
;
;===============================================================================

Dim $Bin
$Bin = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"

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

Func _StrToHex($strChar)
    Local $aryChar, $i, $iDec, $hChar, $file
    
    $aryChar = StringSplit($strChar, "")
    
    For $i = 1 To $aryChar[0]
        $iDec = Asc($aryChar[$i])
        $hChar = Hex($iDec, 2)
        $strHex = $strHex & $hChar
    Next
    
    If Not($strHex) Then
        SetError(1)
        Return -1
    Else
        Return $strHex
    EndIf
EndFunc

Have i done everything correct, or?

<{POST_SNAPBACK}>

Okay couple of things.

1. Do you want it converting the -'s to Hex?

If not I suggest you use string functions to remove those.

2. Remove the actual number... so people dont steal it. (I am X'ing it out).

3. PM me with what the actual Hex is in RegEdit. They may have done something else. I have made a simple string to hex converter.

4. They may have it encrypted or something.

I also noticed 00's and spaces in what you showed that they have in RegEdit. Those would have to be added. 00's are null characters.

Edit:

BTW

A4 = ยค

03 = End of Text (ETX)

Let me know anything else you find out.

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...