Skip to content

Commit

Permalink
Merge pull request #108 from BrashEndeavours/hotfix/fix_nmap_dns-servers
Browse files Browse the repository at this point in the history
Hotfix/fix nmap --dns-servers on detailed scans
  • Loading branch information
codingo authored Jul 28, 2019
2 parents 0b53a79 + acecc17 commit 70c8a19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
3 changes: 3 additions & 0 deletions Reconnoitre/lib/find_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

def find_dns(target_hosts, output_directory, quiet):
check_directory(output_directory)
dns_server_list = []
results = 0
hostcount = 0
dnscount = 0
Expand Down Expand Up @@ -42,8 +43,10 @@ def find_dns(target_hosts, output_directory, quiet):
(ip_address))
output_file.write(" [>] %s\n" % (line))
output_targets.write("%s\n" % (ip_address))
dns_server_list.append(ip_address)
dnscount += 1
print("[*] Found %s DNS servers within %s hosts" %
(str(dnscount), str(hostcount)))
output_file.close()
output_targets.close()
return '' if len(dns_server_list) == 0 else ','.join(dns_server_list)
27 changes: 10 additions & 17 deletions Reconnoitre/reconnoitre.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def util_checks(util=None):
def main():
parser = CliArgumentParser()
arguments = parser.parse(sys.argv[1:])
dns_servers = ''


if arguments.output_directory.endswith('/' or '\\'):
arguments.output_directory = arguments.output_directory[:-1]
Expand Down Expand Up @@ -96,29 +98,20 @@ def main():

if arguments.find_dns_servers is True:
print("[#] Identifying DNS Servers")
find_dns(
dns_servers = find_dns(
arguments.target_hosts,
arguments.output_directory,
arguments.quiet)

if arguments.perform_service_scan is True:
print("[#] Performing service scans")
if arguments.find_dns_servers is True:
service_scan(
arguments.target_hosts,
arguments.output_directory,
arguments.find_dns_servers,
arguments.quiet,
arguments.quick,
arguments.no_udp_service_scan)
else:
service_scan(
arguments.target_hosts,
arguments.output_directory,
'',
arguments.quiet,
arguments.quick,
arguments.no_udp_service_scan)
service_scan(
arguments.target_hosts,
arguments.output_directory,
dns_servers,
arguments.quiet,
arguments.quick,
arguments.no_udp_service_scan)

if arguments.perform_snmp_walk is True:
print("[#] Performing SNMP walks")
Expand Down

0 comments on commit 70c8a19

Please sign in to comment.