hecky

Captcha cracker php sample

May 6th, 2013
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2. echo "Leyendo imagen...\n";
  3. $im = imagecreatefromjpeg("Captcha.jpg");
  4. $out = imagecreatetruecolor(imagesx($im),imagesy($im));
  5. echo "Limpiando...\n";
  6. for($x=0;$x<imagesx($im);$x++){
  7.     for($y=0;$y<imagesy($im);$y++){
  8.         $pixel = imagecolorsforindex($im,(imagecolorat($im,$x,$y)));
  9.         if($pixel['red']>=100 || $pixel['green']>=100 || $pixel['blue']>=100){
  10.             $color=imagecolorexact($out,0,0,0);
  11.             imagesetpixel($out,$x,$y,$color);
  12.         }else{
  13.             $color=imagecolorexact($out,255,255,255);
  14.             imagesetpixel($out,$x,$y,$color);
  15.         }
  16.     }
  17. }
  18. echo "Finished!! Catpcha_cracked.png\n";
  19. imagepng($out,"Captcha_cracked.png");
  20. shell_exec("convert Captcha_cracked.png Captcha.pnm");
  21. echo "Captcha_cracked: ";
  22. echo shell_exec('gocr Captcha.pnm');
  23. ?>
Add Comment
Please, Sign In to add comment