#!/usr/bin/python
import argparse 
import subprocess
__author__ = 'tyler@appliedtrust.com'

#Handles arguments passed through CLI
parser = argparse.ArgumentParser(description='This script handles profiling with Recon-Ng.')
parser.add_argument('-d','--domain', help='Add domain you want to test', required=True)
parser.add_argument('-o','--output', help='Specify output path for report', required=True)
args = parser.parse_args()

print ("Domain is: %s" % args.domain)
subprocess.call(["recon-cli", "-w", "%s" %args.domain])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-C", "add domains %s" %args.domain])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/domains-hosts/google_site_web", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/domains-hosts/bing_domain_web", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/domains-hosts/yahoo_domain", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/hosts-hosts/resolve", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/hosts-hosts/reverse_resolve", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/domains-contacts/whois_pocs", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/domains-contacts/pgp_search", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/contacts-credentials/hibp_paste", "-x"])
subprocess.call(["recon-cli", "-w", "%s" %args.domain, "-m", "recon/contacts-credentials/hibp_breach", "-x"])


# Create the report
subprocess.call(["recon-cli", "-m", "reporting/html", "-o", "CREATOR=atrust", "-o", "CUSTOMER=%s" %args.domain, "-o", "FILENAME=%s.html" %args.output, "-x"])

subprocess.call(["recon-cli", "-m", "reporting/csv", "-o", "FILENAME=%s.csv" %args.output, "-x"])

print ("Output location is: %s" % args.output)
print ("This script just captures a baseline. Use your skills to expand on this information.")
