Jump to content

Authentication Device


JellyFish666
 Share

Recommended Posts

I was really bored, so that is why I made this it could be better but got bored of making it :o

I do not play World of Warcraft but was curious of this little device, I can not make a real working one because I do not have a server to mess around with this project and I could of made two Autoit scripts to have a proof example but that is when the boredom really sunk in :)

http://eu.blizzard.com/store/_images/product?productId=221003132&type=3&loc=en-GB.jpg

#include <String.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Token , $Source = @ScriptDir & "\UniqueKey.txt"

FileWrite($Source , _UniqueKey()) 

$GUI = GUICreate("Security Token", 200, 20)
$Token = GUICtrlCreateInput("" , 0, 0, 100, 20)
$Gen = GUICtrlCreateButton("Gen" , 100 , 0 , 100 , 20)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            FileDelete($Source)
            Exit
        Case $Gen
            _Key(FileRead($Source))
    EndSwitch
WEnd

#cs
Function Name - Key

This Function receives the unqie key and converts 
it to a key that the server would be using.
#CE

Func _Key($UniqueKey)
    #CS
    I am cheating by using _StringEncrypt you can
    use your own Encryption method.
    
    I am also cheating by using random for the 
    _StringEncrypt text part.
    #CE 
    
    $Encrypt = _StringEncrypt(1 , _Random() , $UniqueKey , 1)
    
    GUICtrlSetData($Token , StringTrimRight($Encrypt , StringLen($Encrypt) -6)) ; I cut the return string to 6 numbers/letters or less because I want a small return value.
EndFunc

#CS
Function Name - Unique Key

This Function is to generate random alphabetical letters,
the purpose of this is to act like the numbers/letters found
on the back of Blizzards authentication tokens.
#CE

Func _UniqueKey()
$Key = 0
$String = ""
Do
    $Letter = Chr(Random(Asc("A"), Asc("Z"), 1))
    $String &= $Letter
    $Key = $Key +1
Until $Key = 6
Return StringTrimLeft($String , 3) & "-" & StringTrimRight($String , 3)
EndFunc

#CS
Function Name - Random

This is my Random Function.

1 - Numbers
2 - Lower case
3 - Capitals

Error, no idea why lower case isn't working.
#CE

Func _Random()
    $RanString = ""
    $Ran = Random(1 , 3 , 1)
    If $Ran = 1 Then
        $Num = Random(0 , 9 , 1)
        $RanString &= $Num
    ElseIf $Ran = 2 Then
        $Lower = Random(Asc("a") , Asc("z") , 1)
        $RanString &= $Lower
    ElseIf $Ran = 3 Then
        $Caps = Random(Asc("A") , Asc("Z") , 1)
        $RanString &= $Caps
    Else
        Exit
    EndIf
    Return $RanString
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...