Skip to content

Commit c6f1066

Browse files
committed
added check for host utility
1 parent 5551067 commit c6f1066

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

enum_tools/utils.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ def fast_dns_lookup(names, nameserver, callback='', threads=25):
108108

109109
print("[*] Brute-forcing a list of {} possible DNS names".format(total))
110110

111+
# Quickly check to make sure we have the OS utility `host` installed
112+
113+
111114
# Break the url list into smaller lists based on thread size
112115
queue = [names[x:x+threads] for x in range(0, len(names), threads)]
113116

@@ -126,9 +129,14 @@ def fast_dns_lookup(names, nameserver, callback='', threads=25):
126129
cmd = ['host', '{}'.format(name), '{}'.format(nameserver)]
127130

128131
# Run the command and store the pending output
129-
batch_pending[name] = subprocess.Popen(cmd,
130-
stdout=subprocess.DEVNULL,
131-
stderr=subprocess.DEVNULL)
132+
null = subprocess.DEVNULL
133+
try:
134+
batch_pending[name] = subprocess.Popen(cmd, stdout=null,
135+
stderr=null)
136+
except FileNotFoundError:
137+
print("[!] Can't find the 'host' command. Please install it"
138+
" and try again.")
139+
sys.exit()
132140

133141
# Then, grab all the results from the queue
134142
for name in batch_pending:

0 commit comments

Comments
 (0)