Advertisement
Guest User

HR HideMyAss Proxy Scraper Bash Script

a guest
Aug 24th, 2012
5,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.49 KB | None | 0 0
  1. #!/bin/bash
  2. PAGES="$1"
  3.  
  4. #First a simple Bashtrap function to handle interupt (CTRL+C)
  5. trap bashtrap INT
  6.  
  7. bashtrap(){
  8.     echo
  9.     echo
  10.     echo 'CTRL+C has been detected!.....shutting down now' | grep --color '.....shutting down now'
  11.     rm -f o.txt 2> /dev/null
  12.     rm -f p.txt 2> /dev/null
  13.     #exit entire script if called
  14.     exit;
  15. }
  16. #End bashtrap()
  17.  
  18. echo "Starting Hood3dRob1n's HideMyAss.com proxy scraper, hang tight this might take a few...." | grep --color -E 'Starting Hood3dRob1n||s HideMyAss||com proxy scraper||hang tight this might take a few'
  19. seq 1 "$PAGES" | parallel -k -j 0 curl http://www.hidemyass.com/proxy-list/{} -b "PHPSESSID=f0997g34g7qee5speh0bian143" --retry 2 --retry-delay 3 --connect-timeout 3 --no-keepalive -s -e "http://www.hidemyass.com/proxy-list/" 2> /dev/null | grep -A2 '<div style=\"display:none\">' | sed -e 's/<\/style>//g' -e 's/\-\-//g' -e 's/         <td>//g' -e '/^$/d' | sed -e 's/_/-/g' -e 's/<span class="[a-zA-Z\-]\{1,4\}">/~/' -e 's/<div style=\"display:none\">/~/g' -e 's/<span class=\"[a-zA-Z0-9\-]\{1,4\}\">/~/g' -e 's/<span class=\"\" style=\"\">/~/g' -e 's/<span style=\"display: inline\">/~/g' -e 's/<span style=\"display:none\">/~/g' -e 's/<\/div>//g' -e 's/<\/span>//g' -e 's/<\/td>//g' -e 's/<span>//g' -e 's/^~//g' > o.txt
  20.             LINE_COUNT=0
  21.             IP1=""
  22.             IP2=""
  23.             IP3=""
  24.             IP4=""
  25.             PORT=""
  26.             cat o.txt | while read line
  27.             do
  28.                 LINE_COUNT=$((LINE_COUNT +1));
  29.                 if [ "$LINE_COUNT" == 1 ]; then
  30.                     IP1=$(echo $line | awk -F"~" ' { print $1 }')
  31.                     IP2=$(echo $line | awk -F"." ' { print $2 }' | sed -e 's/^~//g' | awk -F"~" ' { print $1 } ')
  32.                     IP3=$(echo $line | awk -F"." ' { print $3 }' | sed -e 's/^~//g' | awk -F"~" '{ print $1 }')
  33.                     IP4=$(echo $line | awk -F"." ' { print $4 }' | sed -e 's/^~//g')
  34.                 fi
  35.                 if [ "$LINE_COUNT" == 2 ]; then
  36.                     PCHK=$(echo $line | awk '{print length($1)}')
  37.                     if [ $PCHK -le 5 ]; then
  38.                         PORT=$(echo $line | awk '{print $1}')
  39.                     fi
  40.                     echo "$IP1.$IP2.$IP3.$IP4:$PORT" >> p.txt
  41.                     LINE_COUNT=0
  42.                 fi
  43.             done
  44.             cat p.txt | sort | uniq > HMA.lst
  45.             NUMPROX=$(wc -l HMA.lst | cut -d' ' -f1)
  46.             echo
  47.             echo "RESULTS FROM PROXY SCRAPING:" | grep --color 'RESULTS FROM PROXY SCRAPING'
  48.             echo "Proxies Found: $NUMPROX" | grep --color 'Proxies Found'
  49.             echo
  50.             cat HMA.lst
  51.             echo
  52.  
  53. rm -f o.txt 2> /dev/null
  54. rm -f p.txt 2> /dev/null
  55. echo "Hope you have enough to actually hide your ass now :p" | grep --color 'Hope you have enough to actually hide your ass now :p'
  56. exit 0;
  57.  
  58. # Greetz from H.R. :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement