Sign in to follow this  
Followers 0

Captcha Code

18 posts in this topic

#1 ·  Posted (edited)

Hiya!

This is my first time EVER creating such thing, any suggestions, tips, etc. would be helpfull.

I have no idea how hard it is to crack such thing... Oh well.

Syntax

_CaptchaCode($iNumOfTries)

Screenshot

Posted Image

Example

#include <EditConstants.au3>
#include "CaptchaCode.au3"

$GUI = GUICreate("Register Form", 210, 110)
GUICtrlCreateLabel("Userame:", 10, 10)
GUICtrlCreateLabel("Email:", 10, 30)
GUICtrlCreateLabel("Password:", 10, 50)
$Username = GUICtrlCreateInput("", 100, 7, 100)
$Email = GUICtrlCreateInput("", 100, 27, 100)
$Password = GUICtrlCreateInput("", 100, 47, 100, 20, $ES_PASSWORD)
$Register = GUICtrlCreateButton("Register", 10, 75, 90)
$Clear = GUICtrlCreateButton("Clear", 110, 75, 90)

GUISetState()
While 1
    Switch GUIGetMsg()
    Case -3
        Exit
        
    Case $Register
        If GUICtrlRead($Username) <> "" And GUICtrlRead($Email) <> "" And GUICtrlRead($Password) <> "" Then
            If _CaptchaCode(3) Then
                MsgBox(64, Default, "Registration done!")
                $Data = ""
                $Data &= "Username  : " & GUICtrlRead($Username) & @CRLF
                $Data &= "Email     : " & GUICtrlRead($Email) & @CRLF
                $Data &= "Password  : " & GUICtrlRead($Password) & @CRLF
                FileWrite(@DesktopDir & "\register_form.txt", $Data)
            Else
                MsgBox(16, Default, "Tries maxed out, exiting program.")
                Exit
            EndIf
        Else
            MsgBox(16, Default, "Please fill in every information.")
        EndIf
        
    Case $Clear
        GUICtrlSetData($Username, "")
        GUICtrlSetData($Email, "")
        GUICtrlSetData($Password, "")
        
    EndSwitch
WEnd

CaptchaCode.au3

#include <GUIConstantsEx.au3>

; MD5 UDF: http://www.autoitscript.com/forum/index.php?showtopic=10590

$iOptOld = Opt("GUIEventOptions",0)
Opt("GUIEventOptions", $iOptOld)

Global $__CaptchaCode_cCharacter[6], $c__CaptchaCode_Label[5], $c__CaptchaCode_Line[2], $a__CaptchaCode_Font[6]
Global $__CaptchaCode_Tries

Func _CaptchaCode($iNumOfTries)
    Local $sCaptchaCode
    
    $__CaptchaCode_Tries = 0
    
    $hWnd = GUICreate("       * ENTER CODE *", 175, 150, -1, -1, 0x00080000)
    $cBg = GUICtrlCreateLabel("", 10, 10, 150, 50)
    GUICtrlSetState($cBg, 128)
    GUICtrlSetBkColor($cBg, 0x000000)
    $cInput = GUICtrlCreateInput("", 10, 70, 150, 20)
    $cCheck = GUICtrlCreateButton("Check", 10, 95, 70)
    $cNew = GUICtrlCreateButton("New", 90, 95, 70)
    
    $sCaptchaCode = __CaptchaCode_Create()
    
    $cFg = GUICtrlCreateLabel("", 10, 10, 150, 50)
    GUICtrlSetBkColor($cFg, -2)
        
    GUISetState()
    While 1
        Switch GUIGetMsg()
        Case -3
            
        Case $cNew
            __CaptchaCode_Delete()
            $sCaptchaCode = __CaptchaCode_Create()
            GUICtrlSetData($cInput, "")
            
        Case $cCheck
            If $__CaptchaCode_Tries == $iNumOfTries - 1 Then
                __CaptchaCode_Delete()
                GUIDelete($hWnd)
                Return False
                ExitLoop
            Else
                If (GUICtrlRead($cInput) == $sCaptchaCode) Then
                    __CaptchaCode_Delete()
                    GUIDelete($hWnd)
                    Return True
                    ExitLoop
                Else
                    $__CaptchaCode_Tries += 1
                    MsgBox(16, "* ERROR *", "Wrong Code!")
                    __CaptchaCode_Delete()
                    $sCaptchaCode = __CaptchaCode_Create()
                    GUICtrlSetData($cInput, "")
                EndIf
            EndIf
            
        EndSwitch
        
    WEnd
