Exemple #1
0
if len(sys.argv) != 2:
    print "Usage: dnsrecon.py <ip address>"
    sys.exit(0)

try:
    ip_address = sys.argv[1]
    HOSTNAME = "host %s | cut -d ' ' -f5 | cut -d '.' -f1,2,3" % (ip_address)
    DOMAINNAME = "host %s | cut -d ' ' -f5 | cut -d '.' -f2,3" % (ip_address)
    port = 53

    print "\033[1;37m[-]  ----------------------------------------------------------------------------- \033[1;m"
    print('\033[1;37m[-]  |     Starting DNS script scan for {0}:{1}\033[1;m'.format(ip_address, port))
    print "\033[1;37m[-]  ----------------------------------------------------------------------------- \033[1;m"
    DNSSCAN = "nmap -sV -sSU -Pn -vv -p53 --script=dns-* -oN './results/{0}/{0}_dns.nmap' {0}".format(ip_address)
    results = subprocess.check_output(DNSSCAN, shell=True)
    recon.logparsertxt(results)
    outfile = "results/{0}/{0}_dnsrecon.txt".format(ip_address)
    f = open(outfile, "w")
    f.write(results)
    f.close()

    # grab the hostname
    host = subprocess.check_output(HOSTNAME, shell=True).strip()
    domain = subprocess.check_output(DOMAINNAME, shell=True).strip()
    print('\033[1;37m[+]  Attempting Domain Transfer on {0}\033[1;m'.format(host))
    ZT = "dig @{0} {1} axfr".format(host, domain)
    try:
        with open(os.devnull, "w") as f:
            ztresults = subprocess.check_output(ZT, shell=True, stdout=f)
            if "failed" in ztresults:
                print('\033[1;33m[-]  Zone Transfer failed for {0}\033[1;m'.format(host))
Exemple #2
0
import os
import recon

if len(sys.argv) != 2:
    print "Usage: smbrecon.py <ip address>"
    sys.exit(0)

ip = sys.argv[1]
recon.checkpath("./results/" + ip)
try:
    print "\033[1;37m[-]  ----------------------------------------------------------------------------- \033[1;m"
    print('\033[1;37m[-]  |     Starting SMB script scan for {0}\033[1;m'.format(ip))
    print "\033[1;37m[-]  ----------------------------------------------------------------------------- \033[1;m"
    VULNSCAN = "nmap -sV -Pn -vv -p445,139 --script=smb-vuln* --script-args=unsafe=1 -oN './results/{0}/{0}_smb.nmap' {0}".format(ip)
    scanresults = subprocess.check_output(VULNSCAN, shell=True)
    recon.logparsertxt(scanresults)

    NBTSCAN = "./Modules/samrdump.py %s" % (ip)
    nbtresults = subprocess.check_output(NBTSCAN, shell=True)
    if ("Connection refused" not in nbtresults) and ("Connect error" not in nbtresults) and ("Connection reset" not in nbtresults):
        print('\033[1;33m[+]  \033[1;33mSAMRDUMP has connected to {0} if there are results displaying them below\033[1;m'.format(ip))
        lines = nbtresults.split("\n")
        for line in lines:
            if ("Found" in line) or (" . " in line):
                print '\033[1;32m[+]  ' + line + '\033[1;m'
    E4L = "enum4linux {0}".format(ip)
    print "\033[1;37m[-]  ----------------------------------------------------------------------------- \033[1;m"
    print('\033[1;37m[-]  |     Starting ENUM4LINUX for {0}\033[1;m'.format(ip))
    print "\033[1;37m[-]  ----------------------------------------------------------------------------- \033[1;m"
    e4lresults = subprocess.check_output(E4L, shell=True)
    recon.logparserall(e4lresults)