From eb9695605ba539a00b78cab07892e14d8b44ed51 Mon Sep 17 00:00:00 2001 From: pemontto Date: Mon, 29 Apr 2019 16:55:17 +0100 Subject: [PATCH] more flexible config support --- vulnwhisp/frameworks/nessus.py | 4 ++-- vulnwhisp/vulnwhisp.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/vulnwhisp/frameworks/nessus.py b/vulnwhisp/frameworks/nessus.py index 3a56726..9be8103 100755 --- a/vulnwhisp/frameworks/nessus.py +++ b/vulnwhisp/frameworks/nessus.py @@ -46,8 +46,8 @@ class NessusAPI(object): self.logger = logging.getLogger('NessusAPI') if verbose: self.logger.setLevel(logging.DEBUG) - if username is None or password is None: - raise Exception('ERROR: Missing username or password.') + if not all((username, password)) and not all((access_key, secret_key)): + raise Exception('ERROR: Missing username, password or API keys.') self.user = username self.password = password diff --git a/vulnwhisp/vulnwhisp.py b/vulnwhisp/vulnwhisp.py index d15bc03..1e2b827 100755 --- a/vulnwhisp/vulnwhisp.py +++ b/vulnwhisp/vulnwhisp.py @@ -58,8 +58,12 @@ class vulnWhispererBase(object): except: self.enabled = False self.hostname = self.config.get(self.CONFIG_SECTION, 'hostname') - self.username = self.config.get(self.CONFIG_SECTION, 'username') - self.password = self.config.get(self.CONFIG_SECTION, 'password') + try: + 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.db_path = self.config.get(self.CONFIG_SECTION, 'db_path') self.verbose = self.config.getbool(self.CONFIG_SECTION, 'verbose')