EndFunc

Func __CaptchaCode_Create()
    Local $sCaptcha = __CaptchaCode_Generate()
    Local $iX = Random(15, 25, 1)
    Local $iY = Random(15, 40, 1)
    
    $a__CaptchaCode_Font[0] = "Arial Black"
    $a__CaptchaCode_Font[1] = "Comic Sans MS"
    $a__CaptchaCode_Font[2] = "Impact"
    $a__CaptchaCode_Font[3] = "Tahoma"
    $a__CaptchaCode_Font[4] = "System"
    $a__CaptchaCode_Font[5] = "Verdama"
    
    $aSplit = StringSplit($sCaptcha, "")
    For $x = 0 To 5
        $__CaptchaCode_cCharacter[$x] = GUICtrlCreateLabel($aSplit[$x + 1], $iX, $iY)
        $iX += 20 + Random(1, 5, 1)
        $iY = Random(15, 40, 1)
        
        GUICtrlSetBkColor($__CaptchaCode_cCharacter[$x], -2)
        GUICtrlSetColor($__CaptchaCode_cCharacter[$x], Random(0x808080, 0xC0C0C0))
        
        $iNum = Random(1, 7, 1)
        Switch $iNum
        Case 1
            $iStyle = 2 ;2
        Case 2
            $iStyle = 4 ;4
        Case 3
            $iStyle = 8 ;8
        Case 4
            $iStyle = 2 + 4 ;6
        Case 5
            $iStyle = 4 + 8 ;12
        Case 6
            $iStyle = 2 + 8 ;10
        Case 7
            $iStyle = 2 + 4 + 8 ;16
        EndSwitch
        
        GUICtrlSetFont($__CaptchaCode_cCharacter[$x], 13, Random(350, 450, 1), $iStyle, $a__CaptchaCode_Font[Random(0, 5, 1)])
        
        Sleep(10)
    Next
    
    $iX = 15 + Random(1, 10, 1)
    $iY = 5 + Random(1, 10, 1)
    For $z = 0 To 4
        $c__CaptchaCode_Label[$z] = GUICtrlCreateLabel("", $iX, $iY, 1, 30)
        $iX += 25 + Random(1, 10, 1)
        $iY = 5 + Random(1, 30, 1)
        
        GUICtrlSetBkColor($c__CaptchaCode_Label[$z], Random(0x808080, 0xC0C0C0))
    Next
    
    $iX = 5 + Random(1, 25, 1)
    $iY = 20 + Random(1, 10, 1)
    For $b = 0 To 1
        $c__CaptchaCode_Line[$b] = GUICtrlCreateLabel("", $iX, $iY, 130, 1)
        $iX = 5 + Random(1, 10, 1)
        $iY += 10 + Random(1, 10, 1)
        
        GUICtrlSetBkColor($c__CaptchaCode_Line[$b], Random(0x808080, 0xC0C0C0))
    Next
    
    Return $sCaptcha
EndFunc

Func __CaptchaCode_Delete()
    For $y = 0 To 5
        GUICtrlDelete($__CaptchaCode_cCharacter[$y])
    Next
    
    For $a = 0 To 4
        GUICtrlDelete($c__CaptchaCode_Label[$a])
    Next
    
    For $c = 0 To 1
        GUICtrlDelete($c__CaptchaCode_Line[$c])
    Next
EndFunc

Func __CaptchaCode_Generate()
    Local $sCharacters = StringSplit("BCDFGHJKLMNPQRSTVWXYZ1234567890", "")
    Local $sCode = ""
    
    For $i = 1 To 6
        $sCode &= $sCharacters[Random(1, $sCharacters[0], 1)]
    Next
    
    Return $sCode   
EndFunc

