Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ======== Copy both scripts to ~/bin ========
- # ======== autobump.sh ========
- # === Usage: ./autobump.sh bumps ===
- # === Effect: bumps the thread $bumps times ===
- #!/bin/bash
- antigate_key=5654233d49951a7cd2c5be2b7f0b12c0
- cd ~/bin
- if [ ! -d ./2ch-data ]; then
- mkdir 2ch-data
- fi
- cd 2ch-data
- i=1
- while ((i <= $1)); do
- curl -q --silent -X POST "https://2ch.hk/makaba/captcha.fcgi?type=2chaptcha" \
- | tail -n 1 > captcha-id # Got captcha ID
- curl -q --silent -X POST "https://2ch.hk/makaba/captcha.fcgi?type=2chaptcha&action=image&id=$(cat captcha-id)" \
- > captcha.png # Got captcha pic
- antigatecaptcha $antigate_key captcha.png 10 # Solved captcha
- captcha_solved=$(cat captcha-answer)
- # Posting:
- if [[ ! $(curl -q --silent -X POST -F "json=1" -F "task=post" -F "board=s" -F "thread=1739561" -F "email=sage" -F "name=bash-autobump" -F "comment=test" -F "captcha_type=2chaptcha" -F "2chaptcha_id=`cat captcha-id`" -F "2chaptcha_value=$captcha_solved" "https://2ch.hk/makaba/posting.fcgi" | grep "Капча невалидна.") ]]
- then
- echo '2ch-autobump:' "$i / $1 posts."
- let 'i = i + 1'
- else
- echo '2ch-autobump:' "Posting error: invalid captcha."
- fi
- rm captcha-id captcha-answer
- done
- # ======== End of autobump.sh ========
- # ======== antigatecaptcha.sh ========
- # === Source: https://github.com/persona5/bgg/antigatecaptcha.sh ===
- # === Modifications: ===
- # - Changed answer-getting cycle from 'while' to 'for'
- # - Added answer-getting attempts parameter
- # - Changed answer output method: printing to stdout -> printing to file
- # === Usage: ./antigatecaptcha.sh antigate-key captcha-file get-answer-attempts
- # === Effect: requests captcha answer at antigate.com and prints it to 'captcha-answer' file ===
- #!/bin/bash
- antigatekey=$1
- filename=$2
- iterations=$3
- answer_file="captcha-answer"
- antigate=$(curl -q --silent --user-agent "$useragent" -i -X POST -H "Content-Type: multipart/form-data" -F "method=post" -F "key=$antigatekey" -F "numeric=1" -F "file=@$filename;" "http://anti-captcha.com/in.php")
- if [[ $(echo "$antigate" | grep "ERROR") ]];then
- exit 1
- else
- antigatecaptchaid=$(echo "$antigate" | awk {'print$1'} | tail -c 10)
- fi
- for i in $(seq $iterations); do
- sleep 10
- captchastatus=$(curl --silent -q --user-agent "$useragent" "http://anti-captcha.com/res.php?key=$antigatekey&action=get&id=$antigatecaptchaid")
- if [[ $(echo "$captchastatus" | grep 'OK|') ]]; then
- break
- fi
- done
- captchaanswer=$(echo "$captchastatus" | sed -e 's/OK|//g')
- rm captcha.png
- echo $captchaanswer>$answer_file
- exit 0
- ======== End of antigatecaptcha.sh ========
Advertisement
Add Comment
Please, Sign In to add comment