Created
November 12, 2012 05:59
-
-
Save XORwell/4057745 to your computer and use it in GitHub Desktop.
ProxySucker&Checker Shellscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| clear | |
| #Wenn parameter vorhanden sind, in den Checker gehen. | |
| #TheChecker: | |
| if [ $# -gt 0 ] | |
| then | |
| outFile=$1 | |
| IpPort=$2 | |
| pos=`expr index $IpPort :` | |
| IP=`echo $IpPort | cut -d":" -f1` | |
| PORT=`echo $IpPort | cut -d":" -f2` | |
| timeout=10 | |
| url="http://ip.appspot.com" | |
| #get hostname | |
| hostname=$(nslookup $IP | sed -n 's/.*arpa.*name = \(.*\)\./\1/p') | |
| len=`expr length "$hostname"` | |
| if [ "$len" -gt 0 ] | |
| then | |
| timeStart=`date +%s.%N` | |
| resp=`curl -x $IpPort -m $timeout -s $url` | |
| timeEnd=`date +%s.%N` | |
| timeDiff=$(echo "$timeEnd - $timeStart" | bc) | |
| respIp=`echo $resp | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'` | |
| if [ ${#respIp} -gt 0 ] && [ ${#respIp} -le 15 ] | |
| then | |
| #all good; format and log | |
| #1. add leading zero | |
| #2. shorten | |
| echo "$IpPort [hostname:$hostname] [time: $timeDiff]" >> $outFile | |
| fi | |
| fi | |
| exit | |
| fi | |
| # random futurama quote | |
| quote=`curl -Is slashdot.org | egrep '^X-(F|B|L)' | cut -d \- -f 2` | |
| echo $quote | |
| #TheSucker: | |
| ###################################################### | |
| ########## VARS & Co. | |
| ####################################################### | |
| PATTERN_IP='[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | |
| PATTERN_IP_PORT='[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}' | |
| allProxies=( ) | |
| workingPing=( ) | |
| workingProxies=( ) | |
| connectionCheckTimeout=5 | |
| timestamp=`date +%s` | |
| exportFilename="export_"$timestamp | |
| ###################################################### | |
| ########## Messages | |
| ####################################################### | |
| function msgSucking { | |
| echo -n "> sucking "$1 | |
| } | |
| function msgFetchedFromProvider { | |
| echo -e "\r\n\t=> Fetched $1 server from this site.\r\n" | |
| } | |
| ###################################################### | |
| ########## Fetchy matchy | |
| ####################################################### | |
| function fetch1 { | |
| msgSucking "proxy.speedtest.at" | |
| incr=25 | |
| proxyCount=`curl http://proxy.speedtest.at/proxyOnlyAnonymous.php?offset=0 -s | egrep -o '[0-9]* aktive freie Proxy Server gefunden' | egrep -o [0-9]*` | |
| if [ -z $proxyCount ] | |
| then | |
| echo "Something went wrong." | |
| fi | |
| sites=$(( $proxyCount / $incr )) | |
| i=0 | |
| offset=0 | |
| k=0 #count of proxies from this site | |
| while [ $i -lt $(($sites)) ]; do | |
| echo -n -e "." | |
| url=http://proxy.speedtest.at/proxyOnlyAnonymous.php?offset=$offset | |
| string=`curl $url -s | egrep -o ''$PATTERN_IP_PORT''` | |
| ray=($string) | |
| for ((j=0; j<${#ray[*]}; j++)) do | |
| ((k++)) | |
| allProxies[${#allProxies[*]}]=${ray[$j]} | |
| done | |
| ((i++)) | |
| let offset=offset+$incr | |
| done | |
| msgFetchedFromProvider $k | |
| } | |
| function fetch2 { | |
| msgSucking "proxies.my-proxy.com" | |
| url=http://proxies.my-proxy.com/proxy-list-s3.html | |
| string=`curl $url -s | egrep -o ''$PATTERN_IP_PORT''` | |
| ray=($string) | |
| k=0 | |
| for i in "${ray[@]}" | |
| do | |
| allProxies=( "${allProxies[@]}" "$i" ) | |
| ((k++)) | |
| done | |
| msgFetchedFromProvider $k | |
| } | |
| ###################################################### | |
| ########## Und los gehts.. | |
| ####################################################### | |
| # | |
| # Auswahl der Proxyliste und Fetchen der Proxies | |
| # | |
| function chooseJuiceAndSuck { | |
| listProv=( [0]="proxy.speedtest.at" [1]="proxies.my-proxy.com" ) | |
| #Auswahl des/der Listen-Provider | |
| echo -e "\nWelche Liste(n) soll(en) genutzt werden?" | |
| echo -e "\t[0] overkill = alle" | |
| for ((i=0; $i < ${#listProv[*]}; i++)) do | |
| echo -e "\t[$(($i+1))] ${listProv[$i]}" | |
| done | |
| echo -n -e "\nAuswahl (zb: 2 3 5): " | |
| read auswahl | |
| if [ ${#auswahl} -eq 0 ] | |
| then | |
| echo "Keine Auswahl!? Geh Heim!" | |
| exit | |
| else | |
| p2c=($auswahl) #array: provider to check | |
| if [ ${#p2c[*]} -eq 1 ] && [ ${p2c[0]} -eq 0 ] | |
| then | |
| #alle functionsnamen mit "fetch"-prefix ermitteln und ausführen | |
| funcNamen=`cat $0 | sed -n '/^function fetch.*{$/{p}' | cut -d" " -f2` | |
| for name in ${funcNamen[@]} | |
| do | |
| ${1:-$name} | |
| done | |
| else | |
| #für jede auswahl die entsprechende funktion mit "fetch"-prefix aufrufen | |
| for i in "${p2c[@]}" | |
| do | |
| fetch${1:-$i} | |
| done | |
| fi | |
| fi | |
| } | |
| chooseJuiceAndSuck | |
| echo "${#allProxies[@]} Proxies werden getestet... Bitte warten..." | |
| pids=( ) | |
| for i in "${allProxies[@]}" | |
| do | |
| sh sucker.sh $exportFilename $i & | |
| pids[${#pids[@]}]=$! | |
| done | |
| #auf alle child-procs warten | |
| while :; do | |
| p=(`pgrep -P $$`) | |
| if [ ${#p[@]} -eq 0 ] | |
| then | |
| echo; break | |
| else | |
| echo -n "." | |
| fi | |
| done | |
| count=`wc -l $exportFilename | cut -d" " -f1` | |
| echo "Liste wurde erstellt: $exportFilename ($count Proxies)" | |
| #http://www.shroomery.org/ythan/proxylist.txt | |
| #http://hack72.2ch.net/otakara.cgi | |
| #http://nntime.com/ | |
| #http://www.cybersyndrome.net/pla5.html | |
| #http://www.cybersyndrome.net/pld5.html | |
| #http://www.cybersyndrome.net/plr5.html | |
| #http://www.cybersyndrome.net/pls5.html | |
| #http://www.topbits.com/anonymous-proxies.html | |
| #http://www.digitalcybersoft.com/ProxyList/fresh-proxy-list.shtml? | |
| #http://cool-proxy.ru | |
| #http://www.hacker0000.altervista.org/proxy.txt | |
| #http://eagleyas1.ifrance.com/proxy.txt | |
| #http://www.winxpprof.narod.ru/trach/hack/proxy.txt | |
| #http://mahvareh24.persiangig.com/document/proxyinfo.blogspot.com.txt | |
| #http://www.planetnana.co.il/adirbuskila//vips.txt | |
| function listAll { | |
| for ((i=0; i<${#allProxies[*]}; i++)) do | |
| echo "${allProxies[$i]}" | |
| done | |
| } | |
| #echo -e "\r\n\r\nFetched ${#allProxies[@]} proxies.\r\n" | |
| #echo "nslookup:" | |
| #for ((i=0; i<${#allProxies[@]}; i++)) do | |
| # ip=`echo ${allProxies[$i]} | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'` | |
| # nslookup $ip | |
| #done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment