Skip to content

Commit

Permalink
Bug fix - Issue #19
Browse files Browse the repository at this point in the history
QualysVMScanScheduleProcessor.py
 - Added a new private function _getDays(str) which converts a comma-separated list of integers into a comma-separated list of day names
 - For weekdays in weekly schedules, uses _getDays() to convert integers in schedule output to strings for schedule input
  • Loading branch information
ianglennon committed Oct 29, 2021
1 parent f24e3f6 commit d41a28c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions QualysVM/QualysVMScanScheduleProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ def _safefind(xml: ET.Element, findstr: str):
return ''


def _getDays(daynums: str):
dayswitch = {
'0': 'sunday',
'1': 'monday',
'2': 'tuesday',
'3': 'wednesday',
'4': 'thursday',
'5': 'friday',
'6': 'saturday'
}
days = ''
for day in daynums.split(','):
day = day.strip()
if days == '':
days = dayswitch.get(day, '')
else:
days = '%s,%s' % (days, dayswitch.get(day, None))
return days


def _safefindlist(xml: ET.Element, findstr: str):
if xml.find('%s' % findstr) is not None:
return xml.findall(findstr)
Expand Down Expand Up @@ -115,6 +135,7 @@ def convertScheduledScan(scan: ET.Element):
if sched.find('WEEKLY') is not None:
frequency_weeks = sched.find('WEEKLY').get('frequency_weeks')
weekdays = sched.find('WEEKLY').get('weekdays')
weekdays = _getDays(weekdays)
requeststr = '%s&occurrence=weekly&frequency_weeks=%s&weekdays=%s' % (requeststr, frequency_weeks, weekdays)
elif sched.find('DAILY') is not None:
frequency_days = sched.find('DAILY').get('frequency_days')
Expand Down

0 comments on commit d41a28c

Please sign in to comment.