Skip to content

Commit b067bdc

Browse files
authored
Merge branch 'master' into ping_sweeper_file_handling
2 parents 9c53f74 + afe4566 commit b067bdc

10 files changed

+25
-30
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@ This tool can be used and copied for personal use freely however attribution and
1919
| -t TARGET_HOSTS | Set either a target range of addresses or a single host to target. May also be a file containing hosts. |
2020
| -o OUTPUT_DIRECTORY | Set the target directory where results should be written. |
2121
| -w WORDLIST | Optionally specify your own wordlist to use for pre-compiled commands, or executed attacks. |
22-
| --dns DNS_SERVER | Optionally specify a DNS server to use with a service scan. |
2322
| --pingsweep | Write a new target.txt file in the OUTPUT_DIRECTORY by performing a ping sweep and discovering live hosts. |
24-
| --dnssweep | Find DNS servers from the list of target(s). |
23+
| --dns, --dnssweep | Find DNS servers from the list of target(s). |
2524
| --snmp | Find hosts responding to SNMP requests from the list of target(s). |
2625
| --services | Perform a service scan over the target(s) and write recommendations for further commands to execute. |
2726
| --hostnames | Attempt to discover target hostnames and write to hostnames.txt. |
2827
| --virtualhosts | Attempt to discover virtual hosts using the specified wordlist. This can be expended via discovered hostnames. |
2928
| --ignore-http-codes | Comma separated list of http codes to ignore with virtual host scans. |
3029
| --ignore-content-length | Ignore content lengths of specificed amount. This may become useful when a server returns a static page on every virtual host guess. |
3130
| --quiet | Supress banner and headers and limit feedback to grepable results. |
32-
| --exec | Execute shell commands from recommendations as they are discovered. Likely to lead to very long execution times depending on the wordlist being used and discovered vectors. |
33-
| --simple_exec | Execute non-brute forcing shell comamnds only commands as they are discovered. Likely to lead to very long execution times depending on the wordlist being used and discovered vectors. |
3431
| --quick | Move to the next target after performing a quick scan and writing first-round recommendations. |
3532
| --no-udp | Disable UDP service scanning, which is ON by default. |
3633

File renamed without changes.
File renamed without changes.

reconnoitre/find_dns.py renamed to find_dns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def find_dns(target_hosts, output_directory, quiet):
2727

2828
print(" [>] Testing %s for DNS" % ip_address)
2929
DNSSCAN = "nmap -n -sV -Pn -vv -p53 %s" % (ip_address)
30-
results = subprocess.check_output(DNSSCAN, shell=True)
30+
results = subprocess.check_output(DNSSCAN, shell=True).decode("utf-8")
3131
lines = results.split("\n")
3232

3333
for line in lines:

reconnoitre/hostname_scan.py renamed to hostname_scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def hostname_scan(target_hosts, output_directory, quiet):
2121
else:
2222
SWEEP = "nbtscan -q %s" % (target_hosts)
2323

24-
results = subprocess.check_output(SWEEP, shell=True)
24+
results = subprocess.check_output(SWEEP, shell=True).decode("utf-8")
2525
lines = results.split("\n")
2626

2727
for line in lines:

ping_sweeper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ def ping_sweeper(target_hosts, output_directory, quiet):
3333
live_hosts += 1
3434
print("[*] Found %s live hosts" % (live_hosts))
3535
print("[*] Created target list %s" % (output_file))
36-
f.close()
36+
f.close()

reconnoitre/reconnoitre.py renamed to reconnoitre.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,23 @@ def util_checks(util = None):
4848

