Skip to content

Commit acab902

Browse files
committed
fixes an issue where if the host file isn't present the terminal will crash (issue #166)
1 parent 0fb4403 commit acab902

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/term/terminal.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ def exploit_gathered_hosts(self, loaded_mods, hosts=None):
181181
# If whitelist is specified, return a washed hosts list
182182
host_file = lib.exploitation.exploiter.whitelist_wash(open(self.host_path).readlines(), whitelist_file)
183183
else:
184-
host_file = open(self.host_path).readlines()
184+
try:
185+
host_file = open(self.host_path).readlines()
186+
except Exception:
187+
lib.output.error("no host file is present, did you gather hosts?")
188+
return
185189
else:
186190
if whitelist_file is not "" and not whitelist_file.isspace():
187191
# If whitelist is specified, return a washed hosts list
@@ -240,7 +244,6 @@ def exploit_gathered_hosts(self, loaded_mods, hosts=None):
240244
except AttributeError:
241245
lib.output.warning("unable to sort modules by relevance")
242246

243-
244247
def custom_host_list(self, mods):
245248
"""
246249
provided a custom host list that will be used for exploitation

0 commit comments

Comments
 (0)