From 9b10711d348be42181d5a245582e346e8c87d0e0 Mon Sep 17 00:00:00 2001 From: pemontto Date: Wed, 13 Jun 2018 16:56:06 +1000 Subject: [PATCH] Nessus bugfixes (#68) * Handle cases where no scans are present * Prevent infinite login loop with incorrect creds * Print actual config file path * Don't overwrite Nessus Synopsis with Description --- vulnwhisp/frameworks/nessus.py | 6 ++++-- vulnwhisp/vulnwhisp.py | 10 +++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/vulnwhisp/frameworks/nessus.py b/vulnwhisp/frameworks/nessus.py index 9b2e1b3..e5002d3 100755 --- a/vulnwhisp/frameworks/nessus.py +++ b/vulnwhisp/frameworks/nessus.py @@ -69,6 +69,8 @@ class NessusAPI(object): while (timeout <= 10) and (not success): data = methods[method](url, data=data, headers=self.headers, verify=False) if data.status_code == 401: + if url == self.base + self.SESSION: + break try: self.login() timeout += 1 @@ -102,7 +104,7 @@ class NessusAPI(object): def get_scan_ids(self): scans = self.get_scans() - scan_ids = [scan_id['id'] for scan_id in scans['scans']] + scan_ids = [scan_id['id'] for scan_id in scans['scans']] if scans['scans'] else [] return scan_ids def count_scan(self, scans, folder_id): @@ -209,4 +211,4 @@ class NessusAPI(object): 'Central Standard Time': 'US/Central', 'Pacific Standard Time': 'US/Pacific', 'None': 'US/Central'} - return time_map.get(tz, None) \ No newline at end of file + return time_map.get(tz, None) diff --git a/vulnwhisp/vulnwhisp.py b/vulnwhisp/vulnwhisp.py index a9b5671..e69794f 100755 --- a/vulnwhisp/vulnwhisp.py +++ b/vulnwhisp/vulnwhisp.py @@ -217,7 +217,7 @@ class vulnWhispererNessus(vulnWhispererBase): self.vprint(e) raise Exception( '{fail} Could not connect to nessus -- Please verify your settings in {config} are correct and try again.\nReason: {e}'.format( - config=self.config, + config=self.config.config_in, fail=bcolors.FAIL, e=e)) except Exception as e: @@ -275,7 +275,7 @@ class vulnWhispererNessus(vulnWhispererBase): if self.nessus_connect: scan_data = self.nessus.get_scans() folders = scan_data['folders'] - scans = scan_data['scans'] + scans = scan_data['scans'] if scan_data['scans'] else [] all_scans = self.scan_count(scans) if self.uuids: scan_list = [scan for scan in all_scans if scan['uuid'] @@ -375,11 +375,7 @@ class vulnWhispererNessus(vulnWhispererBase): for col in columns_to_cleanse: clean_csv[col] = clean_csv[col].astype(str).apply(self.cleanser) - clean_csv['Synopsis'] = \ - clean_csv['Description' - ].astype(str).apply(self.cleanser) - clean_csv.to_csv(relative_path_name, - index=False) + clean_csv.to_csv(relative_path_name, index=False) record_meta = ( scan_name, scan_id,