Skip to content

Commit 1fd071d

Browse files
radman404Kylef0404
andauthored
Stop crashing if a connection times out (#89)
Co-authored-by: Kyle Fleming <[email protected]>
1 parent ce6b641 commit 1fd071d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

coercer/__main__.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,11 @@ def main():
232232
reporter.print_info("Scanning target %s" % target)
233233
# Checking credentials if any
234234
if not "msrpc" in options.filter_transport_name or try_login(credentials, target, verbose=options.verbose):
235-
# Starting action
236-
action_coerce(target, available_methods, options, credentials, reporter)
237-
235+
try:
236+
# Starting action
237+
action_coerce(target, available_methods, options, credentials, reporter)
238+
except Exception as e:
239+
reporter.print_warn("An unexpected error occurred: %s" % e)
238240
elif options.mode == "scan":
239241
reporter.print_info("Starting scan mode")
240242
if credentials.is_anonymous():
@@ -246,9 +248,11 @@ def main():
246248
reporter.print_info("Scanning target %s" % target)
247249
# Checking credentials if any
248250
if not "msrpc" in options.filter_transport_name or try_login(credentials, target, verbose=options.verbose):
249-
# Starting action
250-
action_scan(target, available_methods, options, credentials, reporter)
251-
251+
try:
252+
# Starting action
253+
action_scan(target, available_methods, options, credentials, reporter)
254+
except Exception as e:
255+
reporter.print_warn("An unexpected error occurred: %s" % e)
252256
# Reporting results
253257
if options.export_json is not None:
254258
reporter.exportJSON(options.export_json)
@@ -268,9 +272,11 @@ def main():
268272
reporter.print_info("Fuzzing target %s" % target)
269273
# Checking credentials if any
270274
if not "msrpc" in options.filter_transport_name or try_login(credentials, target, verbose=options.verbose):
271-
# Starting action
272-
action_fuzz(target, available_methods, options, credentials, reporter)
273-
275+
try:
276+
# Starting action
277+
action_fuzz(target, available_methods, options, credentials, reporter)
278+
except Exception as e:
279+
reporter.print_warn("An unexpected error occurred: %s" % e)
274280
# Reporting results
275281
if options.export_json is not None:
276282
reporter.exportJSON(options.export_json)

0 commit comments

Comments
 (0)