UPDATE 09-04-10: Changed variable names, function names, added a tries system

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Looks nice :(...

I recommend that you add

$iOptOld = Opt("GUIEventOptions",0)

Opt("GUIEventOptions",$iOptOld)

at the beginning and end of the _CreateCaptcha() function.

Edit:

And also you should rename the global variables used to a more UDF related name, something like

Global $__CaptchaCode_cCharacter[6], $c__CaptchaCode_Label[5], $c__CaptchaCode_Line[2], $a__CaptchaCode_Font[6]

And maybe the functions too...

_CaptchaCode()

__CaptchaCode_Create()

__CaptchaCode_Delete()

__CaptchaCode_Generate()

Edited by KaFu

Share this post


Link to post
Share on other sites

#3 ·  Posted

I would make it have a return type of true / false rather than calling a function. Just opinion. I would also work on the spelling of 'success' :( . If you intend to use this properly then lots of labels will not work, as simply going through all the windows children looking for controls with the class 'Static' and reading those will crack it. An easy solution is to give the lines their own text, but that will also be easy enough to figure out from the size. Ultimately, GUICtrlCreateGraphic is the solution... Or disable all the labels and put another label over the top. I haven't tried that but it could work.... (I had to try it out :) see spoiler)

#include <GUIConstantsEx.au3>

Global $cCharacter[6], $cLabel[5], $cLine[2], $aFont[6]

_CaptchaCode("Succes")

Func Succes()
    MsgBox(0, "Succes!", "Captcha was correct!")
EndFunc

Func _CaptchaCode($sFunctionName)
    Local $sCaptchaCode

    $hWnd = GUICreate("       * ENTER CODE *", 175, 150, -1, -1, 0x00080000)
    $cBg = GUICtrlCreateLabel("", 10, 10, 150, 50)
    GUICtrlSetBkColor($cBg, 0x000000)
    GUICtrlSetState($cBg, 128)
    $cInput = GUICtrlCreateInput("", 10, 70, 150, 20)
    $cCheck = GUICtrlCreateButton("Check", 10, 95, 70)
    $cNew = GUICtrlCreateButton("New", 90, 95, 70)

    $sCaptchaCode = _CreateCaptcha()
    $cFg = GUICtrlCreateLabel("", 10, 10, 150, 50)
    GUICtrlSetBkColor($cFg, -2)

    GUISetState()
    While 1
        Switch GUIGetMsg()
        Case -3
            Exit

        Case $cNew
            _DeleteCaptcha()
            $sCaptchaCode = _CreateCaptcha()

        Case $cCheck
            If (GUICtrlRead($cInput) == $sCaptchaCode) Then
                _DeleteCaptcha()
                GUIDelete($hWnd)

                Call($sFunctionName)

                ExitLoop
            Else
                MsgBox(16, "* ERROR *", "Wrong Code!")
                _DeleteCaptcha()
                $sCaptchaCode = _CreateCaptcha()
                GUICtrlSetData($cInput, "")
            EndIf

        EndSwitch
    WEnd
EndFunc

Func _CreateCaptcha()
    Local $sCaptcha = _GenerateCaptcha()
    Local $iX = Random(15, 25, 1)
    Local $iY = Random(15, 40, 1)

    $aFont[0] = "Arial Black"
    $aFont[1] = "Comic Sans MS"
    $aFont[2] = "Impact"
    $aFont[3] = "Tahoma"
    $aFont[4] = "System"
    $aFont[5] = "Verdama"

    $aSplit = StringSplit($sCaptcha, "")
    For $x = 0 To 5
        $cCharacter[$x] = GUICtrlCreateLabel($aSplit[$x + 1], $iX, $iY)
        $iX += 20 + Random(1, 5, 1)
        $iY = Random(15, 40, 1)

        GUICtrlSetBkColor($cCharacter[$x], -2)
        GUICtrlSetColor($cCharacter[$x], Random(0x808080, 0xC0C0C0))

        $iNum = Random(1, 7, 1)
        Switch $iNum
        Case 1
            $iStyle = 2
        Case 2
            $iStyle = 2
        Case 3
            $iStyle = 4
        Case 4
            $iStyle = 2 + 4
        Case 5
            $iStyle = 4 + 8
        Case 6
            $iStyle = 2 + 8
        Case 7
            $iStyle = 2 + 4 + 8
        EndSwitch

        GUICtrlSetFont($cCharacter[$x], "", Random(350, 450, 1), $iStyle, $aFont[Random(0, 5, 1)])

        Sleep(10)
    Next

    $iX = 15 + Random(1, 10, 1)
    $iY = 5 + Random(1, 10, 1)
    For $z = 0 To 4
        $cLabel[$z] = GUICtrlCreateLabel("", $iX, $iY, 1, 30)
        $iX += 25 + Random(1, 10, 1)
        $iY = 5 + Random(1, 30, 1)

        GUICtrlSetBkColor($cLabel[$z], Random(0x808080, 0xC0C0C0))
    Next

    $iX = 5 + Random(1, 25, 1)
    $iY = 20 + Random(1, 10, 1)
    For $b = 0 To 1
        $cLine[$b] = GUICtrlCreateLabel("", $iX, $iY, 130, 1)
        $iX = 5 + Random(1, 10, 1)
        $iY += 10 + Random(1, 10, 1)

        GUICtrlSetBkColor($cLine[$b], Random(0x808080, 0xC0C0C0))
    Next

    Return $sCaptcha
EndFunc

Func _DeleteCaptcha()
    For $y = 0 To 5
        GUICtrlDelete($cCharacter[$y])
    Next

    For $a = 0 To 4
        GUICtrlDelete($cLabel[$a])
    Next

    For $c = 0 To 1
        GUICtrlDelete($cLine[$c])
    Next
EndFunc

Func _GenerateCaptcha()
    Local $sCharacters = StringSplit("BCDFGHJKLMNPQRSTVWXYZ1234567890", "")
    Local $sCode = ""

    For $i = 1 To 6
        $sCode &= $sCharacters[Random(1, $sCharacters[0], 1)]
    Next

    Return $sCode
EndFunc

In answer to your remark of: 'I have no idea how hard it is to crack such thing... Oh well.', it would be easy enough. But it looks impressive.

Share this post


Link to post
Share on other sites

#4 ·  Posted

Well, I tinkered around a PHP captcha a while ago. To make that work, one way is to create a captach from a string, then encypt this string with a one-way algo. (e.g. md5()), send that as a cookie, and finally compare the md5() value of the users input with the value of the cookie... might be an issue here too, if you want to make it hacker proof :( (I guess it might be possible to read the unencrypted string directly from memory).

Share this post


Link to post
Share on other sites

#5 ·  Posted

Nice, there is few similar examples of generating captcha: http://www.autoitscript.com/forum/index.php?showtopic=85143


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

#6 ·  Posted

Pretty cool! :(

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Looks nice :)...

I recommend that you add

$iOptOld = Opt("GUIEventOptions",0)

Opt("GUIEventOptions",$iOptOld)

at the beginning and end of the _CreateCaptcha() function.

Edit:

And also you should rename the global variables used to a more UDF related name, something like

Global $__CaptchaCode_cCharacter[6], $c__CaptchaCode_Label[5], $c__CaptchaCode_Line[2], $a__CaptchaCode_Font[6]

And maybe the functions too...

_CaptchaCode()

__CaptchaCode_Create()

__CaptchaCode_Delete()

__CaptchaCode_Generate()

Thanks! And, yeah... Probably a good idea.

I would make it have a return type of true / false rather than calling a function.

True... *changes*

Well, I tinkered around a PHP captcha a while ago. To make that work, one way is to create a captach from a string, then encypt this string with a one-way algo. (e.g. md5()), send that as a cookie, and finally compare the md5() value of the users input with the value of the cookie... might be an issue here too, if you want to make it hacker proof :) (I guess it might be possible to read the unencrypted string directly from memory).

I wanted to encrypt it at first thought, not a good idea though, so I will try your way. :(

Nice, there is few similar examples of generating captcha: http://www.autoitscript.com/forum/index.php?showtopic=85143

Oh, thanks for showing! :D

Pretty cool! ;)

Thanks! B) Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Updated! See first post.

Well, I tinkered around a PHP captcha a while ago. To make that work, one way is to create a captach from a string, then encypt this string with a one-way algo. (e.g. md5()), send that as a cookie, and finally compare the md5() value of the users input with the value of the cookie... might be an issue here too, if you want to make it hacker proof (I guess it might be possible to read the unencrypted string directly from memory).

Eh, I failed at that part. :)

