mirror of
https://github.com/nmap/nmap.git
synced 2026-10-11 16:44:58 +00:00
Simplify config reading/writing. Related #449
This commit is contained in:
parent
0ac0d8f505
commit
fd5926ed1c
2 changed files with 17 additions and 30 deletions
|
|
@ -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 = {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue