more flexible config support

This commit is contained in:
pemontto
2019-04-29 16:55:17 +01:00
parent 47409ba0b9
commit eb9695605b
2 changed files with 8 additions and 4 deletions

View File

@ -46,8 +46,8 @@ class NessusAPI(object):
self.logger = logging.getLogger('NessusAPI') self.logger = logging.getLogger('NessusAPI')
if verbose: if verbose:
self.logger.setLevel(logging.DEBUG) self.logger.setLevel(logging.DEBUG)
if username is None or password is None: if not all((username, password)) and not all((access_key, secret_key)):
raise Exception('ERROR: Missing username or password.') raise Exception('ERROR: Missing username, password or API keys.')
self.user = username self.user = username
self.password = password self.password = password

View File

@ -58,8 +58,12 @@ class vulnWhispererBase(object):
except: except:
self.enabled = False self.enabled = False
self.hostname = self.config.get(self.CONFIG_SECTION, 'hostname') self.hostname = self.config.get(self.CONFIG_SECTION, 'hostname')
self.username = self.config.get(self.CONFIG_SECTION, 'username') try:
self.password = self.config.get(self.CONFIG_SECTION, 'password') self.username = self.config.get(self.CONFIG_SECTION, 'username')
self.password = self.config.get(self.CONFIG_SECTION, 'password')
except:
self.username = None
self.password = None
self.write_path = self.config.get(self.CONFIG_SECTION, 'write_path') self.write_path = self.config.get(self.CONFIG_SECTION, 'write_path')
self.db_path = self.config.get(self.CONFIG_SECTION, 'db_path') self.db_path = self.config.get(self.CONFIG_SECTION, 'db_path')
self.verbose = self.config.getbool(self.CONFIG_SECTION, 'verbose') self.verbose = self.config.getbool(self.CONFIG_SECTION, 'verbose')