Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Question]simple captcha solver

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ZxExUxS
How do I cheat?
Reputation: 0

Joined: 13 Jun 2008
Posts: 1

PostPosted: Fri Jun 13, 2008 9:57 am    Post subject: [Question]simple captcha solver Reply with quote

i need a capcha solver.(screen)
probably the captcha consist of 5 parts for every letter one, because some days before the captcha only had 2 letters.
i already have found a php code for this but i dont now waht to do with it
Quote:

<?php

/**
* OCR
*
* @author Alix Axel
*/
class OCR
{
private $im;

function Color($x, $y)
{
if (!is_resource($this->im))
{
return false;
}

extract(imagecolorsforindex($this->im, imagecolorat($this->im, $x, $y)));

$red = base_convert($red, 10, 16);

if (strlen($red) < 2)
{
$red = '0' . $red;
}

$green = base_convert($green, 10, 16);

if (strlen($green) < 2)
{
$green = '0' . $green;
}

$blue = base_convert($blue, 10, 16);

if (strlen($blue) < 2)
{
$blue = '0' . $blue;
}

return strtoupper($red . $green . $blue);
}

function Info($image, $flag = null)
{
list($width, $height, $type) = getimagesize($image);

if (!empty($flag))
{
$flag = strtolower(trim($flag));

if ($flag == 'width')
{
return $width;
}

else if ($flag == 'height')
{
return $height;
}

else if ($flag == 'type')
{
switch ($type)
{
case 1:
return 'gif';
break;

case 2:
return 'jpg';
break;

case 3:
return 'png';
break;
}
}

return false;
}

switch ($type)
{
case 1:
$type = 'gif';
break;

case 2:
$type = 'jpg';
break;

case 3:
$type = 'png';
break;
}

$result = array
(
'width' => $width,
'height' => $height,
'type' => $type
);

return $result;
}

function Read($tag, $image, $background_vector = 'FFFFFF')
{
$image_info = $this->Info($image);

$tag = strtolower($tag);

if (!is_dir('OCR/' . $tag . '/'))
{
return false;
}

$characters = array();

$handle = opendir('OCR/' . $tag . '/patterns/');

while (($file = readdir($handle)) !== false)
{
if (($file != '.') && ($file != '..'))
{
if (!is_dir('OCR/' . $tag . '/patterns/' . $file))
{
$file = str_replace('.ocr', '', $file);

$characters[$file] = $file;
}
}
}

closedir($handle);

$ignore_hash = '';

if (!empty($background_vector))
{
if (strlen($background_vector) == 6)
{
$ignore_hash = md5(str_repeat($background_vector, $image_info['height']));
}

else
{
$ignore_hash = md5($background_vector);
}
}

if ($image_info['type'] == 'gif')
{
$this->im = imagecreatefromgif($image);
}

else if ($image_info['type'] == 'jpg')
{
$this->im = imagecreatefromjpeg($image);
}

else if ($image_info['type'] == 'png')
{
$this->im = imagecreatefrompng($image);
}

$test = array();
$column = 0;
$candidates = array();
$result = '';

for ($i = 0; $i < $image_info['width']; $i++)
{
$test[$column] = '';

for ($j = 0; $j < $image_info['height']; $j++)
{
$test[$column] .= $this->Color($i, $j);
}

$test[$column] = md5($test[$column]);

if ($test[$column] == $ignore_hash)
{
$test = array();
$column = 0;
}

else
{
if (empty($candidates[$i - $column]))
{
foreach ($characters as $character)
{
$pattern = unserialize(file_get_contents('OCR/' . $tag . '/patterns/' . $character . '.ocr'));

if ($test[$column] == $pattern[$column])
{
$candidates[$i - $column][] = $character;
}
}
}

else
{
foreach ($candidates[$i - $column] as $character)
{
$pattern = unserialize(file_get_contents('OCR/' . $tag . '/patterns/' . $character . '.ocr'));

if ($test[$column] != $pattern[$column])
{
$key = array_search($character, $candidates[$i - $column]);

unset($candidates[$i - $column][$key]);
}
}
}

if (count($candidates[$i - $column]) == 1)
{
$candidates[$i - $column] = array_values($candidates[$i - $column]);
$result .= $candidates[$i - $column][0];

$character_width = $this->Info('OCR/' . $tag . '/source/' . $candidates[$i - $column][0] . '.' . $image_info['type'], 'width');

$i = $i - $column + $character_width - 1;
$column = 0;
}

else
{
$column++;
}
}
}

return $result;
}

function Train($tag, $character, $image)
{
if (!file_exists($image))
{
return false;
}

else
{
$image_info = $this->Info($image);
}

$tag = strtolower($tag);

if (!is_dir('OCR/' . $tag . '/'))
{
mkdir('OCR/' . $tag . '/');
}

if (!is_dir('OCR/' . $tag . '/source/'))
{
mkdir('OCR/' . $tag . '/source/');
}

if (file_exists('OCR/' . $tag . '/source/' . $character . '.' . $image_info['type']))
{
@unlink('OCR/' . $tag . '/source/' . $character . '.' . $image_info['type']);
}

@copy($image, 'OCR/' . $tag . '/source/' . $character . '.' . $image_info['type']);

$image = 'OCR/' . $tag . '/source/' . $character . '.' . $image_info['type'];

if ($image_info['type'] == 'gif')
{
$this->im = imagecreatefromgif($image);
}

else if ($image_info['type'] == 'jpg')
{
$this->im = imagecreatefromjpeg($image);
}

else if ($image_info['type'] == 'png')
{
$this->im = imagecreatefrompng($image);
}

$result = array();

for ($i = 0; $i < $image_info['width']; $i++)
{
$result[$i] = '';

for ($j = 0; $j < $image_info['height']; $j++)
{
$result[$i] .= $this->Color($i, $j);
}

$result[$i] = md5($result[$i]);
}

if (!is_dir('OCR/' . $tag . '/patterns/'))
{
mkdir('OCR/' . $tag . '/patterns/');
}

if (file_exists('OCR/' . $tag . '/patterns/' . $character . '.ocr'))
{
@unlink('OCR/' . $tag . '/patterns/' . $character . '.ocr');
}

$handle = @fopen('OCR/' . $tag . '/patterns/' . $character . '.ocr', 'wb');

flock($handle, LOCK_EX);
fwrite($handle, serialize($result));
flock($handle, LOCK_UN);
fclose($handle);
}
}

