Advertisement
Guest User

f0x112434

a guest
Jun 22nd, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.19 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. <<COMMENT
  4. Dependencies must be in environment path.
  5.  
  6.  
  7. Dependencies:
  8. 1. Assetfinder
  9. 2. Httprobe
  10. 3. Subjack
  11. 4. Waybackurls
  12. 5. Gowitness (Future revison not required now.)
  13. 6. Amass (Future revison not required now.)
  14. 7. Nmap
  15.  
  16.  
  17. Example Useage:
  18. ./baserecon.sh target.com
  19.  
  20. Do not type the full url such as http://www.target.com just type target.com
  21.  
  22. COMMENT
  23.  
  24. url=$1
  25. if [ ! -d "$url" ];then
  26.     mkdir $url
  27.     fi
  28.     if [ ! -d "$url/recon" ];then
  29.         mkdir $url/recon
  30.         fi
  31.         if [ ! -d "$url/recon/scans" ];then
  32.             mkdir $url/recon/scans
  33.             fi
  34.             if [ ! -d "$url/recon/httprobe" ];then
  35.                 mkdir $url/recon/httprobe
  36.                 fi
  37.                 if [ ! -d "$url/recon/potential_takeovers" ];then
  38.                     mkdir $url/recon/potential_takeovers
  39.                     fi
  40.                     if [ ! -d "$url/recon/wayback" ];then
  41.                         mkdir $url/recon/wayback
  42.                         touch $url/recon/wayback/wayback_output.txt
  43.                         fi
  44.                         if [ ! -d "$url/recon/wayback/params" ];then
  45.                             mkdir $url/recon/wayback/params
  46.                             touch $url/recon/wayback/params/wayback_params.txt
  47.                             fi
  48.                             if [ ! -d "$url/recon/wayback/extensions" ];then
  49.                                 mkdir $url/recon/wayback/extensions
  50.                                 touch $url/recon/wayback/extensions/wayback_extensions.txt
  51.                                 touch $url/recon/wayback/extensions/jsp1.txt
  52.                                 touch $url/recon/wayback/extensions/js1.txt
  53.                                 touch $url/recon/wayback/extensions/json1.txt
  54.                                 touch $url/recon/wayback/extensions/php1.txt
  55.                                 touch $url/recon/wayback/extensions/aspx1.txt
  56.                                 fi
  57.                                 if [ ! -f "$url/recon/httprobe/alive.txt" ];then
  58.                                     touch $url/recon/httprobe/alive.txt
  59.                                     fi
  60.                                     if [ ! -f "$url/recon/final.txt" ];then
  61.                                         touch $url/recon/final.txt
  62.                                         fi
  63.                                        
  64.                                         echo "[+] Harvesting subdomains with assetfinder..."
  65.                                         assetfinder $url >> $url/recon/assets.txt
  66.                                         cat $url/recon/assets.txt | grep $1 >> $url/recon/final.txt
  67.                                         rm $url/recon/assets.txt
  68.                                        
  69.                                         echo "[+] Probing for alive domains..."
  70.                                         cat $url/recon/final.txt | sort -u | httprobe -s -p https:443 | sed 's/https\?:\/\///' | tr -d ':443' >> $url/recon/httprobe/a.txt
  71.                                         sort -u $url/recon/httprobe/a.txt > $url/recon/httprobe/alive.txt
  72.                                         rm $url/recon/httprobe/a.txt
  73.                                        
  74.                                         echo "[+] Checking for possible subdomain takeover..."
  75.                                        
  76.                                         if [ ! -f "$url/recon/potential_takeovers/potential_takeovers.txt" ];then
  77.                                             touch $url/recon/potential_takeovers/potential_takeovers.txt
  78.                                             fi
  79.                                            
  80.                                             subjack -w $url/recon/final.txt -t 100 -timeout 30 -ssl -c ~/go/src/github.com/haccer/subjack/fingerprints.json -v 3 -o $url/recon/potential_takeovers/potential_takeovers.txt
  81.                                            
  82.                                             echo "[+] Scanning for open ports..."
  83.                                             nmap -iL $url/recon/httprobe/alive.txt -T4 -oA $url/recon/scans/scanned.txt
  84.                                            
  85.                                             echo "[+] Scraping wayback data..."
  86.                                             cat $url/recon/final.txt | waybackurls >> $url/recon/wayback/wayback_output.txt
  87.                                             sort -u $url/recon/wayback/wayback_output.txt
  88.                                            
  89.                                             echo "[+] Pulling and compiling all possible params found in wayback data..."
  90.                                             cat $url/recon/wayback/wayback_output.txt | grep '?*=' | cut -d '=' -f 1 | sort -u >> $url/recon/wayback/params/wayback_params.txt
  91.                                             for line in $(cat $url/recon/wayback/params/wayback_params.txt);do echo $line'=';done
  92.                                                
  93.                                                 echo "[+] Pulling and compiling js/php/aspx/jsp/json files from wayback output..."
  94.                                                 for line in $(cat $url/recon/wayback/wayback_output.txt);do
  95.                                                     ext="${line##*.}"
  96.                                                     if [[ "$ext" == "js" ]]; then
  97.                                                         echo $line >> $url/recon/wayback/extensions/js1.txt
  98.                                                         sort -u $url/recon/wayback/extensions/js1.txt >> $url/recon/wayback/extensions/js.txt
  99.                                                         fi
  100.                                                         if [[ "$ext" == "html" ]];then
  101.                                                             echo $line >> $url/recon/wayback/extensions/jsp1.txt
  102.                                                             sort -u $url/recon/wayback/extensions/jsp1.txt >> $url/recon/wayback/extensions/jsp.txt
  103.                                                             fi
  104.                                                             if [[ "$ext" == "json" ]];then
  105.                                                                 echo $line >> $url/recon/wayback/extensions/json1.txt
  106.                                                                 sort -u $url/recon/wayback/extensions/json1.txt >> $url/recon/wayback/extensions/json.txt
  107.                                                                 fi
  108.                                                                 if [[ "$ext" == "php" ]];then
  109.                                                                     echo $line >> $url/recon/wayback/extensions/php1.txt
  110.                                                                     sort -u $url/recon/wayback/extensions/php1.txt >> $url/recon/wayback/extensions/php.txt
  111.                                                                     fi
  112.                                                                     if [[ "$ext" == "aspx" ]];then
  113.                                                                         echo $line >> $url/recon/wayback/extensions/aspx1.txt
  114.                                                                         sort -u $url/recon/wayback/extensions/aspx1.txt >> $url/recon/wayback/extensions/aspx.txt
  115.                                                                         fi
  116.                                                                         done
  117.                                                                        
  118.                                                                         rm $url/recon/wayback/extensions/js1.txt
  119.                                                                         rm $url/recon/wayback/extensions/jsp1.txt
  120.                                                                         rm $url/recon/wayback/extensions/json1.txt
  121.                                                                         rm $url/recon/wayback/extensions/php1.txt
  122.                                                                         rm $url/recon/wayback/extensions/aspx1.txt
  123.  
  124.                                                                         ## Gowitness and Amass checks will go here in future.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement