Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# -ne 1 ];then
- echo -e "$0 \e[1;4;33mimagen\e[m\n\n\t\t\e[1;4;36mhecky@neobits.org\e[m"
- exit
- fi
- image=$(ls -1 $1 2> /dev/null)
- if [ $? -ne 0 ];then
- echo -e "\n\t\e[1;4;33;41m ERROR!! Archivo no existente... \e[m"
- exit
- fi
- pixelaje=$(convert -identify $image /dev/null | awk '{print $3}')
- let px_x="$(echo $pixelaje | cut -d"x" -f1 | tr -d "\n")"
- let px_y="$(echo $pixelaje | cut -d"x" -f2 | tr -d "\n")"
- black="( 0, 0, 0) #000000 black"
- white="(255,255,255) #FFFFFF white"
- txt_out="captcha_clean.txt"
- echo -e "\t\t\e[1;4mCaptcha Cracker by \e[m\e[1;4;36m@hecky\e[m"
- echo -en "\e[32mR mayor que:\e[m " && read R_p && let R_p
- echo -en "\e[32mG mayor que:\e[m " && read G_p && let G_p
- echo -en "\e[32mB mayor que:\e[m " && read B_p && let B_p
- echo -e "\n\e[1;33m[+]\e[m\e[1;35mAnalizando:\e[m "$image
- echo -e "\e[1;33m[+]\e[m\e[1;34mTamaño:\e[m $pixelaje px"
- if [[ -e $txt_out ]];then
- echo -e "\n\e[36m> $txt_out ya existe!!\n> Eliminandolo...\e[m"
- rm -rf $txt_out
- fi
- echo -e "\n\e[1;31m[*]\e[m\e[1;32mLimpiando Imagen!!\e[m"
- echo "# ImageMagick pixel enumeration: $px_x,$px_y,255,srgb" > $txt_out
- for ((y=0;y<$px_y;y++));do
- for ((x=0;x<$px_x;x++));do
- rgb=$(convert "$image"[1x1+$x+$y] txt: | grep "(.*)" -wo | cut -d ")" -f1 | tr -d "(" | tr -d "\n" | tr -d " "| tr "," " ")
- let r=$(echo $rgb | awk '{print $1}')
- let g=$(echo $rgb | awk '{print $2}')
- let b=$(echo $rgb | awk '{print $3}')
- if [[ $r -gt $R_p || $g -gt $G_p || $b -gt $B_p ]];then
- echo "$x,$y: $black" >> $txt_out
- else
- echo "$x,$y: $white" >> $txt_out
- fi
- done
- done
- convert $txt_out captcha_clean.pnm && echo -e "\e[1;31m[*]\e[m\e[1;33mImagen procesada, exitosamente!! =)\e[m" ; rm -rf $txt_out
- cracked=$(echo $(gocr captcha_clean.pnm))
- echo -e "\n<<< Captcha: \e[1;33;41m$cracked\e[m >>>"
- echo -e "\n\e[33;41mNeobits.org\e[m"
Add Comment
Please, Sign In to add comment