#!/bin/bash
if [[ $# -lt 2 ]]; then
echo Usage: "<poll_id> <answer>"
exit 1
fi
poll_id=$1
answer=$2
SITE=strawpoll.pl
POST="a${answer}=on&action=vote_poll&poll_id=${poll_id}"
function ctrl_c() {
echo ctrl-c
killall -9 curl
exit 255
}
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT SIGINT
function get_proxy() {
echo "... getting anonymous proxy list ..."
> .proxy-b64
for page in $(seq 1 10); do
curl -s https://proxy-list.org/english/index.php?p=${page} | grep 'class="proxy"' | cut -d "'" -f 2 | tail -n 14 >> .proxy-b64
done
echo "... decoding proxy list ..."
> .proxy
for proxy in $(cat .proxy-b64); do
decoded=$(echo $proxy | base64 -d)
echo $decoded | tee -a .proxy
( curl -s \
-connect-timeout 3 \
-H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-H "Referer: http://$SITE" \
-H 'X-Requested-With: XMLHttpRequest' \
-x http://${decoded} \
-X POST --data "${POST}" http://${SITE}/ajax.php | python -m json.tool 2> /dev/null ) &
done
}
get_proxy
# use .proxy file
Comments