mfesiem / msiempy

McAfee SIEM API Python wrapper
https://mfesiem.github.io/docs/msiempy/msiempy.html
MIT License
23 stars 9 forks source link

fix int to str comparison in `qry_load_data()` function #43

Closed deoxykev closed 4 years ago

deoxykev commented 4 years ago

Function would fail when calling .load_data()

Test script

import msiempy.alarm

alarms=msiempy.alarm.AlarmManager(
        time_range='CURRENT_YEAR',
        status_filter='unacknowledged',
        filters=[
                ('alarmName', 'IPS alarm'),
                ('ruleMessage','Wordpress')],
        page_size='400')

alarms.load_data()
print(alarms)

alarms.load_events(extra_fields=['HostID','UserIDSrc'])
[ print alarm['events'].json for alarm in alarms ]

Result

Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
      File "<string>", line 8, in <module>
      File "/usr/local/lib/python3.6/dist-packages/msiempy/alarm.py", line 196, in load_data
        items, completed = self.qry_load_data(**kwargs)
      File "/usr/local/lib/python3.6/dist-packages/msiempy/alarm.py", line 292, in qry_load_data
        return (( filtered_alarms , len(no_filtered_alarms)<int(self.page_size) ))
    TypeError: '<' not supported between instances of 'int' and 'str' 
tristanlatr commented 4 years ago

Thanks, I'm not sure why I have not seen that error before