mirror of https://github.com/OWASP/Nettacker.git
app.py updated to remove noise in exception handling
Signed-off-by: Aarush289 <cs24b064@smail.iitm.ac.in>
This commit is contained in:
parent
b5da801d64
commit
c1a92010eb
|
|
@ -207,6 +207,7 @@ class Nettacker(ArgParser):
|
||||||
Returns:
|
Returns:
|
||||||
True when it ends
|
True when it ends
|
||||||
"""
|
"""
|
||||||
|
log.info("Process started!!")
|
||||||
scan_id = common_utils.generate_random_token(32)
|
scan_id = common_utils.generate_random_token(32)
|
||||||
log.info("ScanID: {0}".format(scan_id))
|
log.info("ScanID: {0}".format(scan_id))
|
||||||
log.info(_("regrouping_targets"))
|
log.info(_("regrouping_targets"))
|
||||||
|
|
@ -215,12 +216,14 @@ class Nettacker(ArgParser):
|
||||||
self.arguments.targets = self.expand_targets(scan_id)
|
self.arguments.targets = self.expand_targets(scan_id)
|
||||||
if not self.arguments.targets:
|
if not self.arguments.targets:
|
||||||
log.info(_("no_live_service_found"))
|
log.info(_("no_live_service_found"))
|
||||||
|
log.info("Process done!!")
|
||||||
return True
|
return True
|
||||||
exit_code = self.start_scan(scan_id)
|
exit_code = self.start_scan(scan_id)
|
||||||
create_report(self.arguments, scan_id)
|
create_report(self.arguments, scan_id)
|
||||||
if self.arguments.scan_compare_id is not None:
|
if self.arguments.scan_compare_id is not None:
|
||||||
create_compare_report(self.arguments, scan_id)
|
create_compare_report(self.arguments, scan_id)
|
||||||
log.info("ScanID: {0} ".format(scan_id) + _("done"))
|
log.info("ScanID: {0} ".format(scan_id) + _("done"))
|
||||||
|
log.info("Process done!!")
|
||||||
return exit_code
|
return exit_code
|
||||||
|
|
||||||
def start_scan(self, scan_id):
|
def start_scan(self, scan_id):
|
||||||
|
|
@ -319,9 +322,8 @@ class Nettacker(ArgParser):
|
||||||
for fut in as_completed(futures):
|
for fut in as_completed(futures):
|
||||||
try:
|
try:
|
||||||
idx, orig_target, canon = fut.result()
|
idx, orig_target, canon = fut.result()
|
||||||
except Exception as e:
|
except (OSError, socket.gaierror) as exc:
|
||||||
# Treat as invalid on error; log with the best context we have
|
log.debug(f"Invalid target (resolver error): {exc!s}")
|
||||||
log.info(f"Invalid target (exception): {e!s}")
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if canon:
|
if canon:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue