mirror of
https://github.com/nmap/nmap.git
synced 2026-01-06 06:29:03 +00:00
Avoid handling BaseException, so SysExit and KeyboardInterrupt are propagated. #1834
This commit is contained in:
@@ -648,7 +648,7 @@ class NetworkInventoryTest(unittest.TestCase):
|
||||
inv.add_scan(scan_2)
|
||||
try:
|
||||
inv.remove_scan(scan_3)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
self.assertEqual(added_ips, inv.hosts.keys())
|
||||
self.assertEqual(host_a.hostnames, ["a"])
|
||||
|
||||
@@ -274,14 +274,14 @@ class NmapCommand(object):
|
||||
log.debug(">>> SIGTERM has not worked even after waiting for 5 seconds. Using SIGKILL.") # noqa
|
||||
os.kill(self.command_process.pid, SIGKILL)
|
||||
self.command_process.wait()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
import ctypes
|
||||
ctypes.windll.kernel32.TerminateProcess(
|
||||
int(self.command_process._handle), -1)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def get_path(self):
|
||||
|
||||
@@ -238,7 +238,7 @@ class Paths(object):
|
||||
|
||||
try:
|
||||
return self.__dict__[name]
|
||||
except:
|
||||
except Exception:
|
||||
raise NameError(name)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
|
||||
@@ -137,7 +137,7 @@ class RecentScans(object):
|
||||
|
||||
try:
|
||||
self.recent_scans_file = Path.recent_scans
|
||||
except:
|
||||
except Exception:
|
||||
self.recent_scans_file = False
|
||||
|
||||
if (self.recent_scans_file and
|
||||
|
||||
@@ -552,7 +552,7 @@ class SearchDir(SearchResult, object):
|
||||
try:
|
||||
parsed = NmapParser()
|
||||
parsed.parse_file(scan_file)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
self.scan_results.append(parsed)
|
||||
|
||||
@@ -137,7 +137,7 @@ class TargetList(object):
|
||||
|
||||
try:
|
||||
self.target_list_file = Path.target_list
|
||||
except:
|
||||
except Exception:
|
||||
self.target_list_file = False
|
||||
|
||||
#import pdb; pdb.set_trace()
|
||||
|
||||
@@ -229,7 +229,7 @@ class SearchConfig(UmitConfigParser, object):
|
||||
def get_converted_save_time(self):
|
||||
try:
|
||||
return int(self.save_time[0]) * self.time_list[self.save_time[1]]
|
||||
except:
|
||||
except Exception:
|
||||
# If something goes wrong, return a save time of 60 days
|
||||
return 60 * 60 * 24 * 60
|
||||
|
||||
@@ -307,7 +307,7 @@ class Profile(UmitConfigParser, object):
|
||||
def remove_profile(self, profile_name):
|
||||
try:
|
||||
self.remove_section(profile_name)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
self.save_changes()
|
||||
|
||||
@@ -470,7 +470,7 @@ class NmapOutputHighlight(object):
|
||||
return self.sanity_settings([
|
||||
config_parser.get(
|
||||
property_name, prop, True) for prop in self.setts])
|
||||
except:
|
||||
except Exception:
|
||||
settings = []
|
||||
prop_settings = self.default_highlights[p_name]
|
||||
settings.append(prop_settings["bold"])
|
||||
|
||||
@@ -155,7 +155,7 @@ umitdb = ""
|
||||
|
||||
try:
|
||||
umitdb = Path.db
|
||||
except:
|
||||
except Exception:
|
||||
import os.path
|
||||
from BasePaths import base_paths
|
||||
|
||||
@@ -268,7 +268,7 @@ class UmitDB(object):
|
||||
|
||||
try:
|
||||
self.cursor.execute(drop_string)
|
||||
except:
|
||||
except Exception:
|
||||
connection.rollback()
|
||||
else:
|
||||
connection.commit()
|
||||
|
||||
Reference in New Issue
Block a user