Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Automatically run recon against a domain/list of domains.
- #Built for Backtrack
- #
- # Current Features:
- # * DNS Recon
- # * Email Harvesting
- # * Meta Data Enumeration
- # * WhoIs
- #
- # Additional Features
- # * Pull domains from SSL Certificate
- #
- # Usage: ./automator.sh listofdomains.txt
- # Usage: ./automator.sh domain.com
- #
- # By: Leon Teale (~leonteale)
- #
- ## Setting Coloured variables
- red=`echo -e "\033[31m"`
- lcyan=`echo -e "\033[36m"`
- yellow=`echo -e "\033[33m"`
- green=`echo -e "\033[32m"`
- blue=`echo -e "\033[34m"`
- purple=`echo -e "\033[35m"`
- normal=`echo -e "\033[m"`
- ## Check for correct usage
- if [ -z "$1" ];
- then
- echo ""
- echo "Usage: ./automator.sh listofdomains.txt"
- echo "Usage: ./automator.sh domain.com"
- echo ""
- ## Run script on correct usage
- else
- ##Set Variables
- domain="$1"
- output_dir="~/Desktop"
- #Run scripts without arguments
- clear
- echo "$yellow _ _ "
- echo "$yellow /\ | | | | "
- echo "$yellow / \ _ _| |_ ___ _ __ ___ __ _| |_ ___ _ __ "
- echo "$yellow / /\ \| | | | __/ _ \| '_ \` _ \ / _\` | __/ _ \| '__|"
- echo "$yellow / ____ \ |_| | || (_) | | | | | | (_| | || (_) | | "
- echo "$yellow /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__\___/|_|$normal"
- echo "$lcyan -- by Leon Teale (@leonteale)"
- echo ""
- echo "$blue +-------------------------------------------+"
- echo "$blue | $red Current Features$normal $blue |$normal"
- echo "$blue | $yellow * DNS Recon$normal $blue |$normal"
- echo "$blue | $yellow * Email Harvesting$normal $blue |$normal"
- echo "$blue | $yellow * Meta DataEnumeration$normal $blue |$normal"
- echo "$blue | $yellow * WhoIs$normal $blue|$normal"
- echo "$blue | |"
- echo "$blue | $red Additional Features $normal $blue |$normal"
- echo "$blue | $yellow * Pull domains From SSL Cert$normal$blue |$normal"
- echo "$blue +-------------------------------------------+$normal"
- echo "$lcyan Target = '$green$domain$lcyan'"
- echo ""
- mkdir -p ~/Desktop/$domain
- mkdir -p ~/Desktop/$domain/metagoofil
- sleep 1
- ## Set Variables ##
- echo "Run intense scan? [y/N]"
- read intense
- ## Main Features: ##
- ## Run the DNS Stage
- if
- [[ "$intense" == "y" ]]
- then
- echo "$yellow Running DNS Recon Stage..$normal (..Very Slow)"
- echo ""
- if
- dig @`dig ns $domain | grep -v '^;' | grep A | cut -f1 | head -1` $domain axfr | grep "XFR size"
- then
- echo "$lcyan Zone Transfer Vulnerability: ($red Yes $lcyan)$normal"
- else
- echo "$lcyan Zone Transfer Vulnerability: ($green No $lcyan)$normal"
- fi
- echo ""
- dnsrecon -t brt,std,axfr -D /root/Desktop/wordlists/dnsbruteforce.txt -d $domain > /tmp/$domain.dnsrecon.txt.tmp
- cat /tmp/$domain.dnsrecon.txt.tmp | grep '[^\.][0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}[^\.]' | grep -vE 'Trying|TCP|MX|NS|SOA|Has' | awk {'print $3 "\t" $4'} | sort -u | sed '/^$/d' > ~/Desktop/$domain/dnsrecon.txt
- echo "$lcyan Subdomains found: ($yellow `cat ~/Desktop/$domain/dnsrecon.txt | wc -l` $lcyan)$normal"
- echo ""
- else
- echo "$yellow Running DNS Recon Stage..$normal"
- echo ""
- if
- dig @`dig ns $domain | grep -v '^;' | grep A | cut -f1 | head -1` $domain axfr | grep "XFR size"
- then
- echo "$lcyan Zone Transfer Vulnerability: ($red Yes $lcyan)$normal"
- else
- echo "$lcyan Zone Transfer Vulnerability: ($green No $lcyan)$normal"
- fi
- echo ""
- dnsrecon -t brt,std,axfr -D /usr/share/dnsrecon/namelist.txt -d $domain > /tmp/$domain.dnsrecon.txt.tmp
- cat /tmp/$domain.dnsrecon.txt.tmp | grep '[^\.][0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}[^\.]' | grep -vE 'Trying|TCP|spf1|SOA|Has' | awk {'print $3 "\t" $4'} | sort -u | grep $domain | sed '/^$/d' > ~/Desktop/$domain/dnsrecon.txt
- echo "$lcyan Subdomains found: ($yellow `cat ~/Desktop/$domain/dnsrecon.txt | wc -l` $lcyan)$normal"
- echo ""
- fi
- rm -rf /tmp/$domain.dnsrecon.txt.tmp
- echo "" >> ~/Desktop/$domain/dnsrecon.txt
- echo "Name Servers" >> ~/Desktop/$domain/dnsrecon.txt
- dig ns $domain | grep -v '^;' | grep A | awk {'print $1 "\t" $5'} | sed '/^$/d' >> ~/Desktop/$domain/dnsrecon.txt
- echo "" >> ~/Desktop/$domain/dnsrecon.txt
- echo "MX Records" >> ~/Desktop/$domain/dnsrecon.txt
- dig mx $domain | grep -v '^;' | grep $domain | awk {'print $6'} | sed '/^$/d' >> ~/Desktop/$domain/dnsrecon.txt
- cat ~/Desktop/$domain/dnsrecon.txt
- echo ""
- echo "$green DNS Recon Stage Complete!$normal"
- ## Run the Mail Harvesting Stage
- echo "+------------------------------------------------+"
- echo ""
- echo "$yellow Running Email Harvesting Stage..$normal"
- theharvester -l 500 -b all -d $domain > /tmp/$domain.emails.txt.tmp
- cat /tmp/$domain.emails.txt.tmp | grep @ | grep -vE 'cmartore' > ~/Desktop/$domain/emails.txt
- rm -rf /tmp/$domain.emails.txt.tmp
- echo "$lcyan Email Addresses Found: ($yellow `cat ~/Desktop/$domain/emails.txt | wc -l` $lcyan)$normal"
- echo ""
- cat ~/Desktop/$domain/emails.txt | column -c 100
- echo ""
- echo "$green Email Harvesting Stage Complete!$normal"
- ## Run the MetaGooFil Stage
- echo "+------------------------------------------------+"
- echo ""
- echo "$yellow Running Meta Data Gathering Stage..$normal"
- echo ""
- metagoofil -d $domain -t pdf,doc,xls,ppt,odp,ods,docx,xlsx,pptx -l 20 -n 20 -o ~/Desktop/$domain/metagoofil/ -f ~/Desktop/$domain/users_temp.txt > /dev/null
- cat ~/Desktop/$domain/users_temp.txt | sed 's/useritem/\n/g' | grep '">' | grep -vE 'head' | awk -F "<" {'print $1'} | cut -d">" -f2 | sed -e "s/^ \{1,\}//" > ~/Desktop/$domain/users.txt
- echo "$lcyan Users found: ($yellow `cat ~/Desktop/$domain/users.txt | wc -l` $lcyan)$normal"
- echo ""
- cat ~/Desktop/$domain/users.txt
- echo ""
- echo "$green Meta Data Stage Complete!$normal"
- ## Run the WhoIs
- echo "+------------------------------------------------+"
- echo ""
- whois $domain > ~/Desktop/$domain/whois.txt
- echo "$yellow Running WhoIs..$normal"
- echo ""
- echo "$green WhoIs output saved to: $lcyan ~/Desktop/$domain/whois.txt$normal"
- ## Additional Features: ##
- ## Pull domains from SSL Certificate
- echo "+------------------------------------------------+"
- echo ""
- echo "$yellow Pulling Domains from SSL Certificates $normal"
- echo ""
- sslscan --ssl2 $domain | grep DNS | sed 's/,/"\n"/g' | sed 's/"//g' | cut -d':' -f2 > ~/Desktop/$domain/sslcertdomains_temp.txt
- nmap -vv $domain -script=ssl-cert -p443 | grep commonName | grep -v 'Issuer' | cut -d '/' -f1 | cut -d '=' -f2 >> ~/Desktop/$domain/sslcertdomains_temp.txt
- cat ~/Desktop/$domain/sslcertdomains_temp.txt | sort -u > ~/Desktop/$domain/sslcertdomains.txt
- cat ~/Desktop/$domain/sslcertdomains.txt
- rm ~/Desktop/$domain/sslcertdomains_temp.txt
- echo ""
- echo "$green Finished Pulling Domains!$normal"
- echo ""
- fi
Advertisement
Add Comment
Please, Sign In to add comment