highlight_file(__FILE__);

?>

i hope somebody can help me

ps: the captcha is from the browser game knights of kalindor
kalindor.at



_captcha.img.php4.png
 Description:
 Filesize:  4.41 KB
 Viewed:  3600 Time(s)

_captcha.img.php4.png



_captcha.img.ph3p.png
 Description:
 Filesize:  4.15 KB
 Viewed:  3600 Time(s)

_captcha.img.ph3p.png



_captcha.img.php.png
 Description:
 Filesize:  3.58 KB
 Viewed:  3604 Time(s)

_captcha.img.php.png


Back to top
View user's profile Send private message
Trow
Grandmaster Cheater
Reputation: 2

Joined: 17 Aug 2006
Posts: 957

PostPosted: Sat Jun 14, 2008 1:03 am    Post subject: Reply with quote

I don't think php has any image handlers - look in the code documentation for what other tools you need
_________________
Get kidnapped often.
Back to top
View user's profile Send private message
ZxExUxS
How do I cheat?
Reputation: 0

Joined: 13 Jun 2008
Posts: 1

PostPosted: Mon Jun 16, 2008 8:15 am    Post subject: Reply with quote

hm my problem is that i cant writing programs so im not ale to make pogram that compares 2 images.
i would be nice if one of you could write it.
thegathering of the members is no problem for me.

sorry for late reply
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites