Skip to content

Commit e5ff052

Browse files
author
Michael Skelton
committed
Add exceptions for missing PTR records
1 parent 0f8b7ed commit e5ff052

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

VHostScan.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ def main():
8686
print("[>] First hit is set.")
8787

8888
if not arguments.no_lookup:
89-
for ip in Resolver().query(arguments.target_hosts, 'A'):
90-
host, aliases, ips = gethostbyaddr(str(ip))
91-
wordlist.append(str(ip))
92-
wordlist.append(host)
93-
wordlist.extend(aliases)
89+
try:
90+
print("[+] Resolving DNS for additional wordlist entries")
91+
for ip in Resolver().query(arguments.target_hosts, 'A'):
92+
host, aliases, ips = gethostbyaddr(str(ip))
93+
wordlist.append(str(ip))
94+
wordlist.append(host)
95+
wordlist.extend(aliases)
96+
except (dns.resolver.NXDOMAIN):
97+
print("[!] Couldn't find any records (NXDOMAIN)")
98+
except (dns.resolver.NoAnswer):
99+
print("[!] Couldn't find any records (NoAnswer)")
94100

95101
scanner_args = vars(arguments)
96102
scanner_args.update({

0 commit comments

Comments
 (0)