    
- 帖子
- 3852
- 积分
- 13044
- 威望
- 16780
- 金钱
- 36761
- 在线时间
- 1139 小时
         
|
破解校内网验证码的PHP程序
校内网的验证码很简单,没有任何的干扰素,所以读起来也很方便,一下是程序
<?
set_time_limit(0);
$content=file_get_contents(http://xiaonei.com/RandImageServlet?post=doodle_224467352′);
$f=fopen(’a.gif’,'w’);
fwrite($f,$content);
fclose($f);
$gif=’a.gif’;
$yzm=”;
for($x=5;$x<=29;$x+=8){
$n=”;
for($y=0;$y<=15;$y++){
color(read($x,$y))==true?$n.=$y:”;
}
switch($n){
case ‘56789′:
$num=chk($x+4);
break;
case ”:
$num=1;
break;
case ‘31011′:
$num=2;
break;
case ‘312′:
$num=3;
break;
case ‘78′:
$num=4;
break;
case ‘345611′:
$num=5;
break;
case ‘3′:
$num=7;
break;
case ‘458910′:
$num=8;
break;
case ‘5611′:
$num=9;
break;
}
$yzm.=$num;
}
echo $yzm;
function read($x,$y){
global $gif;
$im=ImageCreateFromgif($gif);
$rgb=ImageColorAt($im,$x,$y);
$color=imagecolorsforindex($im,$rgb);
return $color;
}
function color($c){
if($c[’red’]>200&&$c[’green’]>200&&$c[’blue’]>200){
return true;
}else{
return false;
}
}
function chk($x){
if(color(read($x,4))){
return 0;
}else{
return 6;
}
}
?>
其中程序先远程读入验证码图片,并保存到本地,然后进行破解,破解的部分也很简单.本来ImageCreateFromgif()函数也可以远程读取图片内容的,但是我发现特别慢,所以就采用了保存到本地的方法 |
|