Jump to content

Recommended Posts

The captcha is actually very baisc.. this wouldn't be that hard to crack I suppose. The background is a solid color, and the letters are just plain and basic.. no morphing or anything like that. After doing some investigating there's only 20 characters used within this captcha. I want to save a image for each of the 20 different characters in this captcha.

 

I was trying to think of a way to do this and make things accurate, but I'm getting stuck. I saved a copy of one of the captchas as a jpeg and I've been trying to dissect it with no luck. Using the imagecopy I tried to take different sections of the captcha image every x pixels on the x-axis, however it seems the characters on the image aren't spaced exact and I can't get each character in the exact location so I can compare images.

 

This captcha is 6 characters long -- So I wanted to break up all six characters and compare them to the images already stored on my server. However as I stated above, I'm having trouble finding the best way to handle this.

 

Any suggestions?

 

Also - after reading this post again it is quite confusing. If you aren't sure of anything let me know and I'll try my best to make things a bit more clear.

Link to comment
https://forums.phpfreaks.com/topic/162095-solved-curl-login/#findComment-855398
Share on other sites

I made an image reader, but as always it's extremely specific. The way that I did it is I found out that the numbers (in my case) were 4X8 pixels and were separated by 1 pixel. (And started at some x and y). So what I did is I created a loop that would loop through the pixels of each character and generate a string. The string consisted of 1's and 0's. 1 = text color (part of the character) = 0 not part of it, just the background. Then I created another function that would compare the string against an array of strings that had the actual maps (in 0's and 1's) of numbers/letters. Then if it matched you know it is that letter. In my case it was only necessary to loop through the first column of pixels in the image because the strings would've been unique at that point.

 

Here's mine just in case it helps you figure out how to create yours:

 

function check_number($number, $img)
{
$x_loc = (5 * ($number-1)) + (1 * ($number-1));
for($j = 0;$j < 8;$j++)
{
	$color_index = imagecolorat($img, $x_loc + 90, $j + 48);
	$spec = imagecolorsforindex($img, $color_index);
	$colorMap .= ($spec['red'] == 220 && $spec['green'] == 220 && $spec['blue'] == 220) ? 1 : 0;
}
return find_number($colorMap);
}

function find_number($numberArr)
{
global $check;
$numberMaps = array(
'00111100',
'00100001',
'01000011',
'01000010',
'00011100',
'11110010',
'00111110',
'10000000',
'01101110',
'01110001'
);

for($i = 0;$i < count($numberMaps);$i++)
{
	if($numberArr == $numberMaps[$i])
	{
		return $i;
	}
}
$check = false;
return false;
}

 

As I said it only loops through the first column. The first function takes the character you want to get (its position, eg, first(1), second(2), etc..) and the image. But mine is specific, as I said before. Just hope it helps.

Link to comment
https://forums.phpfreaks.com/topic/162095-solved-curl-login/#findComment-855407
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.