fix xml encoding issue #156
This commit is contained in:
@ -74,7 +74,7 @@ class qualysWhisperAPI(object):
|
|||||||
E.filters(
|
E.filters(
|
||||||
E.Criteria({'field': 'status', 'operator': 'EQUALS'}, status))))
|
E.Criteria({'field': 'status', 'operator': 'EQUALS'}, status))))
|
||||||
xml_output = self.qgc.request(self.COUNT_WASSCAN, parameters)
|
xml_output = self.qgc.request(self.COUNT_WASSCAN, parameters)
|
||||||
root = objectify.fromstring(xml_output)
|
root = objectify.fromstring(xml_output.encode('utf-8'))
|
||||||
return root.count.text
|
return root.count.text
|
||||||
|
|
||||||
def get_reports(self):
|
def get_reports(self):
|
||||||
@ -127,17 +127,21 @@ class qualysWhisperAPI(object):
|
|||||||
qualys_api_limit = limit
|
qualys_api_limit = limit
|
||||||
dataframes = []
|
dataframes = []
|
||||||
_records = []
|
_records = []
|
||||||
total = int(self.get_was_scan_count(status=status))
|
try:
|
||||||
self.logger.info('Retrieving information for {} scans'.format(total))
|
total = int(self.get_was_scan_count(status=status))
|
||||||
for i in range(0, total):
|
self.logger.error('Already have WAS scan count')
|
||||||
if i % limit == 0:
|
self.logger.info('Retrieving information for {} scans'.format(total))
|
||||||
if (total - i) < limit:
|
for i in range(0, total):
|
||||||
qualys_api_limit = total - i
|
if i % limit == 0:
|
||||||
self.logger.info('Making a request with a limit of {} at offset {}'.format((str(qualys_api_limit), str(i + 1))))
|
if (total - i) < limit:
|
||||||
scan_info = self.get_scan_info(limit=qualys_api_limit, offset=i + 1, status=status)
|
qualys_api_limit = total - i
|
||||||
_records.append(scan_info)
|
self.logger.info('Making a request with a limit of {} at offset {}'.format((str(qualys_api_limit), str(i + 1))))
|
||||||
self.logger.debug('Converting XML to DataFrame')
|
scan_info = self.get_scan_info(limit=qualys_api_limit, offset=i + 1, status=status)
|
||||||
dataframes = [self.xml_parser(xml) for xml in _records]
|
_records.append(scan_info)
|
||||||
|
self.logger.debug('Converting XML to DataFrame')
|
||||||
|
dataframes = [self.xml_parser(xml) for xml in _records]
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.error("Couldn't process all scans: {}".format(e))
|
||||||
|
|
||||||
return pd.concat(dataframes, axis=0).reset_index().drop('index', axis=1)
|
return pd.concat(dataframes, axis=0).reset_index().drop('index', axis=1)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user