Jump to content
Sign in to follow this  

Autoit Captcha

Recommended Posts

I was looking around on the internet and found a source code to some php and seen a captcha so I am working on one for autoit, it is not finished yet but heres a start.

here is our result once I finish it.

#include <GUIConstants.au3>
#include <IE.au3>

$oIE = _IECreateEmbedded ()
$Form1 = GUICreate("Are You a Human?", 500, 500)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 500, 500)
_IENavigate ($oIE, "http://www.anythingweb.org/PHP/phpCaptcha/example1.php")

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
WEndoÝ÷ Ù7¬´Z+«­¢+رÐìýÁ¡À)ÍÍÍ¥½¹}ÍÑÉÐ ¤ì)¥¡¥ÍÍÐ ÀÌØí}A=MQlÌäíÍÕµ¥ÐÌäít¤¤ì(¥¡¥ÍÍÐ ÀÌØí}A=MQlÌäíÁÑ¡QáÐÌäít¤µÀìµÀì¥ÍÍÐ ÀÌØí}MMM%=9lÌäíÁÑ¡QáÐÌäít¤¤ì(¥¡µÔ ÀÌØí}A=MQlÌäíÁÑ¡QáÐÌäít¤ôôÀÌØí}MMM%=9lÌäíÁÑ¡QáÐÌäít¤ì(¡¼ÌäíQ¡
!½¥Ì¹½Ð½ÉÉиe½Ô¸É¥ÉÐÑ¡ÕÍÈ¡ÉѼ¹ÜÁÌäìì(ô(õ±Íì(¥ ÌÌí¥ÍÍÐ ÀÌØí}A=MQlÌäíÁÑ¡QáÐÌäít¤¤ì(¡¼ÌäíA±Í¹ÑÈÑ¡ÍÕÉ¥Ñä½ÌÌìÌäìì(ô(¥ ÌÌí¥ÍÍÐ ÀÌØí}MMM%=9lÌäíÁÑ¡QáÐÌäít¤¤ì(¡¼Ìäí9¼
ÁÑ¡QáÐÌÌì(±ÐíȼÐì(±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐíÑáÐÅÕ½Ðì¹µôÅÕ½ÐíÁÑ¡QáÐÅÕ½Ðì¼Ðì(±ÐíȼÐì(±Ðí¥¹ÁÕÐÑåÁôÅÕ½ÐíÍÕµ¥ÐÅÕ½Ðì¹µôÅÕ½ÐíÍÕµ¥ÐÅÕ½ÐìÙ±ÕôÅÕ½ÐíMÕµ¥ÐÅÕ½Ðì¼Ðì(±Ð콽ɴÐoÝ÷ Ø&©µÈZjëh×6<?php 
$width = 160; 
$height = 80; 
$image = imagecreate($width, $height); 
$bgColor = imagecolorallocate($image, 0, 0, 0); 

$length = 7; 
$string = ''; 
for ($i = 0; $i < $length; $i++) { 
    $pos = rand(0, strlen($chars)-1); 
    $string .= $chars{$pos}; 
$_SESSION['captchaText'] = md5($string); 

$gridColor = imagecolorallocate($image, 175, 0, 0); 
$lines = ceil($width / 20); 
for($i = 0; $i <$lines; $i++) { 
    $x = ($i + 1) * 20; 
    imageline($image, $x, 0, $x, $height, $gridColor); 
$lines = ceil($height / 10); 
for($i = 0; $i < $lines; $i++) { 
    $y = ($i + 1) * 10; 
    imageline($image, 0, $y, $width, $y, $gridColor); 

$randomNumber = rand(5,40); 
$lineColor = imagecolorallocate($image, 130, 0, 0); 
for($i = 0; $i < $randomNumber; $i++) { 
    $randX = rand(0, $width - 1); 
    $randX2 = rand(0, $width - 1); 
    $randY = rand(0, $height - 1); 
    $randY2 = rand(0, $height - 1); 
    imageline($image, $randX, $randY, $randX2, $randY2, $lineColor); 

// write the text 
$textColor = imagecolorallocate($image, 255, 0, 0); 
$randX = rand(0, $width - 50); 
$randY = rand(0, $height - 15); 
imagestring($image, 10, $randX, $randY, $string, $textColor); 

header ("Content-type: image/png"); 

and mine will not need php at all but its a base to work off of any idea's?

Share this post

Link to post
Share on other sites

Have a blank image, add the text to the blank image at runtime, and then store that text in a var. test if it works and walla you have captcha!

Like so:

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)


Func _Main()
    Local $hGUI, $hWnd, $hGraphic, $input, $button, $array, $msg, $text
    Local $array = StringSplit ("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "")
    Local $string = ""
    For $i = 1 to 5
        $string &= $array[Random (1, UBound ($array))]
; Create GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    $hWnd = WinGetHandle("GDI+")

; Draw a string
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    _GDIPlus_GraphicsDrawString ($hGraphic, $string, 140, 110)
    $input = GUICtrlCreateInput ("", 190, 110, 50)
    $button = GUICtrlCreateButton ("Submit", 240, 140, 30)
; Loop until user exits
    While 1
        $msg = GUIGetMsg ()
            Case $msg = $GUI_EVENT_CLOSE
            Case $msg = $button
                $text = GUICtrlRead ($input)
                If $text = $string Then
                    MsgBox (0, "Captcha Example", "YAYZ!  IT WORKED!")
                    MsgBox (0, "Captcha Example", "MAYBE YOU NEED TO TEST IT MORE OR START AGAIN!")
; Clean up resources
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_Shutdown ()
EndFunc  ;==>_Main

EDIT: Updated the code...

Also, I'll leave the painstakingly hard distortion up to you...

Edited by Bert

Share this post

Link to post
Share on other sites

Oh i see, so it creates a Captcha text/image?

trying to and it will also read it as well, very busy but ill get it done unless someone does it before me lol.

wow Bert I didn't know about the GDI functions that helps a lot thanks (back from downloading lol)

hmm I came up with a cool captcha idea ill add as well

the text in image will be two numbers and you will have to add them


enter captcha



Edited by JellyFish666

Share this post

Link to post
Share on other sites

Here is another Captcha system that I like.


The Passpack team shows 8 squares. The person must select the black colored square to get started.

I think it is simple and effective. You can randomize the position of the colored square, you can randomize the color.

cool but that one is easy to bypass just look for the block square but if it changed colors and did a few other things it would work well, I almost forgot about this post I been really busy :D

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...