Or disable all the labels and put another label over the top.

Thanks for that! :(

Ouch. I actualy DO need graphics... :)

If WinExists(WinGetTitle("", "New")) Then
    $Text = WinGetText(WinGetTitle("", "New"))
    
    $Split = StringSplit($Text, Chr(10))
    For $i = 3 To $Split[0]
        ControlSend(WinGetTitle("", "New"), "", "[CLASS:Edit; INSTANCE:1]", StringUpper($Split[$i]))
    Next
EndIf
Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#9 ·  Posted

You've put the $iOptOld = Opt("GUIEventOptions", 0) and Opt("GUIEventOptions", $iOptOld) at the wrong place. Additionally I added the md5 crypt I meant...

#include <GUIConstantsEx.au3>
#include <Crypt.au3>

Global $__CaptchaCode_cCharacter[6], $c__CaptchaCode_Label[5], $c__CaptchaCode_Line[2], $a__CaptchaCode_Font[6]
Global $__CaptchaCode_Tries

Func _CaptchaCode($iNumOfTries)
    $iOptOld = Opt("GUIEventOptions", 0)

    Local $sCaptchaCode

    $__CaptchaCode_Tries = 0

    $hWnd = GUICreate("ENTER CODE", 175, 160, -1, -1, 0x00080000)
    $cBg = GUICtrlCreateLabel("", 10, 10, 150, 50)
    GUICtrlSetState($cBg, 128)
    GUICtrlSetBkColor($cBg, 0x000000)
    $cInput = GUICtrlCreateInput("", 10, 70, 150, 20)
    $cCheck = GUICtrlCreateButton("Check", 10, 95, 70)
    $cNew = GUICtrlCreateButton("New", 90, 95, 70)

    $sCaptchaCode = __CaptchaCode_Create()

    $cFg = GUICtrlCreateLabel("", 10, 10, 150, 50)
    GUICtrlSetBkColor($cFg, -2)

    GUISetState()
    While 1
        Switch GUIGetMsg()
            Case -3
                ExitLoop

            Case $cNew
                __CaptchaCode_Delete()
                $sCaptchaCode = __CaptchaCode_Create()
                GUICtrlSetData($cInput, "")

            Case $cCheck
                If $__CaptchaCode_Tries == $iNumOfTries - 1 Then
                    ExitLoop
                Else
                    If (_Crypt_HashData(GUICtrlRead($cInput),$CALG_MD5) == $sCaptchaCode) Then
                        __CaptchaCode_Delete()
                        GUIDelete($hWnd)
                        Opt("GUIEventOptions", $iOptOld)
                        Return True
                    Else
                        $__CaptchaCode_Tries += 1
                        MsgBox(16, "* ERROR *", "Wrong Code!")
                        __CaptchaCode_Delete()
                        $sCaptchaCode = __CaptchaCode_Create()
                        GUICtrlSetData($cInput, "")
                    EndIf
                EndIf
        EndSwitch
    WEnd

    __CaptchaCode_Delete()
    GUIDelete($hWnd)
    Opt("GUIEventOptions", $iOptOld)
    Return False