4949
def main():
5050
parser = ArgumentParser()
51-
parser.add_argument("-t", dest="target_hosts", required=True, help="Set a target range of addresses to target. Ex 10.11.1.1-255" )
52-
parser.add_argument("-o", dest="output_directory", required=True, help="Set the output directory. Ex /root/Documents/labs/")
53-
parser.add_argument("-w", dest="wordlist", required=False, help="Set the wordlist to use for generated commands. Ex /usr/share/wordlist.txt", default=False)
54-
parser.add_argument("-p", dest="port", required=False, help="Set the port to use. Leave blank to use discovered ports. Useful to force virtual host scanning on non-standard webserver ports.", default=80)
55-
parser.add_argument("--pingsweep", dest="ping_sweep", action="store_true", help="Write a new target.txt by performing a ping sweep and discovering live hosts.", default=False)
56-
parser.add_argument("--dns", dest="find_dns_servers", action="store_true", help="Find DNS servers from a list of targets.", default=False)
57-
parser.add_argument("--services", dest="perform_service_scan", action="store_true", help="Perform service scan over targets.", default=False)
58-
parser.add_argument("--hostnames", dest="hostname_scan", action="store_true", help="Attempt to discover target hostnames and write to 0-name.txt and hostnames.txt.", default=False)
59-
parser.add_argument("--snmp", dest="perform_snmp_walk", action="store_true", help="Perform service scan over targets.", default=False)
60-
parser.add_argument("--quick", dest="quick", action="store_true", required=False, help="Move to the next target after performing a quick scan and writing first-round recommendations.", default=False)
61-
62-
parser.add_argument("--virtualhosts", dest="virtualhosts", action="store_true", required=False, help="Attempt to discover virtual hosts using the specified wordlist.", default=False)
63-
parser.add_argument('--ignore-http-codes', dest='ignore_http_codes', type=str, help='Comma separated list of http codes to ignore with virtual host scans.', default='404')
64-
parser.add_argument('--ignore-content-length', dest='ignore_content_length', type=int, help='Ignore content lengths of specificed amount. This may become useful when a server returns a static page on every virtual host guess.', default=0)
65-
66-
parser.add_argument("--quiet", dest="quiet", action="store_true", help="Supress banner and headers to limit to comma dilimeted results only.", default=False)
67-
parser.add_argument("--exec", dest="follow", action="store_true", help="Execute shell comamnds from recommendations as they are discovered. Likely to lead to very long execute times depending on the wordlist being used.", default=False)
68-
parser.add_argument("--simple_exec", dest="quickfollow", action="store_true", help="Execute non-brute forcing shell comamnds only as they are discovered.", default=False)
69-
parser.add_argument("--no-udp", dest="no_udp_service_scan", action="store_true", help="Disable UDP services scan over targets.", default=False)
51+
parser.add_argument("-t", dest="target_hosts", required=True, help="Set a target range of addresses to target. Ex 10.11.1.1-255" )
52+
parser.add_argument("-o", dest="output_directory", required=True, help="Set the output directory. Ex /root/Documents/labs/")
53+
parser.add_argument("-w", dest="wordlist", required=False, help="Set the wordlist to use for generated commands. Ex /usr/share/wordlist.txt", default=False)
54+
parser.add_argument("-p", dest="port", required=False, help="Set the port to use. Leave blank to use discovered ports. Useful to force virtual host scanning on non-standard webserver ports.", default=80)
55+
parser.add_argument("--pingsweep", dest="ping_sweep", action="store_true", help="Write a new target.txt by performing a ping sweep and discovering live hosts.", default=False)
56+
parser.add_argument("--dns","--dnssweep", dest="find_dns_servers", action="store_true", help="Find DNS servers from a list of targets.", default=False)
57+
parser.add_argument("--services", dest="perform_service_scan", action="store_true", help="Perform service scan over targets.", default=False)
58+
parser.add_argument("--hostnames", dest="hostname_scan", action="store_true", help="Attempt to discover target hostnames and write to 0-name.txt and hostnames.txt.", default=False)
59+
parser.add_argument("--snmp", dest="perform_snmp_walk", action="store_true", help="Perform service scan over targets.", default=False)
60+
parser.add_argument("--quick", dest="quick", action="store_true", required=False, help="Move to the next target after performing a quick scan and writing first-round recommendations.", default=False)
61+
62+
parser.add_argument("--virtualhosts", dest="virtualhosts", action="store_true", required=False, help="Attempt to discover virtual hosts using the specified wordlist.", default=False)
63+
parser.add_argument('--ignore-http-codes', dest='ignore_http_codes', type=str, help='Comma separated list of http codes to ignore with virtual host scans.', default='404')
64+
parser.add_argument('--ignore-content-length', dest='ignore_content_length', type=int, help='Ignore content lengths of specificed amount. This may become useful when a server returns a static page on every virtual host guess.', default=0)
65+
66+
parser.add_argument("--quiet", dest="quiet", action="store_true", help="Supress banner and headers to limit to comma dilimeted results only.", default=False)
67+
parser.add_argument("--no-udp", dest="no_udp_service_scan", action="store_true", help="Disable UDP services scan over targets.", default=False)
7068
arguments = parser.parse_args()
7169

7270
if len(sys.argv) == 1:

reconnoitre/service_scan.py renamed to service_scan.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def nmap_scan(ip_address, output_directory, dns_server, quick, no_udp_service_sc
1515

1616
print("[+] Starting quick nmap scan for %s" % (ip_address))
1717
QUICKSCAN = "nmap -sC -sV %s -oA '%s/%s.quick'" % (ip_address, output_directory, ip_address)
18-
quickresults = subprocess.check_output(QUICKSCAN, shell=True)
18+
quickresults = subprocess.check_output(QUICKSCAN, shell=True).decode("utf-8")
1919

2020
write_recommendations(quickresults, ip_address, output_directory)
2121
print("[*] TCP quick scans completed for %s" % ip_address)
@@ -33,8 +33,8 @@ def nmap_scan(ip_address, output_directory, dns_server, quick, no_udp_service_sc
3333
TCPSCAN = "nmap -vv -Pn -sS -A -sC -p- -T 3 -script-args=unsafe=1 -n %s -oN '%s/%s.nmap' -oX '%s/%s_nmap_scan_import.xml' %s" % (dns_server, output_directory, ip_address, output_directory, ip_address, ip_address)
3434
UDPSCAN = "nmap -sC -sV -sU %s -oA '%s/%s-udp'" % (ip_address, output_directory, ip_address)
3535

36-
udpresults = "" if no_udp_service_scan is True else subprocess.check_output(UDPSCAN, shell=True)
37-
tcpresults = subprocess.check_output(TCPSCAN, shell=True)
36+
udpresults = "" if no_udp_service_scan is True else subprocess.check_output(UDPSCAN, shell=True).decode("utf-8")
37+
tcpresults = subprocess.check_output(TCPSCAN, shell=True).decode("utf-8")
3838

3939
write_recommendations(tcpresults + udpresults, ip_address, output_directory)
4040
print("[*] TCP%s scans completed for %s" % (("" if no_udp_service_scan is True else "/UDP"), ip_address))

reconnoitre/snmp_walk.py renamed to snmp_walk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def snmp_scans(ip_address, output_directory):
6464
SCAN = "snmpwalk -c public -v1 %s 1.3.6.1.2.1.25.1.6.0 > '%s%s-systemprocesses.txt'" % (ip_address, output_directory, ip_address)
6565

6666
try:
67-
results = subprocess.check_output(SCAN, stderr=subprocess.STDOUT, shell=True).decode('utf-8')
67+
results = subprocess.check_output(SCAN, stderr=subprocess.STDOUT, shell=True).decode("utf-8").decode('utf-8')
6868
except Exception as e:
6969
print("[+] No Response from %s" % ip_address)
7070
except subprocess.CalledProcessError as cpe:
File renamed without changes.

0 commit comments

Comments
 (0)