Discover : Custom Bash Scripts Used To Automate Various Penetration Testing Tasks

Discover custom bash scripts used to automate various penetration testing tasks including recon, scanning, parsing, and creating malicious payloads and listeners with Metasploit. For use with Kali Linux and the Penetration Testers Framework (PTF).

Download, setup, and usage

git clone https://github.com/leebaird/discover /opt/discover/
All scripts must be ran from this location.
cd /opt/discover/
./update.sh

  • RECON
    • Domain
    • Person
    • Parse salesforce
  • SCANNING
    • Generate target list
    • CIDR
    • List
    • IP, range, or domain
    • Rerun Nmap scripts and MSF aux
  • WEB
    • Insecure direct object reference
    • Open multiple tabs in Firefox
    • Nikto
    • SSL
  • MISC
    • Parse XML
    • Generate a malicious payload
    • Start a Metasploit listener
    • Update
    • Exit

Also Read – RITA : Real Intelligence Threat Analytics

RECON

Domain

  • RECON
    • Passive
    • Active
    • Import names into an existing recon-ng workspace
    • Previous menu

Passive uses ARIN, dnsrecon, goofile, goog-mail, goohost, theHarvester, Metasploit, URLCrazy, Whois, multiple websites, and recon-ng.

Active uses dnsrecon, WAF00W, traceroute, Whatweb, and recon-ng.

[*] Acquire API keys for Bing, Builtwith, Fullcontact, GitHub, Google, Hashes, Hunter, SecurityTrails, and Shodan for maximum results with recon-ng and theHarvester.

API key locations:
recon-ng
show keys
keys add bing_api
theHarvester
/opt/theHarvester/api-keys.yaml

  • Person
    • RECON
      • First name:
      • Last name:
  • Combines info from multiple websites.

Parse salesforce

  • Create a free account at salesforce (https://connect.data.com/login).
  • Perform a search on your target company > select the company name > see all.
  • Copy the results into a new file.

Enter the location of your list:

  • Gather names and positions into a clean list.

SCANNING

Generate target list

  • SCANNING
    • Local area network
    • NetBIOS
    • netdiscover
    • Ping sweep
    • Previous menu
  • Use different tools to create a target list including Angry IP Scanner, arp-scan, netdiscover and nmap pingsweep.

CIDR, List, IP, Range, or URL

  • Type of scan:
    • External
    • Internal
    • Previous menu
  • External scan will set the nmap source port to 53 and the max-rrt-timeout to 1500ms.
  • Internal scan will set the nmap source port to 88 and the max-rrt-timeout to 500ms.
  • Nmap is used to perform host discovery, port scanning, service enumeration and OS identification.
  • Matching nmap scripts are used for additional enumeration.
  • Addition tools: enum4linux, smbclient, and ike-scan.
  • Matching Metasploit auxiliary modules are also leveraged.

WEB

Insecure direct object reference

Using Burp, authenticate to a site, map & Spider, then log out. Target > Site map > select the URL > right click > Copy URLs in this host. Paste the results into a new file.

Enter the location of your file:

Open multiple tabs in Firefox

  • Open multiple tabs in Firefox with:
    • List
    • Directories from robots.txt.
    • Previous menu
  • Use a list containing IPs and/or URLs.
  • Use wget to pull a domain’s robot.txt file, then open all of the directories.

Nikto

  • Run multiple instances of Nikto in parallel.
    • List of IPs.
    • List of IP:port.
    • Previous menu

SSL

Check for SSL certificate issues.
Enter the location of your list:

  • Use sslscan and sslyze to check for SSL/TLS certificate issues.

MISC

Parse XML

  • Parse XML to CSV.
    • Burp (Base64)
    • Nessus (.nessus)
    • Nexpose (XML 2.0)
    • Nmap
    • Qualys
    • Previous menu

Generate a malicious payload

  • Malicious Payloads
    • android/meterpreter/reverse_tcp
    • cmd/windows/reverse_powershell
    • java/jsp_shell_reverse_tcp (Linux)
    • java/jsp_shell_reverse_tcp (Windows)
    • linux/x64/meterpreter_reverse_https
    • linux/x64/meterpreter_reverse_tcp
    • linux/x64/shell/reverse_tcp
    • osx/x64/meterpreter_reverse_https
    • osx/x64/meterpreter_reverse_tcp
    • php/meterpreter/reverse_tcp
    • python/meterpreter_reverse_https
    • python/meterpreter_reverse_tcp
    • windows/x64/meterpreter_reverse_https
    • windows/x64/meterpreter_reverse_tcp
    • Previous menu

Start a Metasploit listener

  • Metasploit Listeners
    • android/meterpreter/reverse_tcp
    • cmd/windows/reverse_powershell
    • java/jsp_shell_reverse_tcp
    • linux/x64/meterpreter_reverse_https
    • linux/x64/meterpreter_reverse_tcp
    • linux/x64/shell/reverse_tcp
    • osx/x64/meterpreter_reverse_https
    • osx/x64/meterpreter_reverse_tcp
    • php/meterpreter/reverse_tcp
    • python/meterpreter_reverse_https
    • python/meterpreter_reverse_tcp
    • windows/x64/meterpreter_reverse_https
    • windows/x64/meterpreter_reverse_tcp
    • Previous menu

Update

  • Use to update Kali Linux , Discover scripts, various tools, and the locate database.