EndFunc   ;==>_CaptchaCode

Func __CaptchaCode_Create()
    Local $sCaptcha = __CaptchaCode_Generate()
    Local $iX = Random(15, 25, 1)
    Local $iY = Random(15, 40, 1)

    $a__CaptchaCode_Font[0] = "Arial Black"
    $a__CaptchaCode_Font[1] = "Comic Sans MS"
    $a__CaptchaCode_Font[2] = "Impact"
    $a__CaptchaCode_Font[3] = "Tahoma"
    $a__CaptchaCode_Font[4] = "System"
    $a__CaptchaCode_Font[5] = "Verdama"

    $aSplit = StringSplit($sCaptcha, "")
    For $x = 0 To 5
        $__CaptchaCode_cCharacter[$x] = GUICtrlCreateLabel($aSplit[$x + 1], $iX, $iY)
        $iX += 20 + Random(1, 5, 1)
        $iY = Random(15, 40, 1)

        GUICtrlSetBkColor($__CaptchaCode_cCharacter[$x], -2)
        GUICtrlSetColor($__CaptchaCode_cCharacter[$x], Random(0x808080, 0xC0C0C0))

        $iNum = Random(1, 7, 1)
        Switch $iNum
            Case 1
                $iStyle = 2 ;2
            Case 2
                $iStyle = 4 ;4
            Case 3
                $iStyle = 8 ;8
            Case 4
                $iStyle = 2 + 4 ;6
            Case 5
                $iStyle = 4 + 8 ;12
            Case 6
                $iStyle = 2 + 8 ;10
            Case 7
                $iStyle = 2 + 4 + 8 ;16
        EndSwitch

        GUICtrlSetFont($__CaptchaCode_cCharacter[$x], 13, Random(350, 450, 1), $iStyle, $a__CaptchaCode_Font[Random(0, 5, 1)])

        Sleep(10)
    Next

    $iX = 15 + Random(1, 10, 1)
    $iY = 5 + Random(1, 10, 1)
    For $z = 0 To 4
        $c__CaptchaCode_Label[$z] = GUICtrlCreateLabel("", $iX, $iY, 1, 30)
        $iX += 25 + Random(1, 10, 1)
        $iY = 5 + Random(1, 30, 1)
        GUICtrlSetBkColor($c__CaptchaCode_Label[$z], Random(0x808080, 0xC0C0C0))
    Next

    $iX = 5 + Random(1, 25, 1)
    $iY = 20 + Random(1, 10, 1)
    For $b = 0 To 1
        $c__CaptchaCode_Line[$b] = GUICtrlCreateLabel("", $iX, $iY, 130, 1)
        $iX = 5 + Random(1, 10, 1)
        $iY += 10 + Random(1, 10, 1)

        GUICtrlSetBkColor($c__CaptchaCode_Line[$b], Random(0x808080, 0xC0C0C0))
    Next

    Return _Crypt_HashData($sCaptcha,$CALG_MD5)
