Last active
August 29, 2015 14:02
-
-
Save iGh0st/7323bb1d976c9d70df12 to your computer and use it in GitHub Desktop.
wpsnitch Wordpress scraper
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 | |
| # Usage = ./wpsnitch -t 192.168.1.1-255 -s mysession | |
| # Thanks TAPE for letting me use your colors, Thanks n1tr0 for testing the script in Kali! | |
| STD=$(echo -e "\e[0;0;0m") #Revert fonts to standard colour/format | |
| RED=$(echo -e "\e[1;31m") #Alter fonts to red bold | |
| REDN=$(echo -e "\e[0;31m") #Alter fonts to red normal | |
| GRN=$(echo -e "\e[1;32m") #Alter fonts to green bold | |
| GRNN=$(echo -e "\e[0;32m") #Alter fonts to green normal | |
| BLU=$(echo -e "\e[1;36m") #Alter fonts to blue bold | |
| BLUN=$(echo -e "\e[0;36m") #Alter fonts to blue normal | |
| OUTDIR=/root/ | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| f_wpress(){ | |
| echo "" | |
| echo "[*] Any results will be saved into the $SESSION folder" | |
| sleep 2 | |
| echo "" | |
| mkdir -p $SESSION | |
| cd $SESSION | |
| echo "Scanning $TARGET For Web Servers, Please wait.." | |
| nmap -p 80 $TARGET --script-args http.useragent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36" --dns-servers 8.8.4.4 -n | grep for | awk '{print $5}' > $TARGET | |
| hostlines=$(cat $TARGET) | |
| for ip in $hostlines ; do | |
| RESULTS=$(curl -s -I $ip | grep HTTP | awk '{print $2}') | |
| if [ $RESULTS="200" ]; then | |
| sleep 1 | |
| wget --max-redirect 10 $ip/readme -O $ip.wp-readme.txt | |
| clear | |
| IPRES=$(cat $ip.wp-readme.txt | grep Version | awk '{print $3, $4}') | |
| echo "$ip " "Reported WordPress Release ----> " "$IPRES" >> Results.txt | |
| cat Results.txt | grep Version | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' | |
| CHECK=$(cat $ip.wp-readme.txt) | |
| if [ ! -s $ip.wp-readme.txt ]; then | |
| rm -rf $ip.wp-readme.txt | |
| else | |
| echo "Info Saved.." | |
| fi | |
| sleep 1 | |
| elif [ $RESULTS="301" ]; then | |
| sleep 1 | |
| wget --max-redirect 10 $ip/readme -O $ip.wp-readme.txt | |
| clear | |
| IPRES=$(cat $ip.wp-readme.txt | grep Version | awk '{print $3, $4}') | |
| echo "$ip " "Reported WordPress Release ----> " "$IPRES" >> Results.txt | |
| cat Results.txt | grep Version | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' | |
| sleep 1 | |
| elif [ $RESULTS="302" ]; then | |
| sleep 1 | |
| wget --max-redirect 10 $ip/readme -O $ip.wp-readme.txt | |
| clear | |
| IPRES=$(cat $ip.wp-readme.txt | grep Version | awk '{print $3, $4}') | |
| echo "$ip " "Reported WordPress Release ----> " "$IPRES" >> Results.txt | |
| cat Results.txt | grep Version | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' | |
| sleep 1 | |
| else | |
| echo "OH NOES!" | |
| sleep 4 | |
| fi | |
| done | |
| } | |
| f_nosess(){ | |
| echo "Scanning $TARGET For Web Servers, Please wait.." | |
| nmap -p 80 $TARGET --script-args http.useragent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36" --dns-servers 8.8.4.4 -n | grep for | awk '{print $5}' > $TARGET | |
| hostlines=$(cat $TARGET) | |
| for ip in $hostlines ; do | |
| RESULTS=$(curl -s -I $ip | grep HTTP | awk '{print $2}') | |
| if [ $RESULTS="200" ]; then | |
| sleep 1 | |
| wget --max-redirect 10 $ip/readme -O $ip.wp-readme.txt | |
| clear | |
| IPRES=$(cat $ip.wp-readme.txt | grep Version | awk '{print $3, $4}') | |
| echo "$ip " "Reported WordPress Release ----> " "$IPRES" >> Results.txt | |
| cat Results.txt | grep Version | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' | |
| CHECK=$(cat $ip.wp-readme.txt) | |
| if [ ! -s $ip.wp-readme.txt ]; then | |
| rm -rf $ip.wp-readme.txt | |
| else | |
| echo "Info Saved.." | |
| fi | |
| sleep 1 | |
| elif [ $RESULTS="301" ]; then | |
| sleep 1 | |
| wget --max-redirect 10 $ip/readme -O $ip.wp-readme.txt | |
| clear | |
| IPRES=$(cat $ip.wp-readme.txt | grep Version | awk '{print $3, $4}') | |
| echo "$ip " "Reported WordPress Release ----> " "$IPRES" >> Results.txt | |
| cat Results.txt | grep Version | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' | |
| sleep 1 | |
| elif [ $RESULTS="302" ]; then | |
| sleep 1 | |
| wget --max-redirect 10 $ip/readme -O $ip.wp-readme.txt | |
| clear | |
| IPRES=$(cat $ip.wp-readme.txt | grep Version | awk '{print $3, $4}') | |
| echo "$ip " "Reported WordPress Release ----> " "$IPRES" >> Results.txt | |
| cat Results.txt | grep Version | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' | |
| sleep 1 | |
| else | |
| echo "OH NOES!" | |
| sleep 4 | |
| fi | |
| done | |
| } | |
| usage() | |
| { | |
| cat << EOF | |
| $BLU | |
| ██╗ ██╗██████╗ ███████╗███╗ ██╗██╗████████╗ ██████╗██╗ ██╗ | |
| ██║ ██║██╔══██╗██╔════╝████╗ ██║██║╚══██╔══╝██╔════╝██║ ██║ | |
| ██║ █╗ ██║██████╔╝███████╗██╔██╗ ██║██║ ██║ ██║ ███████║ | |
| ██║███╗██║██╔═══╝ ╚════██║██║╚██╗██║██║ ██║ ██║ ██╔══██║ | |
| ╚███╔███╔╝██║ ███████║██║ ╚████║██║ ██║ ╚██████╗██║ ██║ | |
| ╚══╝╚══╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ | |
| wpsnitch v0.1 | By: R4v3N | www.top-hat-sec.com | |
| OPTIONS: | |
| -t Target or Target Range [1.2.3.4-255] | |
| -s Session | |
| $STD | |
| EOF | |
| } | |
| TARGET= | |
| SESSION= | |
| SESSARG= | |
| TARGARG= | |
| while getopts “t:s:” OPTION | |
| do | |
| case $OPTION in | |
| t) | |
| TARGET=$OPTARG | |
| TARGARG=$(echo "1") | |
| ;; | |
| s) | |
| SESSION=$OPTARG | |
| SESSARG=$(echo "1") | |
| ;; | |
| ?) | |
| usage | |
| exit | |
| ;; | |
| esac | |
| done | |
| if [[ -z $TARGET ]] | |
| then | |
| usage | |
| exit 1 | |
| elif [ "$TARGARG" = "1" ] && [ "$SESSARG" = "1" ] | |
| then | |
| f_wpress | |
| elif [ "$TARGARG" = "1" ] && [ "$SESSARG" = "" ] | |
| then | |
| f_nosess | |
| else | |
| echo " something is wrong" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment