Skip to content

Commit 54ec238

Browse files
author
ekultek
committed
added a try, except block
1 parent 2240493 commit 54ec238

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib/cmdline/cmd.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,16 @@ def single_run_args(opt, keys, loaded_modules):
162162
keys["censys"][1], keys["censys"][0], opt.searchQuery, proxy=headers[0], agent=headers[1]
163163
).censys()
164164
if opt.startExploit:
165-
hosts = open(lib.settings.HOST_FILE).readlines()
166-
if opt.whitelist:
167-
hosts = lib.exploitation.exploiter.whitelist_wash(hosts, whitelist_file=opt.whitelist)
168-
lib.exploitation.exploiter.AutoSploitExploiter(
169-
opt.msfConfig,
170-
loaded_modules,
171-
hosts,
172-
ruby_exec=opt.rubyExecutableNeeded,
173-
msf_path=opt.pathToFramework
174-
).start_exploit()
165+
try:
166+
hosts = open(lib.settings.HOST_FILE).readlines()
167+
if opt.whitelist:
168+
hosts = lib.exploitation.exploiter.whitelist_wash(hosts, whitelist_file=opt.whitelist)
169+
lib.exploitation.exploiter.AutoSploitExploiter(
170+
opt.msfConfig,
171+
loaded_modules,
172+
hosts,
173+
ruby_exec=opt.rubyExecutableNeeded,
174+
msf_path=opt.pathToFramework
175+
).start_exploit()
176+
except KeyboardInterrupt:
177+
lib.output.warning("user aborted scan")

0 commit comments

Comments
 (0)