0 Members and 1 Guest are viewing this topic.
#!/bin/bash## By Lee Baird# Feel free to contact me via chat or email with any feedback or suggestions that you may have:# leebaird@gmail.com## Special thanks to the following people:## Jason Arnold - planning original concept, author of ssl-check and co-author of crack-wifi.# Dave Klug - planning, testing and bug reports.# Matt Banick - original development.# Eric Milam - total re-write using functions.# Martin Bos - IDS evasion techniques.# Numerous people on freenode IRC - #bash and #sed (e36freak)# Ben Wood - regex master# Rob Dixon - report framework idea# Steve Copland - report framework design############################################################################################################### Variablesinterface=$(ifconfig | grep -B10 'Loopback'| grep 'Ethernet' | cut -d ' ' -f1)ip=$(ifconfig | grep -B10 'Loopback' | grep 'Bcast' | cut -d ':' -f2 | cut -d ' ' -f1)line="=================================================="user=$(whoami)# Catch ctrl+c from usertrap f_terminate 2##############################################################################################################f_banner(){echoecho "______ ___ ______ ______ _____ _ _ ______ _____"echo "| \ | |____ | | | \ / |_____ |____/"echo "|_____/ _|_ _____| |_____ |_____| \/ |_____ | \_"echoecho "By Lee Baird"echoecho}##############################################################################################################f_error(){echoecho -e "\e[1;31m$line\e[0m"echoecho -e "\e[1;31m *** Invalid choice or entry. ***\e[0m"echoecho -e "\e[1;31m$line\e[0m"sleep 2f_main}##############################################################################################################f_location(){echoecho -n "Enter the location of your list: "read location# Check for no answerif [ -z $location ]; thenf_errorfi# Check for wrong answerif [ ! -f $location ]; thenf_errorfi}##############################################################################################################f_runlocally(){if [ -z $DISPLAY ]; thenclear f_banner echoecho $line echoecho "This option must be run locally, in an X-Windows environment." echoread -p "Press <return> to continue." f_mainfi}##############################################################################################################f_terminate(){rm emails names squatting whois* subdomain* doc pdf ppt txt xls tmp* z* 2>/dev/nullif [ -f $name ]; thenrm -rf $namefiPID=$(ps -ef | grep 'discover.sh' | grep -v 'grep' | awk '{print $2}')kill -9 $PIDechoecho}##############################################################################################################f_recon(){clearf_bannerecho -e "\e[1;34mRECON\e[0m"echoecho "1. Company"echo "2. Person"echo "3. Previous menu"echoecho -n "Choice: "read choicecase $choice in 1) f_scrape;; 2) f_runlocally echoecho $line echoecho -n "First name: " read firstName # Check for no answer if [ -z $firstName ]; thenf_error fiechoecho -n "Last name: " read lastName # Check for no answer if [ -z $lastName ]; thenf_error fifirefox & sleep 2 firefox -new-tab http://www.123people.com/s/$firstName+$lastName & sleep 1 firefox -new-tab http://www.411.com/name/$firstName-$lastName/ & sleep 1 firefox -new-tab http://www.cvgadget.com/person/$firstName/$lastName & sleep 1 firefox -new-tab http://www.peekyou.com/$fireName_$lastName & sleep 1 firefox -new-tab http://phonenumbers.addresses.com/people/$firstName+$lastName & sleep 1 firefox -new-tab http://search.nndb.com/search/nndb.cgi?nndb=1&omenu=unspecified&query=$firstName+$lastName & sleep 1 firefox -new-tab http://www.spokeo.com/search?q=$firstName+$lastName&s3=t24 & sleep 1 firefox -new-tab http://www.zabasearch.com/query1_zaba.php?sname=$firstName%20$lastName&state=ALL&ref=$ref&se=$se&doby=&city=&name_style=1&tm=&tmr= ;; 3) f_main;; *) f_error;;esac}##############################################################################################################f_scrape(){clearf_bannerecho -e "\e[1;34mRECON\e[0m"echoecho "1. Passive"echo "2. Active"echo "3. Previous menu"echoecho -n "Choice: "read choicecase $choice in 1) echoecho $line echoecho "Usage: target.com" echoecho -n "Domain: " read domain # Check for no answer if [ -z $domain ]; thenf_error fi # If folder doesn't exist, create it if [ ! -d /$user/$domain ]; thencp -R /opt/scripts/report/ /$user/$domain sed 's/REPLACEDOMAIN/'$domain'/g' /$user/$domain/index.htm > tmp mv tmp /$user/$domain/index.htm fi # Number of tests total=24 echoecho $line echoecho "goofile (1/$total)" python /pentest/enumeration/google/goofile/goofile.py -d $domain -f doc > tmp python /pentest/enumeration/google/goofile/goofile.py -d $domain -f docx >> tmp python /pentest/enumeration/google/goofile/goofile.py -d $domain -f pdf >> tmp python /pentest/enumeration/google/goofile/goofile.py -d $domain -f ppt >> tmp python /pentest/enumeration/google/goofile/goofile.py -d $domain -f pptx >> tmp python /pentest/enumeration/google/goofile/goofile.py -d $domain -f txt >> tmp python /pentest/enumeration/google/goofile/goofile.py -d $domain -f xls >> tmp python /pentest/enumeration/google/goofile/goofile.py -d $domain -f xlsx >> tmp grep $domain tmp | grep -v 'Searching in' | grep -Fv '...' | sort > tmp2 grep '.doc' tmp2 | egrep -v '(.pdf|.ppt|.xls)' > doc grep '.pdf' tmp2 > pdf grep '.ppt' tmp2 > ppt grep '.txt' tmp2 | grep -v 'robots.txt' > txt grep '.xls' tmp2 > xls echoecho "goog-mail (2/$total)" /opt/scripts/mods/goog-mail.py $domain | sort -u > tmp grep -Fv '..' tmp > tmp2 # Remove lines that start with a number sed '/^[0-9]/d' tmp2 > tmp3 # Change to lower case cat tmp3 | tr '[A-Z]' '[a-z]' > tmp4 # Remove blank lines sed '/^$/d' tmp4 > zgoog-mail echoecho "goohost" echo " IP (3/$total)" /pentest/enumeration/google/goohost/goohost.sh -t $domain -m ip >/dev/null echo " Email (4/$total)" /pentest/enumeration/google/goohost/goohost.sh -t $domain -m mail >/dev/null cat report-* > tmp # Move the second column to the first position grep $domain tmp | awk '{ print $2 " " $1 }' > tmp2 column -t tmp2 > zgoohost rm *-$domain.txt echoecho "theHarvester" echo " 123people (5/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b people123 > z123people echo " Ask-mod (6/$total)" /opt/scripts/mods/theHarvester2.py -d $domain -b ask > zask-mod echo " Bing (7/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b bing > zbing echo " Google (8/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b google > zgoogle echo " Google Profiles (9/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b google-profiles > zgoogle-profiles echo " Jigsaw (10/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b jigsaw > zjigsaw echo " LinkedIn (11/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b linkedin > zlinkedin echo " Login-mod (12/$total)" /opt/scripts/mods/theHarvester2.py -d $domain -b login > zlogin-mod echo " PGP (13/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b pgp > zpgp echo " Yahoo-mod (14/$total)" /opt/scripts/mods/theHarvester2.py -d $domain -b yahoo > zyahoo-mod echo " All (15/$total)" /pentest/enumeration/theharvester/theHarvester.py -d $domain -b all > zall echoecho "Metasploit (16/$total)" /opt/metasploit/msf3/msfcli gather/search_email_collector DOMAIN=$domain E > tmp 2>/dev/null grep @$domain tmp | awk '{print $2}' | grep -v '%' | grep -Fv '...@' | sort -u > tmp2 # Change to lower case cat tmp2 | tr '[A-Z]' '[a-z]' > tmp3 # Remove blank lines sed '/^$/d' tmp3 > zmsf echoecho "dnsrecon (17/$total)" /pentest/enumeration/dns/dnsrecon/dnsrecon.py -d $domain -t goo > tmp grep $domain tmp | egrep -v '(Performing Google|Records Found)' > tmp2 # Remove first 6 characters from each line sed 's/^......//' tmp2 > tmp3 sed 's/A //g' tmp3 | sed 's/CNAME //g' | column -t | sort -u > subdomains1.txt echoecho "URLCrazy (18/$total)"/pentest/enumeration/web/urlcrazy/urlcrazy $domain -o tmp > /dev/null # Clean up egrep -v '(#|:|\?|Typo Type|URLCrazy)' tmp | sed 's/[A-Z]\{2\},//g' > tmp2 # Remove lines that start with - grep -v '^-' tmp2 > tmp3 # Remove blank lines sed '/^$/d' tmp3 > tmp4 sed 's/BAHAMAS/Bahamas/g; s/BELGIUM/Belgium/g; s/GERMANY/Germany/g; s/IRELAND/Ireland/g; s/ITALY/Italy/g; s/JAPAN/Japan/g; s/KOREA REPUBLIC OF/Republic of Korea/g; s/NETHERLANDS/Netherlands/g; s/NORWAY/Norway/g; s/RUSSIAN FEDERATION/Russia/g; s/SPAIN/Spain/g; s/SWEDEN/Sweden/g; s/UNITED KINGDOM/United Kingdom/g; s/UNITED STATES/United States/g' tmp4 > squatting ############################################################## cat z* | egrep -v '(@|\*|-|=|\||;|:|"|<|>|/|\?)' > tmp # Remove blank lines sed '/^$/d' tmp > tmp2 # Remove lines that contain a number sed '/[0-9]/d' tmp2 > tmp3 # Remove lines that start with @ or . sed '/^\@\./d' tmp3 > tmp4 # Remove trailing white space from each line sed 's/[ \t]*$//' tmp4 > tmp5 # Substitute a space for a plus sign sed 's/+/ /g' tmp5 > tmp6 # Change to lower case cat tmp6 | tr '[A-Z]' '[a-z]' > tmp7 # Clean up egrep -v '(academy|account|administrator|administrative|advanced|adventure|advertising|america|american|analysis|analyst|antivirus|apple seems|application|applications|architect|article|asian|association|attorney|australia|automation|automotive|balance|bank|bbc|beginning|berlin|beta theta|between|big game|billion|bioimages|biometrics|bizspark|breaches|broker|business|buyer|buying|california|can i help|cannot|capital|career|carrying|cashing|certified|challenger|championship|change|chapter|charge|china|chinese|clearance|cloud|code|college|columbia|communications|community|company pages|competition|competitive|compliance|computer|concept|conference|config|connections|construction|consultant|contributor|controllang|cooperation|coordinator|corporation|creative|croatia|crm|dallas|day care|death toll|delta|department|description|designer|detection|developer|develop|development|devine|digital|diploma|director|disability|disaster|disclosure|dispute|division|dos poc|download|drivers|during|economy|ecovillage|editor|education|effect|electronic|emails|embargo|empower|end user|energy|engineer|enterprise|entertainment|entreprises|entrepreneur|environmental|error page|ethical|example|excellence|executive|expertzone|exploit|facebook|faculty|fall edition|fast track|fatherhood|fbi|federal|filmmaker|finance|financial|forensic|found|freelance|from|frontiers in tax|full|germany|get control|global|google|government|graphic|greater|group|guardian|hackers|hacking|harden|harder|hawaii|hazing|headquarters|health|history|homepage|hospital|house|how to|hurricane|idc|in the news|index|information|innovation|installation|insurers|integrated|international|internet|instructor|insurance|investigation|investment|investor|israel|japan|job|justice|kelowna|knowing|laptops|letter|licensing|lighting|limitless|liveedu|llp|ltd|lsu|luscous|malware|managed|management|manager|managing|manufacturing|marketplace|mastering|md|media|medical|medicine|meta tags|methane|metro|microsoft|middle east|mitigation|money|monitor|more coming|museums|negative|network|network|new user|newspaper|new york|next page|nitrogen|nyc|obtain|occupied|offers|office|online|organizational|outbreak|owners|partner|pathology|people|perceptions|philippines|photo|picture|places|planning|portfolio|potential|preparatory|president|principal|print|private|process|producer|product|professional|professor|profile|project|publichealth|published|pyramid|questions|redeem|redirect|register|registry|regulation|rehab|remote|report|republic|research|revised|rising|rural health|sales|satellite|save the date|school|scheduling|science|search|searc|secured|security|secretary|secrets|see more|selection|senior|service|services|software|solutions|source|special|station home|statistics|strategy|student|successful|superheroines|supervisor|support|switch|system|systems|targeted|technical|technology|tester|textoverflow|theater|time in|tit for tat|toolbook|tools|traditions|trafficking|treasury|trojan|twitter|training|ts|types of scams|unclaimed|underground|university|united states|untitled|view|Violent|virginia bar|voice|volkswagen|volume|wanted|web search|web site|website|welcome|west virginia|when the|whiskey|windows|workers|world|www|xbox)' tmp7 > tmp8 # Remove leading and trailing whitespace from each line sed 's/^[ \t]*//;s/[ \t]*$//' tmp8 > tmp9 # Remove lines that contain a single word sed '/[[:blank:]]/!d' tmp9 > tmp10 # Clean up sed 's/\..../ /g' tmp10 | sed 's/\.../ /g' > tmp11 # Capitalize the first letter of every word, print last name then first name sed "s/\b\(.\)/\u\1/g" tmp11 | awk '{print $2", "$1}' | sort -u > names ############################################################## cat z* | grep @$domain | grep -vF '...' | egrep -v '(\*|=|\+|\[|\||;|:|"|<|>|/|\?)' > tmp # Remove trailing whitespace from each line sed 's/[ \t]*$//' tmp > tmp2 # Change to lower case cat tmp2 | tr '[A-Z]' '[a-z]' > tmp3 # Clean up grep -v 'web search' tmp3 | sort -u > emails ############################################################## cat z* | sed '/^[0-9]/!d' | grep -v '@' > tmp # Substitute a space for a colon sed 's/:/ /g' tmp > tmp2 # Move the second column to the first position awk '{ print $2 " " $1 }' tmp2 > tmp3 column -t tmp3 > tmp4 # Change to lower case cat tmp4 | tr '[A-Z]' '[a-z]' > tmp5 grep $domain tmp5 | sort -u > subdomains2.txt cat subdomain* | grep -v "$domain\." | egrep -v '(.nat.|252f)' | sed 's/www\.//g' | column -t | sort -u > subdomains ############################################################## echoecho "Whois" echo " Domain (19/$total)" whois -H $domain > tmp # Remove leading whitespace sed 's/^[ \t]*//' tmp > tmp2 # Clean up egrep -v '(%|<a|=-=-=-=|Access may be|Additionally|Afilias except|and DNS Hosting|and limitations of|any use of|Be sure to|By submitting an|by the terms|can easily change|circumstances will|clientDeleteProhibited|clientTransferProhibited|clientUpdateProhibited|complaint will|contact information|Contact us|Copy and paste|currently set|database|data contained in|data presented in|date of|dissemination|Domaininfo AB|Domain Management|Domain names in|Domain status: ok|enable high|except as reasonably|failure to|facsimile of|for commercial purpose|for detailed information|For information for|for information purposes|for the sole|Get Noticed|Get a FREE|guarantee its|HREF|In Europe|In most cases|in obtaining|in the address|includes restrictions|including spam|information is provided|is not the|is providing|Learn how|Learn more|makes this information|MarkMonitor|mining this data|minute and one|modify existing|modify these terms|must be sent|name cannot|NamesBeyond|not to use|Note: This|NOTICE|obtaining information about|of Moniker|of this data|or hiding any|or otherwise support|other use of|own existing customers|Please be advised|Please note|policy|prior written consent|privacy is|Professional and|prohibited without|Promote your|protect the|Public Interest|queries or|Register your|Registrars|registration record|repackaging,|responsible for|See Business Registration|server at|solicitations via|sponsorship|Status|support the transmission|telephone, or facsimile|that apply to|that you will|the right| The data is|the transmission|The Trusted Partner|This listing is|This feature is|This information|This service is|to collect or|to entities|to report any|transmission of mass|UNITED STATES|United States|unsolicited advertising|Users may|Version 6|via e-mail|Visit AboutUs.org|while believed|will use this|with many different|with no guarantee|We reserve the|Whois|you agree|You may not)' tmp2 > tmp3 # Remove lines starting with "*" sed '/^*/d' tmp3 > tmp4 # Remove lines starting with "-" sed '/^-/d' tmp4 > tmp5 # Remove lines starting with http sed '/^http/d' tmp5 > tmp6 # Remove lines starting with US sed '/^US/d' tmp6 > tmp7 # Clean up phone numbers sed 's/+1.//g' tmp7 > tmp8 # Remove leading whitespace from file awk '!d && NF {sub(/^[[:blank:]]*/,""); d=1} d' tmp8 > tmp9 # Remove trailing whitespace from each line sed 's/[ \t]*$//' tmp9 > tmp10 # Compress blank lines cat -s tmp10 > tmp11 # Remove lines that end with various words then a colon or period(s) egrep -v '(2:$|3:$|Address.$|Address........$|Address.........$|Ext.:$|FAX:$|Fax............$|Fax.............$|Province:$|Server:$)' tmp11 > tmp12 # Remove line after "Domain Servers:" sed -i '/^Domain Servers:/{n; /.*/d}' tmp12 # Remove line after "Domain servers" sed -i '/^Domain servers/{n; /.*/d}' tmp12 # Remove blank lines from end of file awk '/^[[:space:]]*$/{p++;next} {for(i=0;i<p;i++){printf "\n"}; p=0; print}' tmp12 > whois-domain echo " IP (20/$total)" y=$(ping -c1 -w2 $domain | grep 'PING' | cut -d ')' -f1 | cut -d '(' -f2) ; whois -H $y > tmp # Remove leading whitespace sed 's/^[ \t]*//' tmp > tmp2 # Remove trailing whitespace from each line sed 's/[ \t]*$//' tmp2 > tmp3 # Clean up egrep -v '(\#|\%|\*|All reports|Comment|dynamic hosting|For fastest|For more|Found a referral|http|OriginAS:$|Parent:$|point in|RegDate:$|The activity|the correct|Without these)' tmp3 > tmp4 # Remove leading whitespace from file awk '!d && NF {sub(/^[[:blank:]]*/,""); d=1} d' tmp4 > tmp5 # Remove blank lines from end of file awk '/^[[:space:]]*$/{p++;next} {for(i=0;i<p;i++){printf "\n"}; p=0; print}' tmp5 > tmp6 # Compress blank lines cat -s tmp6 > tmp7 # Clean up sed 's/+1-//g' tmp7 > whois-ip echo # Remove all empty files find -type f -empty -exec rm {} + echo "mydnstools.info (21/$total)" wget -q http://www.mydnstools.info/nslookup/$domain/ANY -O tmp sed -n '/ANSWER SECTION/,/WHEN:/p' tmp | egrep -v '(DNSKEY|DS|NSEC3PARAM|Query time|RRSIG|SEC3|SECTION|SERVER|SSEC|TYPE51|WHEN)' | sed 's/;; //g; s/"//g; s/\$domain./\$domain/g; s/$domain./$domain/g; s/.com./.com/g; s/.edu./.edu/g; s/.gov./.gov/g; s/.info./.info/g; s/.net./.net/g; s/.org./.org/g; s/.uk./.uk/g; s/IN//g' | awk '{print $1,$3,$4,$5,$6,$7,$8,$9,$10}' | column -t | sort -u -k2 -k1 > records echo "dnssy.com (22/$total)" wget -q http://www.dnssy.com/report.php?q=$domain -O tmp sed -n '/Results for/,/\/table/p' tmp > tmp2 echo "<html>" > tmp3 cat tmp2 | grep -v 'Results for' >> tmp3 echo "</html>" >> tmp3 sed 's/Pass/<center><img src="..\/images\/icons\/green.png" height="50" width="50"><\/center>/g;s/Warning/<center><img src="..\/images\/icons\/yellow.png" height="50" width="50"><\/center>/g;s/Fail/<center><img src="..\/images\/icons\/red.png" height="50" width="50"><\/center>/g;s/ class="info"//g; s/ class="rfail"//g; s/ class="rinfo"//g; s/ class="rpass"//g; s/ class="rsecu"//g; s/ class="rwarn"//g;s/All of the glue/Glue/g; s/All of your MX/All MX/g; s/All of your nameservers/Nameservers/g; s/Checking domain format/Domain format/g;s/Checking for parent nameservers/Parent nameservers/g; s/Checking for parent glue/Parent glue/g; s/Each of your nameservers/Each nameserver/g;s/I found the following MX records://g; s/I was unable/Unable/g; s/None of your MX/No MX/g; s/This is all of the MX servers I found.//g;s/Your nameservers/Nameservers/g; s/Your NS records at your nameservers are://g; s/Your NS records at your parent nameserver are://g;s/Your SOA/SOA/g; s/Your web server/The web server/g; s/Your web server says it is://g' tmp3 > /$user/$domain/data/config.htm echo "robtex.com (23/$total)" wget -q http://top.robtex.com/$domain.html#records -O robtex-records.htm wget -q http://top.robtex.com/$domain.html#shared -O robtex-shared.htm x=$(ls -l | grep 'robtex' | awk '{print $5,$8}' | sort | head -1 | awk '{print $2}') mv $x tmp sed '/<!DOCTYPE html>/,/<div id="c0a">/d' tmp | sed '/nopad sortable nospan/,/<\/html>/d' | sed '/<div id="c0b1">/,/DNS Records/d' | sed 's/<h2 class="h2s">Graph<\/h2>//g; s/<h2 class="h2s">Shared<\/h2>//g; s/"7.00"/"10.00"/g; s/"9.00"/"12.00"/g' > tmp2 echo " </div>" >> tmp2 echo " </div>" >> tmp2 echo "</div>" >> tmp2 echo "" >> tmp2 echo "</body>" >> tmp2 echo "" >> tmp2 echo "</html>" >> tmp2 cat tmp2 >> /$user/$domain/pages/robtex.htm echo "urlvoid.com (24/$total)" wget -q http://www.urlvoid.com/scan/$domain -O tmp sed -n '/Website Blacklist Report/,/<\/table>/p' tmp > tmp2 sed 's/<img src="http:\/\/www.urlvoid.com\/images\/valid.ico" alt="Clean" title="Clean" \/> NOT FOUND/<center><img src="..\/images\/icons\/green.png" height="25" width="25"><\/center>/g; s/<img src="http:\/\/www.urlvoid.com\/images\/alert.ico" alt="Alert" title="Detected!" \/> <font color="red">DETECTED<\/font>/<center><img src="..\/images\/icons\/red.png" height="25" width="25"><\/center>/g; s/rel="nofollow" //g; s/ title="View more details" target="_blank"//g; s/<img src="http:\/\/www.urlvoid.com\/images\/link.ico" alt="Link" \/>//g; s/ class="tasks"//g; s/<th>Info<\/th>//g' tmp2 | grep -v 'Blacklist Report' > tmp3 # Remove leading whitespace from each line sed 's/^[ \t]*//' tmp3 > /$user/$domain/data/black-listed.htm awk '{print $3}' records > tmp awk '{print $2}' subdomains >> tmp grep -E '([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})' tmp | sort -n -u -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 > hosts cat hosts >> /$user/$domain/data/hosts.htm; echo "</pre>" >> /$user/$domain/data/hosts.htm ############################################################## echo "Passive Recon" > zreport echo $domain >> zreport date +%A" - "%B" "%d", "%Y >> zreport echo >> zreport echo >> zreport echo "Summary" >> zreport echo $line >> zreport echo > tmp if [ -f emails ]; thenemailcount=$(wc -l emails | cut -d ' ' -f1) echo "Emails $emailcount" >> zreport echo "Emails ($emailcount)" >> tmp echo $line >> tmp cat emails >> tmp echo >> tmp fiif [ -f names ]; thennamecount=$(wc -l names | cut -d ' ' -f1) echo "Names $namecount" >> zreport echo "Names ($namecount)" >> tmp echo $line >> tmp cat names >> tmp echo >> tmp fiif [ -f hosts ]; thenhostcount=$(wc -l hosts | cut -d ' ' -f1) echo "Hosts $hostcount" >> zreport echo "Hosts ($hostcount)" >> tmp echo $line >> tmp cat hosts >> tmp echo >> tmp fiif [ -f records ]; thenrecordscount=$(wc -l records | cut -d ' ' -f1) echo "DNS Records $recordscount" >> zreport echo "DNS Records ($recordscount)" >> tmp echo $line >> tmp cat records >> tmp echo >> tmp fiif [ -f squatting ]; thenurlcount2=$(wc -l squatting | cut -d ' ' -f1) echo "Squatting $urlcount2" >> zreport echo "Squatting ($urlcount2)" >> tmp echo $line >> tmp cat squatting >> tmp echo >> tmp fiif [ -f subdomains ]; thenurlcount=$(wc -l subdomains | cut -d ' ' -f1) echo "Subdomains $urlcount" >> zreport echo "Subdomains ($urlcount)" >> tmp echo $line >> tmp cat subdomains >> tmp echo >> tmp fiif [ -f xls ]; thenxlscount=$(wc -l xls | cut -d ' ' -f1) echo "Excel $xlscount" >> zreport echo "Excel Files ($xlscount)" >> tmp echo $line >> tmp cat xls >> tmp echo >> tmp cat xls >> /$user/$domain/data/xls.htm; echo "</pre>" >> /$user/$domain/data/xls.htm fiif [ -f pdf ]; thenpdfcount=$(wc -l pdf | cut -d ' ' -f1) echo "PDF $pdfcount" >> zreport echo "PDF Files ($pdfcount)" >> tmp echo $line >> tmp cat pdf >> tmp echo >> tmp cat pdf >> /$user/$domain/data/pdf.htm; echo "</pre>" >> /$user/$domain/data/pdf.htm fiif [ -f ppt ]; thenpptcount=$(wc -l ppt | cut -d ' ' -f1) echo "PowerPoint $pptcount" >> zreport echo "PowerPoint Files ($pptcount)" >> tmp echo $line >> tmp cat ppt >> tmp echo >> tmp cat ppt >> /$user/$domain/data/ppt.htm; echo "</pre>" >> /$user/$domain/data/ppt.htm fiif [ -f txt ]; thentxtcount=$(wc -l txt | cut -d ' ' -f1) echo "Text $txtcount" >> zreport echo "Text Files ($txtcount)" >> tmp echo $line >> tmp cat txt >> tmp echo >> tmp cat txt >> /$user/$domain/data/txt.htm; echo "</pre>" >> /$user/$domain/data/txt.htm fiif [ -f doc ]; thendoccount=$(wc -l doc | cut -d ' ' -f1) echo "Word $doccount" >> zreport echo "Word Files ($doccount)" >> tmp echo $line >> tmp cat doc >> tmp echo >> tmp cat doc >> /$user/$domain/data/doc.htm; echo "</pre>" >> /$user/$domain/data/doc.htm ficat tmp >> zreport echo "Whois Domain" >> zreport echo $line >> zreport cat whois-domain >> zreport echo >> zreport echo "Whois IP" >> zreport echo $line >> zreport cat whois-ip >> zreport cat emails >> /$user/$domain/data/emails.htm; echo "</pre>" >> /$user/$domain/data/emails.htm cat names >> /$user/$domain/data/names.htm; echo "</pre>" >> /$user/$domain/data/names.htm cat records >> /$user/$domain/data/records.htm; echo "</pre>" >> /$user/$domain/data/records.htm cat squatting >> /$user/$domain/data/squatting.htm; echo "</pre>" >> /$user/$domain/data/squatting.htm cat subdomains >> /$user/$domain/data/subdomains.htm; echo "</pre>" >> /$user/$domain/data/subdomains.htm cat whois-domain >> /$user/$domain/data/whois-domain.htm; echo "</pre>" >> /$user/$domain/data/whois-domain.htm cat whois-ip >> /$user/$domain/data/whois-ip.htm; echo "</pre>" >> /$user/$domain/data/whois-ip.htm cat zreport >> /$user/$domain/data/passive-recon.htm; echo "</pre>" >> /$user/$domain/data/passive-recon.htm rm emails hosts names records robtex* squatting subdomains* tmp* whois* z* doc pdf ppt txt xls 2>/dev/null echoecho $line echoecho "***Scan complete.***" echoechoprintf 'The supporting data folder is located at \e[1;33m%s\e[0m\n' /$user/$domain/ echoread -p "Press <return> to continue." ############################################################## f_runlocally firefox & sleep 2 firefox -new-tab images.google.com & sleep 1 firefox -new-tab arin.net & sleep 1 firefox -new-tab toolbar.netcraft.com/site_report?url=http://www.$domain & sleep 1 firefox -new-tab uptime.netcraft.com/up/graph?site=www.$domain & sleep 1 firefox -new-tab shodanhq.com/search?q=$domain & sleep 1 firefox -new-tab jigsaw.com/ & sleep 1 firefox -new-tab pastebin.com/ & sleep 1 firefox -new-tab google.com/#q=filetype%3Axls+OR+filetype%3Axlsx+site%3A$domain & sleep 1 firefox -new-tab google.com/#q=filetype%3Appt+OR+filetype%3Apptx+site%3A$domain & sleep 1 firefox -new-tab google.com/#q=filetype%3Adoc+OR+filetype%3Adocx+site%3A$domain & sleep 1 firefox -new-tab google.com/#q=filetype%3Apdf+site%3A$domain & sleep 1 firefox -new-tab google.com/#q=filetype%3Atxt+site%3A$domain & sleep 1 firefox -new-tab http://www.urlvoid.com/scan/$domain & sleep 1 firefox -new-tab sec.gov/edgar/searchedgar/companysearch.html & sleep 1 firefox -new-tab google.com/finance/ & sleep 1 firefox -new-tab reuters.com/finance/stocks echoechoexit ;; 2) echoecho $line echoecho "Usage: target.com" echoecho -n "Domain: " read domain # Check for no answer if [ -z $domain ]; thenf_error fi # If folder doesn't exist, create it if [ ! -d /$user/$domain ]; thencp -R /opt/scripts/report/ /$user/$domain sed 's/REPLACEDOMAIN/'$domain'/' /$user/$domain/index.htm > tmp mv tmp /$user/$domain/index.htm fi # Number of tests total=10 echoecho $line echoecho "Nmap" echo " Email (1/$total)" nmap -Pn -n --open -p80 --script=http-email-harvest --script-args=http-email-harvest.maxpagecount=100,http-email-harvest.maxdepth=10 $domain > tmp grep @$domain tmp | grep -v '%20' | grep -v 'jpg' | awk '{print $2}' > tmp2 # Change to lower case cat tmp2 | tr '[A-Z]' '[a-z]' | sort -u > zemail # Check if file is empty if [ ! -s zemail ]; thenrm zemail fiechoecho "dnsrecon" echo " DNS Records (2/$total)" /pentest/enumeration/dns/dnsrecon/dnsrecon.py -d $domain -t std > tmp egrep -v '(Bind Version for|Could not|Enumerating SRV|not configured|Performing|Records Found|Recursion|Resolving|TXT)' tmp > tmp2 # Remove first 6 characters from each line sed 's/^......//' tmp2 | awk '{print $2,$1,$3,$4,$5,$6,$7,$8,$9,$10}' | column -t | sort -u -k2 -k1 > tmp3 grep 'TXT' tmp | sed 's/^......//' | awk '{print $2,$1,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15}' >> tmp3 egrep -v '(SEC3|SKEYs|SSEC)' tmp3 > zdnsrecon cat /$user/$domain/data/records.htm zdnsrecon | grep -v '<' | column -t | sort -u -k2 -k1 > tmp3 echo '<pre style="font-size:14px;">' > /$user/$domain/data/records.htm cat tmp3 >> /$user/$domain/data/records.htm; echo "</pre>" >> /$user/$domain/data/records.htm echo " Zone Transfer (3/$total)" /pentest/enumeration/dns/dnsrecon/dnsrecon.py -d $domain -t axfr > tmp egrep -v '(Checking for|Failed|filtered|NS Servers|Removing|TCP Open|Testing NS)' tmp | sed 's/^....//' | sed /^$/d > zonetransfer echo " Sub-domains (~5 min) (4/$total)" /pentest/enumeration/dns/dnsrecon/dnsrecon.py -d $domain -t brt -D /pentest/enumeration/dns/dnsrecon/namelist.txt --iw -f > tmp grep $domain tmp | grep -v "$domain\." | egrep -v '(Performing|Records Found)' | sed 's/\[\*\] //g' | sed 's/^[ \t]*//' | awk '{print $2,$3}' | column -t | sort -u > zdnsrecon-sub echoecho "Fierce (~5 min) (5/$total)" /pentest/enumeration/dns/fierce/fierce.pl -dns $domain -wordlist /pentest/enumeration/dns/fierce/hosts.txt -suppress -file tmp4 sed -n '/Now performing/,/Subnets found/p' tmp4 | grep $domain | awk '{print $2 " " $1}' | column -t | sort -u > zsubdomains-fierce cat zdnsrecon-sub zsubdomains-fierce | grep -v '.nat.' | column -t | sort -u > zsubdomains if [ -f /$user/$domain/data/subdomains.htm ]; thencat /$user/$domain/data/subdomains.htm zsubdomains | grep -v "<" | grep -v "$domain\." | column -t | sort -u > zsubdomains-combined echo '<pre style="font-size:14px;">' > /$user/$domain/data/subdomains.htm cat zsubdomains-combined >> /$user/$domain/data/subdomains.htm; echo "</pre>" >> /$user/$domain/data/subdomains.htm figrep -v '<' /$user/$domain/data/records.htm | awk '{print $3}' | grep -v '[A-Za-z]' | grep -E '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}' -o | sort -u > tmp awk '{print $2}' /$user/$domain/data/subdomains.htm | grep -v '[A-Za-z]' | sort -u > tmp2 grep -v ':' zonetransfer | grep -E '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}' -o | sort -u > tmp3 cat tmp tmp2 tmp3 | sort -n -u -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | sed '/^$/d' > zhosts echoecho "Loadbalancing (6/$total)" /pentest/enumeration/web/lbd/lbd.sh $domain > tmp 2>/dev/null egrep -v '(Checks if a given|Written by|Proof-of-concept)' tmp > tmp2 # Remove leading whitespace from file awk '!d && NF {sub(/^[[:blank:]]*/,""); d=1} d' tmp2 > tmp3 # Remove leading whitespace from each line sed 's/^[ \t]*//' tmp3 > tmp4 # Remove blank lines from end of file awk '/^[[:space:]]*$/{p++;next} {for(i=0;i<p;i++){printf "\n"}; p=0; print}' tmp4 > tmp5 # Clean up cat -s tmp5 > zloadbalancing echoecho "Traceroute" echo " UDP (7/$total)" echo "UDP" > tmp traceroute $domain | awk -F" " '{print $1,$2,$3}' >> tmp echo >> tmp echo "ICMP ECHO" >> tmp echo " ICMP ECHO (8/$total)" traceroute -I $domain | awk -F" " '{print $1,$2,$3}' >> tmp echo >> tmp echo "TCP SYN" >> tmp echo " TCP SYN (9/$total)" traceroute -T $domain | awk -F" " '{print $1,$2,$3}' >> tmp grep -v 'traceroute' tmp > tmp2 # Remove blank lines from end of file awk '/^[[:space:]]*$/{p++;next} {for(i=0;i<p;i++){printf "\n"}; p=0; print}' tmp2 > ztraceroute echoecho "Whatweb (10/$total)" grep -v '<' /$user/$domain/data/subdomains.htm | awk '{print $1}' > tmp /pentest/enumeration/web/whatweb/whatweb -i tmp --color=never --no-errors -t 255 > tmp2 # Find lines that start with http, and insert a line after sort tmp2 | sed '/^http/a\ ' > tmp3 # Cleanup sed 's/,/\n/g' tmp3 | sed 's/^[ \t]*//' | sed 's/\(\[[0-9][0-9][0-9]\]\)/\n\1/g' | sed 's/http:\/\///g' | grep -v 'Country' > zwhatweb ############################################################## echo "Active Recon" > zreport echo $domain >> zreport date +%A" - "%B" "%d", "%Y >> zreport echo >> zreport if [ -f zemail ]; thenecho "Emails" >> zreport echo "==============================" >> zreport cat zemail >> zreport fiecho "Hosts" >> zreport echo "==============================" >> zreport cat zhosts >> zreport echo >> zreport echo "DNS Records" >> zreport echo "==============================" >> zreport cat zdnsrecon >> zreport echo >> zreport echo "Loadbalancing" >> zreport echo "==============================" >> zreport cat zloadbalancing >> zreport echo >> zreport echo "Sub Domains" >> zreport echo "==============================" >> zreport cat zsubdomains >> zreport echo >> zreport echo "Traceroute" >> zreport echo "==============================" >> zreport cat ztraceroute >> zreport echo >> zreport echo "Zone Transfer" >> zreport echo "==============================" >> zreport cat zonetransfer >> zreport echo >> zreport echo "Whatweb" >> zreport echo "==============================" >> zreport cat zwhatweb >> zreport cat zloadbalancing >> /$user/$domain/data/loadbalancing.htm; echo "</pre>" >> /$user/$domain/data/loadbalancing.htm cat zreport >> /$user/$domain/data/active-recon.htm; echo "</pre>" >> /$user/$domain/data/active-recon.htm cat ztraceroute >> /$user/$domain/data/traceroute.htm; echo "</pre>" >> /$user/$domain/data/traceroute.htm cat zwhatweb >> /$user/$domain/data/whatweb.htm; echo "</pre>" >> /$user/$domain/data/whatweb.htm cat zonetransfer >> /$user/$domain/data/zonetransfer.htm; echo "</pre>" >> /$user/$domain/data/zonetransfer.htm if [[ -f /$user/$domain/data/emails.htm && -f zemail ]]; thencat /$user/$domain/data/emails.htm zemail | grep -v '<' | sort -u > tmp echo '<pre style="font-size:14px;">' > /$user/$domain/data/emails.htm cat tmp >> /$user/$domain/data/emails.htm; echo "</pre>" >> /$user/$domain/data/emails.htm fiecho '<pre style="font-size:14px;">' > /$user/$domain/data/hosts.htm cat zhosts >> /$user/$domain/data/hosts.htm; echo "</pre>" >> /$user/$domain/data/hosts.htm rm tmp* z* echoecho $line echoecho "***Scan complete.***" echoechoprintf 'The supporting data folder is located at \e[1;33m%s\e[0m\n' /$user/$domain/ echoechofirefox /$user/$domain/index.htm & exit ;; 3) f_main;; *) f_error;;esac}##############################################################################################################f_typeofscan(){echo -e "\e[1;34mType of scan: \e[0m"echoecho "1. External"echo "2. Internal"echo "3. Previous menu"echoecho -n "Choice: "read choicecase $choice in 1) echoecho -e "\e[1;33m[*] Setting source port to 53.\e[0m" sourceport=53 echoecho $line echo ;; 2) echoecho -e "\e[1;33m[*] Setting source port to 88.\e[0m" sourceport=88 echoecho $line echo ;; 3) f_main;; *) f_error;;esac}##############################################################################################################f_pingsweep(){clearf_bannerf_typeofscanecho -e "\e[1;34mType of input:\e[0m"echoecho "1. List containing IPs, ranges and/or CIDRs."echo "2. Manual"echoecho -n "Choice: "read choicecase $choice in 1) f_location echoecho "Running an Nmap ping sweep for live hosts." nmap -iL $location -sn -T4 --stats-every 10s -g $sourceport > tmp ;; 2) echoecho -n "Enter your targets: " read manual # Check for no answer if [ -z $manual ]; thenf_error fiechoecho "Running an Nmap ping sweep for live hosts." nmap -sn -T4 --stats-every 10s -g $sourceport $manual > tmp ;; *) f_error;;esac##############################################################perl <<'EOF'# Author: Ben Wood# Description: Reads an nmap ping sweep and correctly identifies lives hostsuse strict;undef $/; # Enable slurpingopen(my $handle, '<', "tmp");open(my $output, '>', "tmp2");while(<$handle>){# Read report lineswhile (/((?:[\x00-\xFF]*?(?=Nmap\s+scan\s+report)|[\x00-\xFF]*))/mixg) {my $report = $1;# Print IP if host is REALLY upif (($report =~ /MAC\s+Address/mix)or ($report =~ /Nmap\s+scan\s+report\s+for\s+\S+?\s+\(\S+\)/mix)) {my ($ip) = $report =~ /(\d+\.\d+\.\d+\.\d+)/mix;print $output "$ip\n";}}}EOF##############################################################rm tmpmv tmp2 /$user/hosts.txtechoecho $lineechoecho "***Scan complete.***"echoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/hosts.txtechoechoexit}##############################################################################################################f_scanname(){f_typeofscanecho -n "Name of scan: "read name# Check for no answerif [ -z $name ]; thenf_errorfimkdir -p $name}##############################################################################################################f_single(){clearf_bannerf_scannameechoecho -n "Single IP, URL or Range: "read target# Check for no answerif [ -z $target ]; thenrm -rf $name f_errorfiecho $target > tmp-listlocation=tmp-listSTART=$(date +%r\ %Z)f_discoveryf_numhostsf_scanf_portsf_scriptsf_metasploitf_report}##############################################################################################################f_lan(){clearf_bannerf_scannameSTART=$(date +%r\ %Z)arp-scan -localnet -interface $interface | egrep -v '(Ending|Interface|packets|Starting)' | awk '{print $1}' | sort -n -u -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 > tmp# Remove blank linessed '/^$/d' tmp > $name/hosts.txt# Check for zero hosts (empty file)if [ ! -s $name/hosts.txt ]; thenrm -rf "$name" tmp* echoecho $line echoecho "***Scan complete.***" echoecho -e "\e[1;33mNo hosts found with open ports.\e[0m" echoechoexitfi# Number of hostsnumber=$(wc -l $name/hosts.txt | cut -d ' ' -f1)if [ $number -eq 1 ]; thenechoecho $line echoecho -e "\e[1;33mHost discovered.\e[0m"elseechoecho $line echoecho -e "\e[1;33m$number hosts discovered with open ports.\e[0m"fif_scanf_portsf_scriptsf_metasploitf_report}##############################################################################################################f_lists(){clearf_bannerf_scannamef_locationSTART=$(date +%r\ %Z)f_discoveryf_numhostsf_scanf_portsf_scriptsf_metasploitf_report}##############################################################################################################f_cidr(){clearf_bannerf_scannameechoecho Usage: 192.168.0.0/16echoecho -n "Enter CIDR notation: "read cidr# Check for no answerif [ -z $cidr ]; thenrm -rf $name f_errorfi# Check for wrong answersub=$(echo $cidr|cut -d '/' -f2)max=32if [ "$sub" -gt "$max" ]; thenf_errorfiecho $cidr | grep '/' > /dev/null 2>&1if [ $? -ne 0 ]; thenf_errorfiecho $cidr | grep [[:alpha:]\|[,\\]] > /dev/null 2>&1if [ $? -eq 0 ]; thenf_errorfiecho $cidr > tmp-listlocation=tmp-listechoecho -n "Do you have an exclusion list? (y/N) "read ExFileif [ -z $ExFile ]; thenExFile="n"fiExFile="$(echo ${ExFile} | tr 'A-Z' 'a-z')"if [ $ExFile == "y" ]; thenecho -n "Enter the path to the exclude list file: " read excludefile START=$(date +%r\ %Z) if [ -z $excludefile ]; thenf_error fiif [ ! -f $excludefile ]; thenf_error fif_discoveryexcludeelsef_discoveryfif_numhostsf_scanf_portsf_scriptsf_metasploitf_report}##############################################################################################################f_discovery(){echoecho $lineechoecho -e "\e[1;34mHost discovery.\e[0m"nmap -iL $location -PP -PE -PM -PI -PA20,53,80,113,443,5060,10043 -PS1,7,9,13,21-23,25,37,42,49,53,69,79-81,105,109-111,113,123,135,137-139,143,161,179,222,264,384,389,407,443,445,465,500,502,512-515,523,540,548,554,617,623,689,705,783,902,910,912,921,993,995,1000,1024,1030,1035,1090,1098-1103,1129,1158,1199,1220,1234,1300,1311,1352,1433-1435,1440,1494,1521,1530,1533,1581-1582,1604,1720,1723,1755,1900,2000-2001,2049,2100,2103,2121,2199,2207,2222,2323,2380,2525,2533,2598,2638,2809,2947,2967,3000,3050,3057,3128,3273,3306,3389,3500,3628,3632,3690,3780,3790,4000,4444-4445,4659,4848,5038,5051,5060-5061,5093,5168,5250,5351,5353,5355,5400,5405,5432-5433,5520-5521,5554-5555,5560,5580,5631-5632,5800,5900-5910,5920,6000,6050,6060,6070,6080,6101,6106,6112,6379,6405,6502-6504,6660,6667,6905,7080,7144,7210,7510,7579-7580,7700,7777,7787,7800-7801,8000,8008,8014,8028,8030,8080-8081,8087,8090,8180,8205,8222,8300,8303,8333,8400,8443-8444,8503,8800,8812,8880,8888-8890,8899,8901-8903,9000,9080-9081,9084,9090,9099,9111,9160,9152,9495,9809-9815,9999-10001,10008,10050,10098,10162,10202-10203,10443,10616,10628,11000,11099,11234,11333,12174,12203,12397,12401,13364,13500,13838,14330,15200,16102,17185,17200,18881,19300,19810,20031,20034,20101,20222,22222,23472,23791,23943,25000,25025,26000,26122,27000,27017,27888,28222,28784,30000,31099,32913,34443,35871,37718,38080,38292,41025,41523-41524,44334,44818,45230,46823-46824,47001-47002,48899,50000-50004,50013,50500-50504,57772,62078,62514,65535 -PU59428 -p1,7,9,13,21-23,25,37,42,49,53,69,79-81,105,109-111,113,123,135,137-139,143,161,179,222,264,384,389,407,443,445,465,500,502,512-515,523,540,548,554,617,623,689,705,783,902,910,912,921,993,995,1000,1024,1030,1035,1090,1098-1103,1129,1158,1199,1220,1234,1300,1311,1352,1433-1435,1440,1494,1521,1530,1533,1581-1582,1604,1720,1723,1755,1900,2000-2001,2049,2100,2103,2121,2199,2207,2222,2323,2380,2525,2533,2598,2638,2809,2947,2967,3000,3050,3057,3128,3273,3306,3389,3500,3628,3632,3690,3780,3790,4000,4444-4445,4659,4848,5038,5051,5060-5061,5093,5168,5250,5351,5353,5355,5400,5405,5432-5433,5520-5521,5554-5555,5560,5580,5631-5632,5800,5900-5910,5920,6000,6050,6060,6070,6080,6101,6106,6112,6379,6405,6502-6504,6660,6667,6905,7080,7144,7210,7510,7579-7580,7700,7777,7787,7800-7801,8000,8008,8014,8028,8030,8080-8081,8087,8090,8180,8205,8222,8300,8303,8333,8400,8443-8444,8503,8800,8812,8880,8888-8890,8899,8901-8903,9000,9080-9081,9084,9090,9099,9111,9160,9152,9495,9809-9815,9999-10001,10008,10050,10098,10162,10202-10203,10443,10616,10628,11000,11099,11234,11333,12174,12203,12397,12401,13364,13500,13838,14330,15200,16102,17185,17200,18881,19300,19810,20031,20034,20101,20222,22222,23472,23791,23943,25000,25025,26000,26122,27000,27017,27888,28222,28784,30000,31099,32913,34443,35871,37718,38080,38292,41025,41523-41524,44334,44818,45230,46823-46824,47001-47002,48899,50000-50004,50013,50500-50504,57772,62078,62514,65535 --host-timeout=10m --max-rtt-timeout=600ms --initial-rtt-timeout=300ms --min-rtt-timeout=300ms --max-retries=2 --min-rate=200 --stats-every 10s -g $sourceport -oN tmp}##############################################################################################################f_discoveryexclude(){echoecho $lineechoecho -e "\e[1;34mHost discovery.\e[0m"nmap -iL $location --excludefile $excludefile -PP -PE -PM -PI -PA20,53,80,113,443,5060,10043 -PS1,7,9,13,21-23,25,37,42,49,53,69,79-81,105,109-111,113,123,135,137-139,143,161,179,222,264,384,389,407,443,445,465,500,502,512-515,523,540,548,554,617,623,689,705,783,902,910,912,921,993,995,1000,1024,1030,1035,1090,1098-1103,1129,1158,1199,1220,1234,1300,1311,1352,1433-1435,1440,1494,1521,1530,1533,1581-1582,1604,1720,1723,1755,1900,2000-2001,2049,2100,2103,2121,2199,2207,2222,2323,2380,2525,2533,2598,2638,2809,2947,2967,3000,3050,3057,3128,3273,3306,3389,3500,3628,3632,3690,3780,3790,4000,4444-4445,4659,4848,5038,5051,5060-5061,5093,5168,5250,5351,5353,5355,5400,5405,5432-5433,5520-5521,5554-5555,5560,5580,5631-5632,5800,5900-5910,5920,6000,6050,6060,6070,6080,6101,6106,6112,6379,6405,6502-6504,6660,6667,6905,7080,7144,7210,7510,7579-7580,7700,7777,7787,7800-7801,8000,8008,8014,8028,8030,8080-8081,8087,8090,8180,8205,8222,8300,8303,8333,8400,8443-8444,8503,8800,8812,8880,8888-8890,8899,8901-8903,9000,9080-9081,9084,9090,9099,9111,9160,9152,9495,9809-9815,9999-10001,10008,10050,10098,10162,10202-10203,10443,10616,10628,11000,11099,11234,11333,12174,12203,12397,12401,13364,13500,13838,14330,15200,16102,17185,17200,18881,19300,19810,20031,20034,20101,20222,22222,23472,23791,23943,25000,25025,26000,26122,27000,27017,27888,28222,28784,30000,31099,32913,34443,35871,37718,38080,38292,41025,41523-41524,44334,44818,45230,46823-46824,47001-47002,48899,50000-50004,50013,50500-50504,57772,62078,62514,65535 -PU59428 -p1,7,9,13,21-23,25,37,42,49,53,69,79-81,105,109-111,113,123,135,137-139,143,161,179,222,264,384,389,407,443,445,465,500,502,512-515,523,540,548,554,617,623,689,705,783,902,910,912,921,993,995,1000,1024,1030,1035,1090,1098-1103,1129,1158,1199,1220,1234,1300,1311,1352,1433-1435,1440,1494,1521,1530,1533,1581-1582,1604,1720,1723,1755,1900,2000-2001,2049,2100,2103,2121,2199,2207,2222,2323,2380,2525,2533,2598,2638,2809,2947,2967,3000,3050,3057,3128,3273,3306,3389,3500,3628,3632,3690,3780,3790,4000,4444-4445,4659,4848,5038,5051,5060-5061,5093,5168,5250,5351,5353,5355,5400,5405,5432-5433,5520-5521,5554-5555,5560,5580,5631-5632,5800,5900-5910,5920,6000,6050,6060,6070,6080,6101,6106,6112,6379,6405,6502-6504,6660,6667,6905,7080,7144,7210,7510,7579-7580,7700,7777,7787,7800-7801,8000,8008,8014,8028,8030,8080-8081,8087,8090,8180,8205,8222,8300,8303,8333,8400,8443-8444,8503,8800,8812,8880,8888-8890,8899,8901-8903,9000,9080-9081,9084,9090,9099,9111,9160,9152,9495,9809-9815,9999-10001,10008,10050,10098,10162,10202-10203,10443,10616,10628,11000,11099,11234,11333,12174,12203,12397,12401,13364,13500,13838,14330,15200,16102,17185,17200,18881,19300,19810,20031,20034,20101,20222,22222,23472,23791,23943,25000,25025,26000,26122,27000,27017,27888,28222,28784,30000,31099,32913,34443,35871,37718,38080,38292,41025,41523-41524,44334,44818,45230,46823-46824,47001-47002,48899,50000-50004,50013,50500-50504,57772,62078,62514,65535 --host-timeout=10m --max-rtt-timeout=600ms --initial-rtt-timeout=300ms --min-rtt-timeout=300ms --max-retries=2 --min-rate=200 --stats-every 10s -g $sourceport -oN tmp}##############################################################################################################f_numhosts(){egrep -v '(close|filtered|initiated|latency|rDNS|seconds|STATE|Warning)' tmp | grep 'open' -B1 | grep 'Nmap' | cut -d '(' -f2 | cut -d ')' -f1 > tmp2sed 's/Nmap scan report for //' tmp2 > tmp3# Remove blank linessed '/^$/d' tmp3 > $name/hosts.txt# Check for zero hosts (empty file)if [ ! -s $name/hosts.txt ] ; thenrm -rf "$name" tmp* echoecho $line echoecho "***Scan complete.***" echoecho -e "\e[1;33mNo hosts found with open ports.\e[0m" echoechoexitfi# Number of hostsnumber=$(wc -l $name/hosts.txt | cut -d ' ' -f1)if [ $number -eq 1 ]; thenechoecho $line echoecho -e "\e[1;33mHost discovered.\e[0m"elseechoecho $line echoecho -e "\e[1;33m$number hosts discovered with open ports.\e[0m"fi}##############################################################################################################f_scan(){echoecho $lineechoecho -e "\e[1;34mRunning default nmap scan.\e[0m"nmap -iL $name/hosts.txt -Pn -n -sSV -sUV -p U:53,67-69,111,123,135,137-139,161,162,445,500,514,520,523,631,998,1434,1701,1900,4500,5353,6481,17185,31337,49152,49154,T:13,21-23,25,37,42,49,53,67,69,79-81,88,105,109-111,113,123,135,137-139,143,161,179,222,384,389,407,443,445,465,500,512-515,523,524,540,548,554,617,623,631,689,705,783,873,910,912,921,993,995,1000,1024,1050,1080,1099,1100,1158,1220,1300,1311,1344,1352,1433-1435,1494,1521,1524,1533,1581-1582,1604,1720,1723,1755,1900,2000,2049,2100,2103,2121,2202,2207,2222,2323,2380,2525,2533,2598,2628,2638,2947,2967,3000,3031,3050,3057,3128,3260,3306,3389,3500,3628,3632,3690,3780,3790,4000,4369,4445,5019,5051,5060-5061,5093,5168,5250,5353,5400,5405,5432-5433,5554-5555,5666,5672,5800,5850,5900-5910,5984,6000-6005,6050,6060,6070,6080,6101,6106,6112,6379,6405,6502-6504,6660,6666-6667,6697,7080,7144,7210,7510,7634,7777,7787,8000,8008-8009,8028,8030,8080-8081,8090,8091,8180,8222,8300,8332-8333,8400,8443-8444,8787,8800,8880,8888,8899,9080-9081,9090,9100,9111,9152,9160,9999-10000,10050,10202-10203,10443,10616,10628,11000,11211,12174,12203,12345,13500,14330,17185,18881,19150,19300,19810,20031,20222,22222,25000,25025,26000,26122,27017,28222,30000,35871,38292,39292,41025,41523-41524,41364,43729,44334,44813,48992,49663,50000-50004,50013,50030,50060,50070,50075,50090,55852,57772,59034,60010,60030,62078,62514,65535 --open -O --osscan-guess --max-os-tries 1 --version-intensity 0 --host-timeout 5m --min-hostgroup 100 --max-rtt-timeout 600ms --initial-rtt-timeout=300ms --min-rtt-timeout 300ms --max-retries 3 --min-rate 150 --stats-every 10s -g $sourceport -oA $name/nmap# Clean up nmap outputegrep -v '(1 hop|All|CPE|elapsed|filtered|fingerprint|guesses|GUESSING|hops|initiated|latency|matches|NEXT|Not|NSE|OS:|Please|remaining|RTTVAR|scanned|SF|Skipping|specialized|Starting|Timing|unrecognized|Warning|WARNING)' $name/nmap.nmap > tmpsed 's/Nmap scan report for //' tmp > tmp2sed '/^$/! b end; n; /^$/d; : end' tmp2 > $name/nmap.txtrm $name/nmap.nmap# Show open portsgrep 'open' $name/nmap.txt | awk '{print $1}' | sort -u | sort -n > $name/ports.txtgrep 'tcp' $name/ports.txt | cut -d '/' -f1 > $name/ports-tcp.txtgrep 'udp' $name/ports.txt | cut -d '/' -f1 > $name/ports-udp.txt# Clean up and show bannersgrep 'open' $name/nmap.txt | awk '{for (i=4;i<=NF;i++) {printf "%s%s",sep, $i;sep=" "}; printf "\n"}' | sort -u > tmpsed 's/^ //' tmp | sort -u > tmp2# Remove blank linessed '/^$/d' tmp2 > $name/banners.txt# Remove all empty filesfind $name/ -type f -empty -exec rm {} +}##############################################################################################################f_ports(){echoecho $lineechoecho -e "\e[1;34mLocating high-value ports.\e[0m"echo " TCP"TCP_PORTS="13 21 22 23 25 70 79 80 110 111 139 143 389 443 445 465 523 524 548 554 631 873 993 995 1050 1080 1099 1158 1344 1352 1433 1521 1720 1723 2202 2628 2947 3031 3260 3306 3389 3632 4369 5019 5432 5666 5672 5850 5900 5984 6000 6001 6002 6003 6004 6005 6379 6666 7210 7634 7777 8000 8009 8080 8081 8091 8222 8332 8333 8400 8443 9100 9160 9999 10000 11211 12345 19150 27017 35871 50000 50030 50060 50070 50075 50090 60010 60030"for i in $TCP_PORTS; docat $name/nmap.gnmap | grep "\<$i/open/tcp\>" | cut -d ' ' -f2 > $name/$i.txtdoneif [ -f $name/523.txt ]; thenmv $name/523.txt $name/523-tcp.txtfiecho " UDP"UDP_PORTS="53 67 69 123 137 161 500 523 1434 1604 3478 5353 6481 17185 31337"for i in $UDP_PORTS; docat $name/nmap.gnmap | grep "\<$i/open/udp\>" | cut -d ' ' -f2 > $name/$i.txtdoneif [ -f $name/523.txt ]; thenmv $name/523.txt $name/523-udp.txtfi# Combine Apache HBase ports and sortcat $name/60010.txt $name/60030.txt > tmpsort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 tmp > $name/apache-hbase.txt# Combine Bitcoin ports and sortcat $name/8332.txt $name/8333.txt > tmpsort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 tmp > $name/bitcoin.txt# Combine DB2 ports and sortcat $name/523-tcp.txt $name/523-udp.txt > tmpsort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 tmp > $name/db2.txt# Combine Hadoop ports and sortcat $name/50030.txt $name/50060.txt $name/50070.txt $name/50075.txt $name/50090.txt > tmpsort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 tmp > $name/hadoop.txt# Combine SSL portsecho > tmpport="21 25 443 465 993 995 8443"for i in $port; doif [ -f $name/$i.txt ]; thensed -e 's/$/:'$i'/' $name/$i.txt >> tmp fidone# Remove blank linessed '/^$/d' tmp > $name/ssl.txt# Combine web ports and sortcat $name/80.txt $name/443.txt $name/8000.txt $name/8080.txt $name/8443.txt > tmpsort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 tmp > $name/web.txt# Combine X11 ports and sortcat $name/6000.txt $name/6001.txt $name/6002.txt $name/6003.txt $name/6004.txt $name/6005.txt > tmpsort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 tmp > $name/x11.txt# Remove all empty filesfind $name/ -type f -empty -exec rm {} +}##############################################################################################################f_cleanup(){sed 's/Nmap scan report for //' tmp > tmp2# Remove lines that start with |, and have various numbers of trailing spaces.sed -i '/^| *$/d' tmp2egrep -v '(0 of 100|afp-serverinfo:|ACCESS_DENIED|appears to be clean|cannot|close|closed|Compressors|Could not|Couldn|Denied|denied|Did not|DISABLED|dns-nsid:|dns-service-discovery:|Document Moved|doesn|eppc-enum-processes|error|Error|ERROR|failed|filtered|GET|hbase-region-info:|HEAD|Host is up|Host script results|impervious|incorrect|latency|ldap-rootdse:|LDAP Results|Likely CLEAN|nbstat:|No accounts left|No Allow|no banner|none|Nope.|not allowed|Not Found|Not Shown|not supported|NOT VULNERABLE|nrpe-enum:|ntp-info:|rdp-enum-encryption:|remaining|rpcinfo:|seconds|See http|Service Info|Skipping|smb-check-vulns|smb-mbenum:|sorry|Starting|telnet-encryption:|Telnet server does not|TIMEOUT|Unauthorized|uncompressed|unhandled|Unknown|viewed over a secure|vnc-info:|wdb-version:)' tmp2 > tmp3grep -v "Can't" tmp3 > tmp4}##############################################################################################################f_scripts(){echoecho $lineechoecho -e "\e[1;34mRunning nmap scripts.\e[0m"# If the file for the corresponding port doesn't exist, skipif [ -f $name/13.txt ]; thenecho " Daytime"nmap -iL $name/13.txt -Pn -n --open -p13 --script=daytime --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-13.txtfiif [ -f $name/21.txt ]; thenecho " FTP"nmap -iL $name/21.txt -Pn -n --open -p21 --script=banner,ftp-anon,ftp-bounce,ftp-proftpd-backdoor,ftp-vsftpd-backdoor --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-21.txtfiif [ -f $name/22.txt ]; thenecho " SSH"nmap -iL $name/22.txt -Pn -n --open -p22 --script=ssh2-enum-algos,sshv1 --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-22.txtfiif [ -f $name/23.txt ]; thenecho " Telnet"nmap -iL $name/23.txt -Pn -n --open -p23 --script=banner,telnet-encryption --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-23.txtfiif [ -f $name/25.txt ]; thenecho " SMTP"nmap -iL $name/25.txt -Pn -n --open -p25 --script=banner,smtp-commands,smtp-open-relay,smtp-strangeport --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupprintf '%s\n' 'g/NOT VULNERABLE/d\' '-d' w | ed -s tmp4mv tmp4 $name/script-25.txtfiif [ -f $name/53.txt ]; thenecho " DNS"nmap -iL $name/53.txt -Pn -n -sU --open -p53 --script=dns-cache-snoop,dns-nsid,dns-random-srcport,dns-random-txid,dns-recursion,dns-service-discovery,dns-update,dns-zone-transfer --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-53.txtfiif [ -f $name/67.txt ]; thenecho " DHCP"nmap -iL $name/67.txt -Pn -n -sU --open -p67 --script=dhcp-discover --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-67.txtfiif [ -f $name/70.txt ]; thenecho " Gopher"nmap -iL $name/70.txt -Pn -n --open -p70 --script=gopher-ls --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-70.txtfiif [ -f $name/79.txt ]; thenecho " Finger"nmap -iL $name/79.txt -Pn -n --open -p79 --script=finger --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-79.txtfiif [ -f $name/110.txt ]; thenecho " POP3"nmap -iL $name/110.txt -Pn -n --open -p110 --script=banner,pop3-capabilities --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-110.txtfiif [ -f $name/111.txt ]; thenecho " NFS"nmap -iL $name/111.txt -Pn -n --open -p111 --script=nfs-ls,nfs-showmount,nfs-statfs,rpcinfo --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-111.txtfiif [ -f $name/123.txt ]; thenecho " NTP"nmap -iL $name/123.txt -Pn -n -sU --open -p123 --script=ntp-info,ntp-monlist --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-123.txtfiif [ -f $name/137.txt ]; thenecho " NetBIOS"nmap -iL $name/137.txt -Pn -n -sU --open -p137 --script=nbstat --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupsed -i '/^MAC/{n; /.*/d}' tmp4 # Find lines that start with MAC, and delete the following linesed -i '/^137\/udp/{n; /.*/d}' tmp4 # Find lines that start with 137/udp, and delete the following linemv tmp4 $name/script-137.txtfiif [ -f $name/139.txt ]; thenecho " MS08-067"nmap -iL $name/139.txt -Pn -n --open -p139 --script=smb-check-vulns --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupegrep -v '(SERVICE|netbios)' tmp4 > tmp5sed '1N;N;/\(.*\n\)\{2\}.*VULNERABLE/P;$d;D' tmp5sed '/^$/d' tmp5 > tmp6grep -v '|' tmp6 > $name/script-ms08-067.txtfiif [ -f $name/143.txt ]; thenecho " IMAP"nmap -iL $name/143.txt -Pn -n --open -p143 --script=imap-capabilities --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-143.txtfiif [ -f $name/161.txt ]; thenecho " SNMP"nmap -iL $name/161.txt -Pn -n -sU --open -p161 --script=snmp-hh3c-logins,snmp-interfaces,snmp-netstat,snmp-processes,snmp-sysdescr,snmp-win32-services,snmp-win32-shares,snmp-win32-software,snmp-win32-users --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-161.txtfiif [ -f $name/389.txt ]; thenecho " LDAP"nmap -iL $name/389.txt -Pn -n --open -p389 --script=ldap-rootdse --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-389.txtfiif [ -f $name/445.txt ]; thenecho " SMB"nmap -iL $name/445.txt -Pn -n --open -p445 --script=msrpc-enum,smb-enum-domains,smb-enum-groups,smb-enum-processes,smb-enum-sessions,smb-enum-shares,smb-enum-users,smb-mbenum,smb-os-discovery,smb-security-mode,smb-server-stats,smb-system-info,smbv2-enabled,stuxnet-detect --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupsed -i '/^445/{n; /.*/d}' tmp4 # Find lines that start with 445, and delete the following linemv tmp4 $name/script-445.txtfiif [ -f $name/465.txt ]; thenecho " SMTP/S"nmap -iL $name/465.txt -Pn -n --open -p465 --script=banner,smtp-commands,smtp-open-relay,smtp-strangeport,smtp-enum-users --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupprintf '%s\n' 'g/NOT VULNERABLE/d\' '-d' w | ed -s tmp4mv tmp4 $name/script-465.txtfiif [ -f $name/500.txt ]; thenecho " Ike"nmap -iL $name/500.txt -Pn -n -sS -sU --open -p500 --script=ike-version --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-500.txtfiif [ -f $name/db2.txt ]; thenecho " DB2"nmap -iL $name/db2.txt -Pn -n -sS -sU --open -p523 --script=db2-das-info,db2-discover --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-523.txtfiif [ -f $name/524.txt ]; thenecho " Novell NetWare Core Protocol"nmap -iL $name/524.txt -Pn -n --open -p524 --script=ncp-enum-users,ncp-serverinfo --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-524.txtfiif [ -f $name/548.txt ]; thenecho " AFP"nmap -iL $name/548.txt -Pn -n --open -p548 --script=afp-ls,afp-path-vuln,afp-serverinfo,afp-showmount --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-548.txtfiif [ -f $name/554.txt ]; thenecho " RTSP"nmap -iL $name/554.txt -Pn -n --open -p554 --script=rtsp-methods --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-554.txtfiif [ -f $name/631.txt ]; thenecho " CUPS"nmap -iL $name/631.txt -Pn -n --open -p631 --script=cups-info,cups-queue-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-631.txtfiif [ -f $name/873.txt ]; thenecho " rsync"nmap -iL $name/873.txt -Pn -n --open -p873 --script=rsync-list-modules --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-873.txtfiif [ -f $name/993.txt ]; thenecho " IMAP/S"nmap -iL $name/993.txt -Pn -n --open -p993 --script=banner,sslv2,imap-capabilities --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-993.txtfiif [ -f $name/995.txt ]; thenecho " POP3/S"nmap -iL $name/995.txt -Pn -n --open -p995 --script=banner,sslv2,pop3-capabilities --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-995.txtfiif [ -f $name/1050.txt ]; thenecho " COBRA"nmap -iL $name/1050.txt -Pn -n --open -p1050 --script=giop-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1050.txtfiif [ -f $name/1080.txt ]; thenecho " SOCKS"nmap -iL $name/1080.txt -Pn -n --open -p1080 --script=socks-auth-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1080.txtfiif [ -f $name/1099.txt ]; thenecho " RMI Registry"nmap -iL $name/1099.txt -Pn -n --open -p1099 --script=rmi-dumpregistry --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1099.txtfiif [ -f $name/1344.txt ]; thenecho " ICAP"nmap -iL $name/1344.txt -Pn -n --open -p1344 --script=icap-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1344.txtfiif [ -f $name/1352.txt ]; thenecho " Lotus Domino"nmap -iL $name/1352.txt -Pn -n --open -p1352 --script=domino-enum-users --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1352.txtfiif [ -f $name/1433.txt ]; thenecho " MS-SQL"nmap -iL $name/1433.txt -Pn -n --open -p1433 --script=ms-sql-dump-hashes,ms-sql-empty-password,ms-sql-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1433.txtfiif [ -f $name/1434.txt ]; thenecho " MS-SQL UDP"nmap -iL $name/1434.txt -Pn -n -sU --open -p1434 --script=ms-sql-dac --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1434.txtfiif [ -f $name/1521.txt ]; thenecho " Oracle"nmap -iL $name/1521.txt -Pn -n --open -p1521 --script=oracle-sid-brute --script oracle-enum-users --script-args oracle-enum-users.sid=ORCL,userdb=orausers.txt --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1521.txtfiif [ -f $name/1604.txt ]; thenecho " Citrix"nmap -iL $name/1604.txt -Pn -n -sU --open -p1604 --script=citrix-enum-apps,citrix-enum-servers --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1604.txtfiif [ -f $name/1723.txt ]; thenecho " PPTP"nmap -iL $name/1723.txt -Pn -n --open -p1723 --script=pptp-version --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-1723.txtfiif [ -f $name/2202.txt ]; thenecho " ACARS"nmap -iL $name/2202.txt -Pn -n --open -p2202 --script=acarsd-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-2202.txtfiif [ -f $name/2628.txt ]; thenecho " DICT"nmap -iL $name/2628.txt -Pn -n --open -p2628 --script=dict-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-2628.txtfiif [ -f $name/2947.txt ]; thenecho " GPS"nmap -iL $name/2947.txt -Pn -n --open -p2947 --script=gpsd-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-2947.txtfiif [ -f $name/3031.txt ]; thenecho " Apple Remote Event"nmap -iL $name/3031.txt -Pn -n --open -p3031 --script=eppc-enum-processes --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-3031.txtfiif [ -f $name/3260.txt ]; thenecho " iSCSI"nmap -iL $name/3260.txt -Pn -n --open -p3260 --script=iscsi-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-3260.txtfiif [ -f $name/3306.txt ]; thenecho " MySQL"nmap -iL $name/3306.txt -Pn -n --open -p3306 --script=mysql-databases,mysql-empty-password,mysql-info,mysql-users,mysql-variables --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-3306.txtfiif [ -f $name/3389.txt ]; thenecho " Remote Desktop"nmap -iL $name/3389.txt -Pn -n --open -p3389 --script=rdp-vuln-ms12-020,rdp-enum-encryption --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupegrep -v '(attackers|Description|Disclosure|http|References|Risk factor)' tmp4 > $name/script-3389.txtfiif [ -f $name/3478.txt ]; thenecho " STUN"nmap -iL $name/3478.txt -Pn -n -sU --open -p3478 --script=stun-version --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-3478.txtfiif [ -f $name/3632.txt ]; thenecho " Distributed Compiler Daemon"nmap -iL $name/3632.txt -Pn -n --open -p3632 --script=distcc-cve2004-2687 --script-args="distcc-exec.cmd='id'" --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanup egrep -v '(IDs|Risk factor|Description|Allows|earlier|Disclosure|Extra|References|http)' tmp4 > $name/script-3632.txtfiif [ -f $name/4369.txt ]; thenecho " Erlang Port Mapper"nmap -iL $name/4369.txt -Pn -n --open -p4369 --script=epmd-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-4369.txtfiif [ -f $name/5019.txt ]; thenecho " Versant"nmap -iL $name/5019.txt -Pn -n --open -p5019 --script=versant-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-5019.txtfiif [ -f $name/5353.txt ]; thenecho " DNS Service Discovery"nmap -iL $name/5353.txt -Pn -n -sU --open -p5353 --script=dns-service-discovery --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-5353.txtfiif [ -f $name/5666.txt ]; thenecho " Nagios"nmap -iL $name/5666.txt -Pn -n --open -p5666 --script=nrpe-enum --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-5666.txtfiif [ -f $name/5672.txt ]; thenecho " AMQP"nmap -iL $name/5672.txt -Pn -n --open -p5672 --script=amqp-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-5672.txtfiif [ -f $name/5850.txt ]; thenecho " OpenLookup"nmap -iL $name/5850.txt -Pn -n --open -p5850 --script=openlookup-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-5850.txtfiif [ -f $name/5900.txt ]; thenecho " VNC"nmap -iL $name/5900.txt -Pn -n --open -p5900 --script=realvnc-auth-bypass,vnc-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-5900.txtfiif [ -f $name/5984.txt ]; thenecho " CouchDB"nmap -iL $name/5984.txt -Pn -n --open -p5984 --script=couchdb-databases,couchdb-stats --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-5984.txtfiif [ -f $name/x11.txt ]; thenecho " X11"nmap -iL $name/x11.txt -Pn -n --open -p6000-6005 --script=x11-access --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-x11.txtfiif [ -f $name/6379.txt ]; thenecho " Redis"nmap -iL $name/6379.txt -Pn -n --open -p6379 --script=redis-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-6379.txtfiif [ -f $name/6481.txt ]; thenecho " Sun Service Tags"nmap -iL $name/6481.txt -Pn -n -sU --open -p6481 --script=servicetags --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-6481.txtfiif [ -f $name/6666.txt ]; thenecho " Voldemort"nmap -iL $name/6666.txt -Pn -n --open -p6666 --script=voldemort-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-6666.txtfiif [ -f $name/7210.txt ]; thenecho " Max DB"nmap -iL $name/7210.txt -Pn -n --open -p7210 --script=maxdb-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-7210.txtfiif [ -f $name/7634.txt ]; thenecho " Hard Disk Info"nmap -iL $name/7634.txt -Pn -n --open -p7634 --script=hddtemp-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-7634.txtfi#if [ -f $name/8009.txt ]; then# echo " AJP"# nmap -iL $name/8009.txt -Pn -n --open -p8009 --script=ajp-methods,ajp-request --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmp# f_cleanup# mv tmp4 $name/script-8009.txt#fiif [ -f $name/8081.txt ]; thenecho " McAfee ePO"nmap -iL $name/8081.txt -Pn -n --open -p8081 --script=mcafee-epo-agent --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-8081.txtfiif [ -f $name/8091.txt ]; thenecho " CouchBase Web Administration"nmap -iL $name/8091.txt -Pn -n --open -p8091 --script=membase-http-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-8091.txtfiif [ -f $name/bitcoin.txt ]; thenecho " Bitcoin"nmap -iL $name/bitcoin.txt -Pn -n --open -p8332,8333 --script=bitcoin-getaddr,bitcoin-info,bitcoinrpc-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-bitcoin.txtfiif [ -f $name/9100.txt ]; thenecho " Lexmark"nmap -iL $name/9100.txt -Pn -n --open -p9100 --script=lexmark-config --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-9100.txtfiif [ -f $name/9160.txt ]; thenecho " Cassandra"nmap -iL $name/9160.txt -Pn -n --open -p9160 --script=cassandra-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-9160.txtfiif [ -f $name/9999.txt ]; thenecho " Java Debug Wire Protocol"nmap -iL $name/9999.txt -Pn -n --open -p9999 --script=jdwp-version --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-9999.txtfiif [ -f $name/10000.txt ]; thenecho " Network Data Management"nmap -iL $name/10000.txt -Pn -n --open -p10000 --script=ndmp-fs-info,ndmp-version --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-10000.txtfiif [ -f $name/11211.txt ]; thenecho " Memory Object Caching"nmap -iL $name/11211.txt -Pn -n --open -p11211 --script=memcached-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-11211.txtfiif [ -f $name/12345.txt ]; thenecho " NetBus"nmap -iL $name/12345.txt -Pn -n --open -p12345 --script=netbus-auth-bypass,netbus-version --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-12345.txtfiif [ -f $name/17185.txt ]; thenecho " VxWorks"nmap -iL $name/17185.txt -Pn -n -sU --open -p17185 --script=wdb-version --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-17185.txtfiif [ -f $name/19150.txt ]; thenecho " GKRellM"nmap -iL $name/19150.txt -Pn -n --open -p19150 --script=gkrellm-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-19150.txtfiif [ -f $name/27017.txt ]; thenecho " MongoDB"nmap -iL $name/27017.txt -Pn -n --open -p27017 --script=mongodb-databases,mongodb-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-27017.txtfiif [ -f $name/31337.txt ]; thenecho " BackOrifice"nmap -iL $name/31337.txt -Pn -n -sU --open -p31337 --script=backorifice-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-31337.txtfiif [ -f $name/35871.txt ]; thenecho " Flume"nmap -iL $name/35871.txt -Pn -n --open -p35871 --script=flume-master-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-35871.txtfiif [ -f $name/50000.txt ]; thenecho " DRDA"nmap -iL $name/50000.txt -Pn -n --open -p50000 --script=drda-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-50000.txtfiif [ -f $name/hadoop.txt ]; thenecho " Hadoop"nmap -iL $name/hadoop.txt -Pn -n --open -p50030,50060,50070,50075,50090 --script=hadoop-datanode-info,hadoop-jobtracker-info,hadoop-namenode-info,hadoop-secondary-namenode-info,hadoop-tasktracker-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-hadoop.txtfiif [ -f $name/apache-hbase.txt ]; thenecho " Apache HBase"nmap -iL $name/apache-hbase.txt -Pn -n --open -p60010,60030 --script=hbase-master-info,hbase-region-info --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupmv tmp4 $name/script-apache-hbase.txtfiif [ -f $name/web.txt ]; thenecho " Web"nmap -iL $name/web.txt -Pn -n --open -p80,443,8000,8080,8443 --script=http-methods --host-timeout 5m --min-hostgroup 100 -g $sourceport > tmpf_cleanupegrep -v '(html|No Allow|Potentially)' tmp4 > $name/script-web.txtfirm tmp*for x in $name/./script*; doif grep '|' $x > /dev/null 2>&1; thenecho > /dev/null 2>&1 elserm $x > /dev/null 2>&1 fidone}##############################################################################################################f_metasploit(){echoecho $lineechoecho -ne "\e[1;33mRun matching Metasploit auxilaries? (y/N) \e[0m"read msfif [ -z $msf ]; thenmsf="n"fimsf="$(echo ${msf} | tr 'A-Z' 'a-z')"if [ $msf == "y" ]; thenf_runmsfelsef_reportfi}##############################################################################################################f_runmsf(){echoecho -e "\e[1;34mStarting Metasploit, this takes about 15 sec.\e[0m"echo workspace -a $name > $name/master.rc# If the file for the corresponding port doesn't exist, skipif [ -f $name/21.txt ]; thenecho " FTP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/21.txt/g" /opt/scripts/resource/ftp.rc cat resource/ftp.rc >> $name/master.rcfiif [ -f $name/22.txt ]; thenecho " SSH" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/22.txt/g" /opt/scripts/resource/ssh.rc cat resource/ssh.rc >> $name/master.rcfiif [ -f $name/23.txt ]; thenecho " Telnet" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/23.txt/g" /opt/scripts/resource/telnet.rc cat resource/telnet.rc >> $name/master.rcfiif [ -f $name/25.txt ]; thenecho " SMTP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/25.txt/g" /opt/scripts/resource/smtp.rc cat resource/smtp.rc >> $name/master.rcfiif [ -f $name/69.txt ]; thenecho " TFTP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/69.txt/g" /opt/scripts/resource/tftp.rc cat resource/tftp.rc >> $name/master.rcfiif [ -f $name/79.txt ]; thenecho " Finger" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/79.txt/g" /opt/scripts/resource/finger.rc cat resource/finger.rc >> $name/master.rcfiif [ -f $name/110.txt ]; thenecho " POP3" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/110.txt/g" /opt/scripts/resource/pop3.rc cat resource/pop3.rc >> $name/master.rcfiif [ -f $name/111.txt ]; thenecho " NFS" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/111.txt/g" /opt/scripts/resource/nfs.rc cat resource/nfs.rc >> $name/master.rcfiif [ -f $name/123.txt ]; thenecho " NTP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/123.txt/g" /opt/scripts/resource/ntp.rc cat resource/ntp.rc >> $name/master.rcfiif [ -f $name/137.txt ]; thenecho " NetBIOS" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/137.txt/g" /opt/scripts/resource/netbios.rc cat resource/netbios.rc >> $name/master.rcfiif [ -f $name/143.txt ]; thenecho " IMAP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/143.txt/g" /opt/scripts/resource/imap.rc cat resource/imap.rc >> $name/master.rcfiif [ -f $name/161.txt ]; thenecho " SNMP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/161.txt/g" /opt/scripts/resource/snmp.rc cat resource/snmp.rc >> $name/master.rcfiif [ -f $name/445.txt ]; thenecho " SMB" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/445.txt/g" /opt/scripts/resource/smb.rc cat resource/smb.rc >> $name/master.rcfiif [ -f $name/465.txt ]; thenecho " SMTP/S" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/465.txt/g" /opt/scripts/resource/smtp-s.rc cat resource/smtp-s.rc >> $name/master.rcfiif [ -f $name/523.txt ]; thenecho " db2" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/523.txt/g" /opt/scripts/resource/db2.rc cat resource/db2.rc >> $name/master.rcfiif [ -f $name/548.txt ]; thenecho " AFP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/548.txt/g" /opt/scripts/resource/afp.rc cat resource/afp.rc >> $name/master.rcfiif [ -f $name/1099.txt ]; thenecho " RMI Registery" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/1099.txt/g" /opt/scripts/resource/rmi.rc cat resource/rmi.rc >> $name/master.rcfiif [ -f $name/1158.txt ]; thenecho " Oracle" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/1158.txt/g" /opt/scripts/resource/oracle.rc cat resource/oracle.rc >> $name/master.rcfiif [ -f $name/1433.txt ]; thenecho " MS-SQL" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/1433.txt/g" /opt/scripts/resource/mssql.rc cat resource/mssql.rc >> $name/master.rcfiif [ -f $name/1521.txt ]; thenecho " Oracle 2" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/1521.txt/g" /opt/scripts/resource/oracle2.rc cat resource/oracle2.rc >> $name/master.rcfiif [ -f $name/1604.txt ]; thenecho " Citrix" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/1604.txt/g" /opt/scripts/resource/citrix.rc cat resource/citrix.rc >> $name/master.rcfiif [ -f $name/1720.txt ]; thenecho " H323" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/1720.txt/g" /opt/scripts/resource/h323.rc cat resource/h323.rc >> $name/master.rcfiif [ -f $name/3306.txt ]; thenecho " MySQL" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/3306.txt/g" /opt/scripts/resource/mysql.rc cat resource/mysql.rc >> $name/master.rcfiif [ -f $name/5432.txt ]; thenecho " Postgres" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/5432.txt/g" /opt/scripts/resource/postgres.rc cat resource/postgres.rc >> $name/master.rcfiif [ -f $name/5900.txt ]; thenecho " VNC" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/5900.txt/g" /opt/scripts/resource/vnc.rc cat resource/vnc.rc >> $name/master.rcfiif [ -f $name/x11.txt ]; thenecho " x11" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/x11.txt/g" /opt/scripts/resource/x11.rc cat resource/x11.rc >> $name/master.rcfiif [ -f $name/7777.txt ]; thenecho " Energizer Duo" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/7777.txt/g" /opt/scripts/resource/energizer-duo.rc cat resource/energizer-duo.rc >> $name/master.rcfiif [ -f $name/8080.txt ]; thenecho " Tomcat" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/8080.txt/g" /opt/scripts/resource/tomcat.rc cat resource/tomcat.rc >> $name/master.rcfiif [ -f $name/8222.txt ]; thenecho " VMware" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/8222.txt/g" /opt/scripts/resource/vmware.rc cat resource/vmware.rc >> $name/master.rcfiif [ -f $name/8400.txt ]; thenecho " Adobe" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/8400.txt/g" /opt/scripts/resource/adobe.rc cat resource/adobe.rc >> $name/master.rcfiif [ -f $name/9999.txt ]; thenecho " Telnet 2" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/9999.txt/g" /opt/scripts/resource/telnet2.rc cat resource/telnet2.rc >> $name/master.rcfiif [ -f $name/17185.txt ]; thenecho " VxWorks" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/17185.txt/g" /opt/scripts/resource/vxworks.rc cat resource/vxworks.rc >> $name/master.rcfiif [ -f $name/50000.txt ]; thenecho " db2 version" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/50000.txt/g" /opt/scripts/resource/db2-version.rc cat resource/db2-version.rc >> $name/master.rcfiif [ -f $name/web.txt ]; thenecho " HTTP" sed -i "s/^setg RHOSTS.*/setg RHOSTS file:\/opt\/scripts\/$name\/web.txt/g" /opt/scripts/resource/http-short.rc cat resource/http-short.rc >> $name/master.rcfi# services -c port,proto,name,info -o /root/test.csv# hosts -c address,name,os_name,os_flavor,os_sp -o /root/test2.csvecho db_export -f xml -a $name/metasploit.xml >> $name/master.rcecho db_import $name/nmap.xml >> $name/master.rcecho exit >> $name/master.rcx=$(wc -l $name/master.rc | cut -d ' ' -f1)if [ $x -eq 3 ]; thenrm $name/master.rcelsemsfconsole -r /opt/scripts/$name/master.rc rm $name/master.rcfif_report}##############################################################################################################f_report(){END=$(date +%r\ %Z)filename=$name/report.txthost=$(wc -l $name/hosts.txt | cut -d ' ' -f1)echo "Discover Report" > $filenameecho "$name" >> $filenamedate +%A" - "%B" "%d", "%Y >> $filenameecho >> $filenameecho "Start time - $START" >> $filenameecho "Finish time - $END" >> $filenameecho "Scanner IP - $ip" >> $filenamenmap -V | grep 'version' | cut -d ' ' -f1-3 >> $filenameecho >> $filenameecho $line >> $filenameecho >> $filenameif [ -f $name/script-ms08-067.txt ]; thenecho "May be vulnerable to MS08-067." >> $filename echo >> $filename cat $name/script-ms08-067.txt >> $filename echo >> $filename echo $line >> $filename echo >> $filenamefiif [ $host -eq 1 ]; thenecho "1 host discovered." >> $filename echo >> $filename echo $line >> $filename echo >> $filename cat $name/nmap.txt >> $filename echo $line >> $filename echo $line >> $filename echo >> $filename echo "Nmap Scripts" >> $filename SCRIPTS="script-13 script-21 script-22 script-23 script-25 script-53 script-67 script-70 script-79 script-110 script-111 script-123 script-137 script-143 script-161 script-389 script-445 script-465 script-500 script-523 script-524 script-548 script-554 script-631 script-873 script-993 script-995 script-1050 script-1080 script-1099 script-1344 script-1352 script-1433 script-1434 script-1521 script-1604 script-1723 script-2202 script-2628 script-2947 script-3031 script-3260 script-3306 script-3389 script-3478 script-3632 script-4369 script-5019 script-5353 script-5666 script-5672 script-5850 script-5900 script-5984 script-x11 script-6379 script-6481 script-6666 script-7210 script-7634 script-8009 script-8081 script-8091 script-bitcoin script-9100 script-9160 script-9999 script-10000 script-11211 script-12345 script-17185 script-19150 script-27017 script-31337 script-35871 script-50000 script-hadoop script-apache-hbase script-web" for i in $SCRIPTS; doif [ -f $name/"$i.txt" ]; thencat $name/"$i.txt" >> $filename echo $line >> $filename fidonemv $name /$user/ START=0 END=0 echoecho $lineechoecho "***Scan complete.***" echoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/$name/report.txt echoechoexitfiecho "Hosts Discovered ($host)" >> $filenameecho >> $filenamecat $name/hosts.txt >> $filenameecho >> $filenameif [ ! -s $name/ports.txt ]; thenechoecho $line echoecho "***Scan complete.***" echoecho -e "\e[1;33mNo hosts found with open ports.\e[0m" echoechoexitelseports=$(wc -l $name/ports.txt | cut -d ' ' -f1)fiecho $line >> $filenameecho >> $filenameecho "Open Ports ($ports)" >> $filenameecho >> $filenameif [ -s $name/ports-tcp.txt ]; thenecho "TCP Ports" >> $filename cat $name/ports-tcp.txt >> $filename echo >> $filenamefiif [ -s $name/ports-udp.txt ]; thenecho "UDP Ports" >> $filename cat $name/ports-udp.txt >> $filename echo >> $filenamefiecho $line >> $filenameif [ -f $name/banners.txt ]; thenbanners=$(wc -l $name/banners.txt | cut -d ' ' -f1) echo >> $filename echo "Banners ($banners)" >> $filename echo >> $filename cat $name/banners.txt >> $filename echo >> $filename echo $line >> $filenamefiecho >> $filenameecho "High Value Hosts by Port" >> $filenameecho >> $filenameHVPORTS="13 21 22 23 25 53 67 69 70 79 80 110 111 123 137 139 143 161 389 443 445 465 500 523 524 548 554 631 873 993 995 1050 1080 1099 1158 1344 1352 1433 1434 1521 1604 1720 1723 2202 2628 2947 3031 3260 3306 3389 3478 3632 4369 5019 5353 5432 5666 5672 5850 5900 5984 6000 6001 6002 6003 6004 6005 6379 6481 6666 7210 7634 7777 8000 8009 8080 8081 8091 8222 8332 8333 8400 8443 9100 9160 9999 10000 11211 12345 17185 19150 27017 31337 35871 50000 50030 50060 50070 50075 50090 60010 60030"for i in $HVPORTS; doif [ -f $name/$i.txt ]; thenecho "Port $i" >> $filename cat $name/$i.txt >> $filename echo >> $filename fidoneecho $line >> $filenameecho >> $filenamecat $name/nmap.txt >> $filenameecho $line >> $filenameecho $line >> $filenameecho >> $filenameecho "Nmap Scripts" >> $filenameSCRIPTS="script-13 script-21 script-22 script-23 script-25 script-53 script-67 script-70 script-79 script-110 script-111 script-123 script-137 script-143 script-161 script-389 script-445 script-465 script-500 script-523 script-524 script-548 script-554 script-631 script-873 script-993 script-995 script-1050 script-1080 script-1099 script-1344 script-1352 script-1433 script-1434 script-1521 script-1604 script-1723 script-2202 script-2628 script-2947 script-3031 script-3260 script-3306 script-3389 script-3478 script-3632 script-4369 script-5019 script-5353 script-5666 script-5672 script-5850 script-5900 script-5984 script-x11 script-6379 script-6481 script-6666 script-7210 script-7634 script-8009 script-8081 script-8091 script-bitcoin script-9100 script-9160 script-9999 script-10000 script-11211 script-12345 script-17185 script-19150 script-27017 script-31337 script-35871 script-50000 script-hadoop script-apache-hbase script-web"for i in $SCRIPTS; doif [ -f $name/"$i.txt" ]; thencat $name/"$i.txt" >> $filename echo $line >> $filename fidoneecho >> $filenamemv $name /$user/START=0END=0echoecho $lineechoecho "***Scan complete.***"echoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/$name/report.txtechoechoexit}##############################################################################################################f_multitabs(){f_runlocallyclearf_bannerecho -e "\e[1;34mOpen multiple tabs in Firefox with:\e[0m"echoecho "1. List containing IPs and/or URLs."echo "2. Directories from a domain's robot.txt."echo "3. Previous menu"echoecho -n "Choice: "read choicecase $choice in 1) f_location echo -n "Port (default 80): " read port # Check if port is a number echo "$port" | grep -E "^[0-9]+$" 2>/dev/null isnum=$? if [ $isnum -ne 0 ] && [ ${#port} -gt 0 ]; thenf_error fiif [ ${#port} -eq 0 ]; thenport=80 fiif [ $port -lt 1 ] || [ $port -gt 65535 ]; thenf_error fifirefox & sleep 2 if [ $port -eq 21 ]; thenfor i in $(cat $location); dofirefox -new-tab ftp://$i & sleep 1 doneelif [ $port -eq 80 ]; thenfor i in $(cat $location); dofirefox -new-tab $i & sleep 1 doneelif [ $port -eq 443 ]; thenfor i in $(cat $location); dofirefox -new-tab https://$i & sleep 1 doneelsefor i in $(cat $location); dofirefox -new-tab $i:$port & sleep 1 donefi ;; 2) echoecho $line echoecho "Usage: target.com or target-IP" echoecho -n "Domain: " read domain # Check for no answer if [ -z $domain ]; thenf_error fiwget -q $domain/robots.txt grep 'Disallow' robots.txt | awk '{print $2}' > /$user/$domain-robots.txt rm robots.txt firefox & sleep 2 for i in $(cat /$user/$domain-robots.txt); dofirefox -new-tab $domain$i & sleep 1 doneechoecho $line echoecho "***Scan complete.***" echoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/$domain-robots.txt echoechoexit ;; 3) f_main;; *) f_error;;esac}##############################################################################################################f_nikto(){f_runlocallyclearf_bannerecho -e "\e[1;34mRun multiple instances of Nikto in parallel against a list of IP addresses.\e[0m"echo -e "\e[1;34mAs scans complete, the tabs will close.\e[0m"echoecho "1. List of IPs."echo "2. List of IP:port."echo "3. Previous menu"echoecho -n "Choice: "read choicecase $choice in 1) f_location echoecho -n "Port (default 80): " read port echo # Check if port is a number echo "$port" | grep -E "^[0-9]+$" 2>/dev/null isnum=$? if [ $isnum -ne 0 ] && [ ${#port} -gt 0 ]; thenf_error fiif [ ${#port} -eq 0 ]; thenport=80 fiif [ $port -lt 1 ] || [ $port -gt 65535 ]; thenf_error fimkdir /$user/nikto while read -r line; doxdotool key ctrl+shift+t sleep 1 xdotool type "cd /pentest/web/nikto/program/ && ./nikto.pl -h $line -port $port -Format htm --output /$user/nikto/$line.htm ; exit" xdotool key Return done < "$location" ;; 2) f_location mkdir /$user/nikto while IFS=: read -r host port; doxdotool key ctrl+shift+t sleep 1 xdotool type "cd /pentest/web/nikto/program/ && ./nikto.pl -h $host -port $port -Format htm --output /root/nikto/$host-$port.htm ; exit" xdotool key Return done < "$location" ;; 3) f_main;; *) f_error;;esacechoecho $lineechoecho "***Scan complete.***"echoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/nikto/echoechoexit}############################################################################################################### Jason# Need a better way to see if a host is live and has an SSL port open. Try using nmap -p 443.# Need a better way to locate hosts running SSL on alternate ports. Try using the nmap.grep file.f_sslcheck(){clearf_bannerecho -e "\e[1;34mCheck for SSL certificate issues.\e[0m"f_locationdate2stamp(){date --utc --date "$1" +%s}stamp2date(){date --utc --date "1970-01-01 $1 sec" "+%Y-%m-%d %T"}datediff(){case $1 in -s) sec=1; shift;; -m) sec=60; shift;; -h) sec=3600; shift;; -d) sec=86400; shift;; *) sec=86400;;esacdte1=$(date2stamp $1)dte2=$(date2stamp $2)diffSec=$((dte2-dte1))if ((diffSec < 0)); thenabs=-1elseabs=1fiecho $((diffSec/sec*abs))}monthconv(){if [ "$1" == "Jan" ]; then monthnum="01"; fiif [ "$1" == "Feb" ]; then monthnum="02"; fiif [ "$1" == "Mar" ]; then monthnum="03"; fiif [ "$1" == "Apr" ]; then monthnum="04"; fiif [ "$1" == "May" ]; then monthnum="05"; fiif [ "$1" == "Jun" ]; then monthnum="06"; fiif [ "$1" == "Jul" ]; then monthnum="07"; fiif [ "$1" == "Aug" ]; then monthnum="08"; fiif [ "$1" == "Sep" ]; then monthnum="09"; fiif [ "$1" == "Oct" ]; then monthnum="10"; fiif [ "$1" == "Nov" ]; then monthnum="11"; fiif [ "$1" == "Dec" ]; then monthnum="12"; fi}# Number of hostsnumber=$(wc -l $location | cut -d ' ' -f1)N=0echoecho "Scanning $number IP addresses."echoecho > tmp-reportecho >> tmp-reportecho "SSL Report" >> tmp-reportreportdate=$(date +%A" - "%B" "%d", "%Y)echo $reportdate >> tmp-reportecho sslscan $(sslscan | grep 'Version' | awk '{print $2}') >> tmp-reportecho >> tmp-reportecho $line >> tmp-reportecho >> tmp-reportwhile read -r line; do # Initialize ssl_$line.txt file echo "$line" > ssl_$line.txt N=$((N+1)) sslscan --no-failed $line > ssltmp_$line & pid=$! # echo "pid = $pid" # debug statement echo -n "$line [$N/$number] "; sleep 40 echo >> ssl_$line.txt if [ -s ssltmp_$line ]; thenERRORCHECK=$(cat ssltmp_$line | grep 'ERROR:') if [[ ! $ERRORCHECK ]]; thenISSUER=$(cat ssltmp_$line | grep 'Issuer:') if [[ $ISSUER ]]; thencat ssltmp_$line | grep 'Issuer:' >> ssl_$line.txt echo >> ssl_$line.txt elseecho "Issuer information not available for this certificate. Look into this!" >> ssl_$line.txt echo >> ssl_$line.txt fiSUBJECT=$(cat ssltmp_$line | grep 'Subject:') if [[ $SUBJECT ]]; thencat ssltmp_$line | grep 'Subject:' >> ssl_$line.txt echo >> ssl_$line.txt elseecho "Certificate subject information not available. Look into this!" >> ssl_$line.txt echo >> ssl_$line.txt fiDNS=$(cat ssltmp_$line | grep 'DNS:') if [[ $DNS ]]; thencat ssltmp_$line | grep 'DNS:' >> ssl_$line.txt echo >> ssl_$line.txt fiA=$(cat ssltmp_$line | grep -i 'MD5WithRSAEncryption') if [[ $A ]]; thenecho [*] MD5-based Signature in TLS/SSL Server X.509 Certificate >> ssl_$line.txt cat ssltmp_$line | grep -i 'MD5WithRSAEncryption' >> ssl_$line.txt echo >> ssl_$line.txt fiB=$(cat ssltmp_$line | grep 'NULL') if [[ $B ]]; thenecho [*] NULL Ciphers >> ssl_$line.txt cat ssltmp_$line | grep 'NULL' >> ssl_$line.txt echo >> ssl_$line.txt fiC=$(cat ssltmp_$line | grep 'SSLv2') if [[ $C ]]; thenecho [*] TLS/SSL Server Supports SSLv2 >> ssl_$line.txt cat ssltmp_$line | grep 'SSLv2' > ssltmp2_$line sed '/^ SSL/d' ssltmp2_$line >> ssl_$line.txt echo >> ssl_$line.txt rm ssltmp2_$line fiD=$(cat ssltmp_$line | grep ' 40 bits') D2=$(cat ssltmp_$line | grep ' 56 bits') if [[ $D || $D2 ]]; thenecho [*] TLS/SSL Server Supports Weak Cipher Algorithms >> ssl_$line.txt cat ssltmp_$line | grep ' 40 bits' >> ssl_$line.txt cat ssltmp_$line | grep ' 56 bits' >> ssl_$line.txt echo >> ssl_$line.txt fidatenow=$(date +%F) # echo datenow=$datenow datenowstamp=$(date2stamp "$datenow") # echo datenowstamp=$datenowstamp monthconv $(grep "Not valid after:" ssltmp_$line | awk -F" " {'print $4'}) # echo monthnum=$monthnum expyear=$(grep "Not valid after:" ssltmp_$line | awk -F" " {'print $7'}) # echo expyear=$expyear expday=$(grep "Not valid after:" ssltmp_$line | awk -F" " {'print $5'}) # echo expday=$expday expdate=$(echo "$expyear-$monthnum-$expday") # echo expdate=$expdate expdatestamp=$(date2stamp "$expdate") # echo expdatestamp=$expdatestamp numdaysdiff=$(datediff $datenow $expdate) # echo numdaysdiff=$numdaysdiff if (($expdatestamp < $datenowstamp)); thenecho [*] X.509 Server Certificate is Invalid/Expired >> ssl_$line.txt echo " Cert Expire Date: $expdate" >> ssl_$line.txt echo >> ssl_$line.txt fiE=$(cat ssltmp_$line | grep 'Authority Information Access:') if [[ ! $E ]]; thenecho [*] Self-signed TLS/SSL Certificate >> ssl_$line.txt echo >> ssl_$line.txt fiecho $line >> ssl_$line.txt echo >> ssl_$line.txt echo # echo "kill $pid process test" (sleep 5 && kill -9 $pid 2>/dev/null) & # Add current data to tmp-report cat ssl_$line.txt >> tmp-report elseecho -e "\e[1;31mCould not open a connection.\e[0m" echo $ERRORCHECK >> ssl_$line.txt echo >> ssl_$line.txt echo $line >> ssl_$line.txt cat ssl_$line.txt >> tmp-report fielseecho -e "\e[1;31mNo response.\e[0m" echo "[*] No response." >> ssl_$line.txt echo >> ssl_$line.txt echo $line >> ssl_$line.txt # Add current data to tmp-report cat ssl_$line.txt >> tmp-report fidone < "$location"mv tmp-report /$user/ssl-report.txtrm ssltmp_* ssl_*.txt 2>/dev/nullechoecho $lineechoecho "***Scan complete.***"echoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/ssl-report.txtechoechoexit}##############################################################################################################f_salesforce(){clearf_bannerecho 'Copy the results of a query from salesforce to a file, then parse the results.'f_locationechoechosed 's/Direct Dial Available//g' $location | sed 's/\[\]//g; s/Addison//g; s/Akron//g; s/Alma //g; s/Apple Valley//g; s/Arlington//g; s/Artesia//g; s/Ashburn//g; s/Atlanta//g; s/Austin//g; s/Baltimore//g; s/Barboursville//g; s/Binghamton//g; s/Birmingham//g; s/Boston//g; s/Burbank//g ; s/Burlington//g; s/Brockton//g; s/Canada//g; s/Camp Springs//g; s/Charleston//g; s/Charlotte//g; s/Chesapeake//g; s/Chicago//g; s/Cincinnati//g; s/Cleveland//g; s/CNN News Group Cable News Network//g; s/Columbia//g; s/Cresskill//g; s/Dallas//g; s/Denver//g; s/Dunkirk//g; s/Durham//g; s/El Paso//g; s/Englewood//g; s/Emeryville//g; s/Encino//g; s/Fallbrook//g; s/Fremont//g; s/Front Royal//g; s/Gardena//g; s/Gastonia//g; s/Glendale//g; s/Hamlin//g; s/Harbor City//g; s/Hawthorne//g; s/Hermosa Beach//g; s/Herndon//g; s/Huntington//g; s/Hurricane//g; s/Hyattsville//g; s/Indianapolis//g; s/Irvine//g; s/JA//g; s/Kansas City//g; s/Knoxville//g; s/La Follette//g; s/La Plata//g; s/Lawrenceville//g; s/Lawndale//g; s/Lithonia//g; s/Lomita//g; s/London//g; s/Long Beach//g; s/Los Angeles//g; s/Machias//g; s/Manhattan//g; s/Marietta//g; s/Marina Del Rey//g; s/Mc Lean//g; s/Miami//g; s/Milpitas//g; s/Milton//g; s/Minneapolis//g; s/Mumbai//g; s/Needham//g; s/New York//g; s/Norwalk//g; s/Oakland//g; s/Oceanport//g; s/Odessa//g; s/Ottawa ON//g; s/Orange//g; s/Philadelphia//g; s/Point Pleasant//g; s/Portland//g; s/Proctorville//g; s/Rancho//g; s/Redondo Beach//g; s/Reston//g; s/Richmond//g; s/Riverdale//g; s/Rllng Hls Est//g; s/Rochester//g; s/Rockville//g; s/Royal Oak//g; s/Sacramento//g; s/Salt Lake City//g; s/San Diego//g; s/San Francisco//g; s/San Jose//g; s/San Mateo//g; s/San Pedro//g; s/Santa Clara//g; s/Santa Monica//g; s/Scotts Valley//g; s/Seattle//g; s/Show Low//g; s/Sitka//g; s/Southfield//g; s/South Lake//g; s/Stephens City//g; s/Stillwater//g; s/Tacoma//g; s/Tallahassee//g; s/Torrance//g; s/Twin Falls//g; s/U.S.//g; s/United Kingdom//g; s/United States//g; s/Vienna//g; s/Walnut Creek//g; s/Washington//g; s/Welch//g; s/Westport//g; s/Wheeling//g; s/Wilton//g; s/Winchester//g; s/Williamsport//g; s/Wilmington//g; s/Winder//g; s/Wynnewood//g;s/AK //g; s/AL //g; s/AR //g; s/AZ //g; s/CA //g; s/CT //g; s/DC //g; s/DE //g; s/FL //g; s/GA //g; s/HI //g; s/IA //g; s/ID //g; s/IL //g; s/IN //g; s/KS //g; s/KY //g; s/LA //g; s/MA //g; s/ME //g; s/MD //g; s/MI //g; s/MN //g; s/MS //g; s/MT //g; s/NC //g; s/NE //g; s/ND //g; s/NH //g; s/NJ //g; s/NM //g; s/NV //g; s/NY //g; s/OH //g; s/OK //g; s/OR //g; s/PA //g; s/RI //g; s/SC //g; s/SD //g; s/TN //g; s/TX //g; s/UT //g; s/VA //g; s/VT //g; s/WA //g; s/WI //g; s/WV //g; s/WY //g; s/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{2\}//g; s/^[ \t]*//' > tmp# Author: Ben Woodperl -ne 'if ($_ =~ /(.*?)\t\s*(.*)/) {printf("%-30s%s\n",$1,$2);}' tmp > tmp2# Remove trailing whitespace from each linesed 's/[ \t]*$//' tmp2 | sort > /$user/names.txtrm tmp*cat /$user/names.txtechoecho $lineechoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/names.txtechoechoexit}##############################################################################################################f_listener(){clearechoechoecho "Starting a Metasploit listener on port 443."echo "Type - Windows meterpreter reverse TCP."echoecho "This takes about 20 seconds."echomsfconsole -r /opt/scripts/resource/listener.rc}##############################################################################################################f_updates(){# Remove entire script categoriesif [ -d /root/nmap-svn ]; thenls -l /root/nmap-svn/scripts | awk '{print $8}' | cut -d '.' -f1 | egrep -v '(broadcast|brute|discover|http|ip-|ssl|targets)' > tmpelsels -l /usr/local/share/nmap/scripts | awk '{print $8}' | cut -d '.' -f1 | egrep -v '(broadcast|brute|discover|http|ip-|ssl|targets)' > tmpfi# Remove Nmap scripts that take too many arguments, DOS or not relevantegrep -v '(address-info|ajp-auth|ajp-headers|asn-query|auth-owners|auth-spoof|cccam-version|citrix-enum-apps-xml|citrix-enum-servers-xml|creds-summary|daap-get-library|dns-blacklist|dns-check-zone|dns-client-subnet-scan|dns-fuzz|dns-ip6-arpa-scan|dns-nsec3-enum|dns-nsec-enum|dns-srv-enum|dns-zeustracker|domcon-cmd|duplicates|eap-info|firewalk|firewall-bypass|ftp-libopie|ganglia-info|ftp-vuln-cve2010-4221|hostmap-bfk|hostmap-robtex|iax2-version|informix-query|informix-tables|ipidseq|ipv6-node-info|ipv6-ra-flood|irc-botnet-channels|irc-info|irc-unrealircd-backdoor|isns-info|jdwp-exec|jdwp-info|jdwp-inject|krb5-enum-users|ldap-novell-getpass|ldap-search|llmnr-resolve|metasploit-info|mmouse-exec|ms-sql-config|mrinfo|ms-sql-hasdbaccess|ms-sql-query|ms-sql-tables|ms-sql-xp-cmdshell|mtrace|murmur-version|mysql-audit|mysql-enum|mysql-dump-hashes|mysql-query|mysql-vuln-cve2012-2122|nat-pmp-info|nat-pmp-mapport|netbus-info|omp2-enum-targets|oracle-enum-users|ovs-agent-version|p2p-conficker|path-mtu|pjl-ready-message|quake3-info|quake3-master-getservers|qscan|resolveall|reverse-index|rpc-grind|rpcap-info|samba-vuln-cve-2012-1182|script|sip-enum-users|skypev2-version|smb-flood|smb-ls|smb-print-text|smb-psexec|smb-vuln-ms10-054|smb-vuln-ms10-061|smtp-vuln-cve2010-4344|smtp-vuln-cve2011-1720|smtp-vuln-cve2011-1764|sniffer-detect|snmp-ios-config|socks-open-proxy|sql-injection|ssh-hostkey|ssh2-enum-algos|sshv1|stun-info|tftp-enum|tls-nextprotoneg|traceroute-geolocation|unusual-port|upnp-info|url-snarf|ventrilo-info|vuze-dht-info|whois|xmpp-info)' tmp > tmp-allgrep 'script=' discover.sh | egrep -v '(discover.sh|22.txt|smtp.txt|web.txt)' > tmpcat tmp | cut -d '=' -f2- | cut -d ' ' -f1 | tr ',' '\n' | egrep -v '(db2-discover|dhcp-discover|dns-service-discovery|membase-http-info|oracle-sid-brute|smb-os-discovery|sslv2)' | sort -u > tmp-usedecho "New Modules" > tmp-updatesecho >> tmp-updatesecho "Nmap scripts" >> tmp-updatesecho "==============================" >> tmp-updatesdiff tmp-all tmp-used | egrep '^[<>]' | awk '{print $2}' >> tmp-updatesrm tmpecho >> tmp-updatesecho "Metasploit auxiliary/scanners" >> tmp-updatesecho "==============================" >> tmp-updatescategories="afp backdoor db2 finger ftp h323 http imap lotus mongodb motorola mssql mysql netbios nfs ntp oracle pcanywhere pop3 postgres rservices scada sip smb smtp snmp ssh telnet tftp upnp vmware vnc vxworks winrm x11"for i in $categories; dols -l /opt/metasploit/msf3/modules/auxiliary/scanner/$i | awk '{print $8}' | cut -d '.' -f1 >> tmpdonesed '/^$/d' tmp > tmp2# Remove brute force and miscegrep -v '(afp_login|anonymous|axis_login|brute_dirs|cisco_upload_file|crawler|db2_auth|dolibarr_login|ektron_cms400net|enum_delicious|enum_wayback|file_same_name_dir|ftp_login|httpbl_lookup|isqlplus_login|isqlplus_sidbrute|lotus_domino_hashes|lotus_domino_login|lucky_punch|mongodb_login|mysql_hashdump|mysql_login|mysql_schemadump|oracle_hashdump|oracle_login|owa_login|pop3_login|postgres_hashdump|postgres_login|postgres_schemadump|postgres_version|prev_dir_same_name_file|rexec_login|rlogin_login|rsh_login|sid_brute|smb_login|snmp_login|snmp_set|squid_pivot_scanning|ssh_identify_pubkeys|ssh_login|ssh_login_pubkey|sybase_easerver_traversal|telnet_encrypt_overflow|telnet_login|tftpbrute|vcms_login|vhost_scanner|vnc_login|web_vulndb|xdb_sid|xdb_sid_brute|xpath)' tmp2 | sort > tmp-msf-allcat resource/*.rc | grep 'use' > tmp# Print from the last /, to the end of the linesed -e 's:.*/\(.*\):\1:g' tmp > tmp-msf-usedgrep -v -f tmp-msf-used tmp-msf-all >> tmp-updatesmv tmp-updates /$user/updatesrm tmp*echoecho $lineechoprintf 'The new report is located at \e[1;33m%s\e[0m\n' /$user/updatesechoechoexit}############################################################################################################### Loop foreverwhile :dof_mainf_main(){clearf_bannerecho -e "\e[1;34mRECON\e[0m"echo "1. Scrape"echoecho -e "\e[1;34mDISCOVER\e[0m" "- Host discovery, port scanning, service enumeration and OS"echo "identification using Nmap, Nmap scripts and Metasploit scanners."echo "2. Ping Sweep"echo "3. Single IP, URL or Range"echo "4. Local Area Network"echo "5. List"echo "6. CIDR Notation"echoecho -e "\e[1;34mWEB\e[0m"echo "7. Open multiple tabs in Firefox"echo "8. Nikto"echo "9. SSL Check"echoecho -e "\e[1;34mMISC\e[0m"echo "10. Crack WiFi"echo "11. Parse salesforce"echo "12. Start a Metasploit listener"echo "13. Update BackTrack"echo "14. Exit"echoecho -n "Choice: "read choicecase $choice in 1) f_recon;; 2) f_pingsweep;; 3) f_single;; 4) f_lan;; 5) f_lists;; 6) f_cidr;; 7) f_multitabs;; f_nikto;; 9) f_sslcheck;; 10) ./crack-wifi.sh;; 11) f_salesforce;; 12) f_listener;; 13) ./update.sh && exit;; 14) clear && exit;; 99) f_updates;; *) f_error;;esac}done
Welcome. Sit on the couch in the corner and I'll bring in the bitches.
The github link isn't working. Seeing as it's 3000 lines like you said I feel it's easier to just ask exactly what "disovery" information is being concatenated?
horse@box:~$ /home/horse/ss/discovery.shbash: /home/horse/ss/discovery.sh: Permission deniedhorse@box:~$ sudo /home/horse/ss/discovery.sh[sudo] password for horse: sudo: /home/horse/ss/discovery.sh: command not foundhorse@box:~$ sudo sh /home/horse/ss/discovery.sh: not found/ss/discovery.sh: 18: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 20: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 26: /home/horse/ss/discovery.sh: : bad trap: not found/ss/discovery.sh: 29: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 31: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 33: /home/horse/ss/discovery.sh: echo______ ___ ______ ______ _____ _ _ ______ _____| \ | |____ | | | \ / |_____ |____/|_____/ _|_ _____| |_____ |_____| \/ |_____ | \_: not found/ss/discovery.sh: 37: /home/horse/ss/discovery.sh: echoBy Lee Baird: not found/ss/discovery.sh: 39: /home/horse/ss/discovery.sh: echo: not found/ss/discovery.sh: 40: /home/horse/ss/discovery.sh: echo: not found/ss/discovery.sh: 41: /home/horse/ss/discovery.sh: }: not found/ss/discovery.sh: 42: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 44: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 46: /home/horse/ss/discovery.sh: echo\e[0m[1;31m==================================================: not found/ss/discovery.sh: 48: /home/horse/ss/discovery.sh: echo-e \e[1;31m *** Invalid choice or entry. ***\e[0m: not found/ss/discovery.sh: 50: /home/horse/ss/discovery.sh: echo\e[0m[1;31m==================================================sleep: invalid time interval `2\r'Try `sleep --help' for more information.: not found/ss/discovery.sh: 53: /home/horse/ss/discovery.sh: f_main: not found/ss/discovery.sh: 54: /home/horse/ss/discovery.sh: }: not found/ss/discovery.sh: 55: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 57: /home/horse/ss/discovery.sh: : not found/ss/discovery.sh: 59: /home/horse/ss/discovery.sh: echo^Chorse@box:~$ clearf your list: horse@box:~$ bash sh /home/horse/ss/discovery.sh/bin/sh: /bin/sh: cannot execute binary filehorse@box:~$ sudo chmod +x ./ss/discovery.shhorse@box:~$ bash sh /home/horse/ss/discovery.sh/bin/sh: /bin/sh: cannot execute binary filehorse@box:~$
horse@box:~/ss$ bash discovery.shdiscovery.sh: line 18: $'\r': command not founddiscovery.sh: line 20: $'\r': command not founddiscovery.sh: line 26: $'\r': command not found: invalid signal specificationdiscovery.sh: line 29: $'\r': command not founddiscovery.sh: line 31: $'\r': command not founddiscovery.sh: line 32: syntax error near unexpected token `$'{\r'''iscovery.sh: line 32: `f_banner(){horse@box:~/ss$