Allow template defined config form IDs

This commit is contained in:
Austin Taylor
2018-03-04 08:43:35 -05:00
parent f21d3a3f64
commit a658b7abab
2 changed files with 8 additions and 3 deletions

View File

@ -21,6 +21,7 @@ class OpenVAS_API(object):
port=None, port=None,
username=None, username=None,
password=None, password=None,
report_format_id=None,
verbose=True): verbose=True):
if username is None or password is None: if username is None or password is None:
raise Exception('ERROR: Missing username or password.') raise Exception('ERROR: Missing username or password.')
@ -30,6 +31,7 @@ class OpenVAS_API(object):
self.base = 'https://{hostname}:{port}'.format(hostname=hostname, port=port) self.base = 'https://{hostname}:{port}'.format(hostname=hostname, port=port)
self.verbose = verbose self.verbose = verbose
self.processed_reports = 0 self.processed_reports = 0
self.report_format_id = report_format_id
self.headers = { self.headers = {
'Origin': self.base, 'Origin': self.base,
@ -155,7 +157,7 @@ class OpenVAS_API(object):
('report_id', report_id), ('report_id', report_id),
('filter', 'apply_overrides=0 min_qod=70 autofp=0 levels=hml first=1 rows=50 sort-reverse=severity'), ('filter', 'apply_overrides=0 min_qod=70 autofp=0 levels=hml first=1 rows=50 sort-reverse=severity'),
('ignore_pagination', '1'), ('ignore_pagination', '1'),
('report_format_id', 'c1645568-627a-11e3-a660-406186ea4fc5'), ('report_format_id', '{report_format_id}'.format(report_format_id=self.report_format_id)),
('submit', 'Download'), ('submit', 'Download'),
) )
print('Retrieving %s' % report_id) print('Retrieving %s' % report_id)

View File

@ -653,11 +653,14 @@ class vulnWhispererOpenVAS(vulnWhispererBase):
super(vulnWhispererOpenVAS, self).__init__(config=config) super(vulnWhispererOpenVAS, self).__init__(config=config)
self.port = int(self.config.get(self.CONFIG_SECTION, 'port')) self.port = int(self.config.get(self.CONFIG_SECTION, 'port'))
self.template_id = self.config.get(self.CONFIG_SECTION, 'report_format_id') self.report_format_id = self.config.get(self.CONFIG_SECTION, 'report_format_id')
self.develop = True self.develop = True
self.purge = purge self.purge = purge
self.scans_to_process = None self.scans_to_process = None
self.openvas_api = OpenVAS_API(hostname=self.hostname, port=self.port, username=self.username, self.openvas_api = OpenVAS_API(hostname=self.hostname,
port=self.port,
report_format_id=self.report_format_id,
username=self.username,
password=self.password) password=self.password)
def whisper_reports(self, output_format='json', launched_date=None, report_id=None, cleanup=True): def whisper_reports(self, output_format='json', launched_date=None, report_id=None, cleanup=True):