1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +00:00

Simplify config reading/writing. Related #449

This commit is contained in:
dmiller
2016-07-11 13:34:49 +00:00
parent 0ac0d8f505
commit fd5926ed1c
2 changed files with 17 additions and 30 deletions

View File

@@ -253,14 +253,16 @@ class Profile(UmitConfigParser, object):
def __init__(self, user_profile=None, *args):
UmitConfigParser.__init__(self, *args)
if not user_profile:
user_profile = Path.scan_profile
try:
if not user_profile:
user_profile = Path.scan_profile
fconf = open(user_profile, 'r')
self.readfp(fconf, user_profile)
fconf.close()
del(fconf)
self.read(user_profile)
except Exception as e:
# No scan profiles found is not a reason to crash.
self.add_profile("Profiles not found",
command="nmap",
description="The {} file was not found".format(user_profile))
self.attributes = {}