저는 프로그래머에게 captcha가 너무 약하다는 것을 보여주고 싶습니다. 이 같은 지금은있어 뭔가 :하나의 이미지를 생성하는 데 약간의 결과가 있습니다.
기능 :
<?php
function cbreak($image)
{
$info = getimagesize($image);
$width = $info[0];
$height = $info[1];
$img = imagecreatefromgif($image);
$map = array();
for($y=0; $y<$height; $y++)
{
for($x=0; $x<$width; $x++)
{
$color = imagecolorsforindex($img, imagecolorat($img, $x, $y));
$map[$x][$y] = ($color['red'] + $color['blue'] + $color['green'] > 750) ? TRUE : FALSE;
}
}
echo '<pre>';
for($y=0; $y<$height; $y++)
{
for($x=0; $x<$width; $x++)
{
echo ($map[$x][$y] == TRUE) ? 'X' : '-';
}
echo '<br>';
}
echo '</pre>';
$sum = '';
for($x=0; $x<$width; $x++)
{
$count = 0;
for($y=0; $y<$height; $y++)
{
if($map[$x][$y] == TRUE) $count++;
}
$sum .= ($count == 0) ? 'X' : $count;
}
$sum = preg_replace('#X+#', 'X', $sum);
$sum = trim($sum, 'X');
$letters = explode('X', $sum);
$patterns = array(
/* Still not here */
);
$token = '';
for($i=0; $i<count($letters); $i++)
{
$token .= $patterns[$letters[$i]];
}
echo $token;
}
?>
작업 :
<?php
$cl = curl_init("http://www.takeagift.pl/rejestracja");
curl_setopt($cl, CURLOPT_RETURNTRANSFER, 1);
$r = curl_exec($cl);
$pattern = "/src=[\"'].*[\"']?/i";
preg_match_all($pattern, $r, $images);
$c = array();
for($i=0; $i<sizeof($images[0]); $i++)
{
if(strstr($images[0][$i], 'captcha') !== false)
{
$c = $images[0][$i];
}
}
$s1 = substr($c, 0, -8);
echo $s1."<br />";
$s = substr($s1, 5, -1);
echo $s."<br />";
curl_close($cl);
?>
<img src="http://www.takeagift.pl/includes/modules/captcha.php?1270900968" /><br />
<img src="http://www.takeagift.pl/includes/modules/captcha.php?1270900968" /><br />
<img src="http://www.takeagift.pl/includes/modules/captcha.php?1270900968" /><br />
<img src="http://www.takeagift.pl/includes/modules/captcha.php?1270900968" /><br />
<img src="http://www.takeagift.pl/includes/modules/captcha.php?1270900968" /><br />
<?php include('cb.php');
cbreak("http://www.takeagift.pl/includes/modules/captcha.php?1270900968");
?>
난 아직도 정규 표현식을 배운하지 않은 preg_match를 보지 마십시오.
그래서 링크가 동일하다는 것을 알 수 있습니다 : (captcha.php? 1270900968),하지만 그 결과는 아닙니다.
도움말 나, (나는이 포털 스팸에 그 일을하고 있지 않다)하시기 바랍니다
편집 :
Q - 어떻게 하나 개의 링크에서 하나 개의 이미지를 얻는 방법? 왜 imagecreatefromgif ($ 이미지); 정상 링크와 같은 이미지를 반환하지 않습니까? 같은 이미지를 얻는 방법?
그래서, 문제는 다시 무엇인가? – deceze
ㅎ. 하나의 링크에서 하나의 이미지를 얻는 방법? 왜 imagecreatefromgif ($ 이미지); 정상 링크와 동일한 이미지를 반환하지 않습니까? 같은 이미지를 얻는 방법? – Misiur
misiur- 질문을 수정하지 않으시겠습니까? – Moshe