EndFunc   ;==>__CaptchaCode_Create

Func __CaptchaCode_Delete()
    For $y = 0 To 5
        GUICtrlDelete($__CaptchaCode_cCharacter[$y])
    Next

    For $a = 0 To 4
        GUICtrlDelete($c__CaptchaCode_Label[$a])
    Next

    For $c = 0 To 1
        GUICtrlDelete($c__CaptchaCode_Line[$c])
    Next
EndFunc   ;==>__CaptchaCode_Delete

Func __CaptchaCode_Generate()
    Local $sCharacters = StringSplit("BCDFGHJKLMNPQRSTVWXYZ1234567890", "")
    Local $sCode = ""

    For $i = 1 To 6
        $sCode &= $sCharacters[Random(1, $sCharacters[0], 1)]
    Next

    Return $sCode
EndFunc   ;==>__CaptchaCode_Generate

Ouch. I actualy DO need graphics... :)

Definitly, maybe Yashied has something in his vault for you :(...

Share this post


Link to post
Share on other sites

#11 ·  Posted

send that as a cookie, and finally compare the md5() value of the users input with the value of the cookie...

Why would you store such data in a cookie? Sessions are much better for this type of thing.

Share this post


Link to post
Share on other sites

#12 ·  Posted

Why would you store such data in a cookie? Sessions are much better for this type of thing.

If I remember correctly I've had some trouble with Session ID at that time. But why not use a one way encrypted / hashed value instead in a cookie? At least I can't see no security risk there, worst possible case is that cookie's blocked... users fault.

Share this post


Link to post
Share on other sites

#13 ·  Posted

If I remember correctly I've had some trouble with Session ID at that time. But why not use a one way encrypted / hashed value instead in a cookie? At least I can't see no security risk there, worst possible case is that cookie's blocked... users fault.

Not very user accessible is it.

Share this post


Link to post
Share on other sites

#16 ·  Posted

Ah yes, thanks for the MD5 version!


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#17 ·  Posted

Btw it's not to hard to crack if you are trying to extract the string from the image because it does just use standard fonts and no distortion, etc :(


[u]My OpenSource Projects:[/u]- [BEEP] proMusiX- Search autorun.inf

Share this post


Link to post
Share on other sites

#18 ·  Posted

Btw it's not to hard to crack if you are trying to extract the string from the image because it does just use standard fonts and no distortion, etc :(

Oh well... it's still pretty cool.


Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

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