mirror of https://github.com/MISP/PyMISP
chg: Use new format for filtering.
parent
78d9673e24
commit
19a50a7ba7
|
@ -1021,21 +1021,17 @@ class PyMISP(object):
|
||||||
:param values: Values to search
|
:param values: Values to search
|
||||||
:param not_values: Values that should not be in the response
|
:param not_values: Values that should not be in the response
|
||||||
"""
|
"""
|
||||||
to_return = ''
|
to_return = []
|
||||||
if values is not None:
|
if values is not None:
|
||||||
if not isinstance(values, list):
|
if isinstance(values, list):
|
||||||
to_return += values
|
to_return += values
|
||||||
else:
|
else:
|
||||||
to_return += '&&'.join(values)
|
to_return.append(values)
|
||||||
if not_values is not None:
|
if not_values is not None:
|
||||||
if len(to_return) > 0:
|
if isinstance(not_values, list):
|
||||||
to_return += '&&!'
|
to_return += ['!{}'.format(v) for v in not_values]
|
||||||
else:
|
else:
|
||||||
to_return += '!'
|
to_return.append('!{}'.format(not_values))
|
||||||
if not isinstance(not_values, list):
|
|
||||||
to_return += not_values
|
|
||||||
else:
|
|
||||||
to_return += '&&!'.join(not_values)
|
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
def search(self, controller='events', async_callback=None, **kwargs):
|
def search(self, controller='events', async_callback=None, **kwargs):
|
||||||
|
@ -1068,7 +1064,7 @@ class PyMISP(object):
|
||||||
# Event: array('value', 'type', 'category', 'org', 'tags', 'from', 'to', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'searchall', 'metadata', 'published');
|
# Event: array('value', 'type', 'category', 'org', 'tags', 'from', 'to', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'searchall', 'metadata', 'published');
|
||||||
# Attribute: array('value', 'type', 'category', 'org', 'tags', 'from', 'to', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'to_ids', 'deleted');
|
# Attribute: array('value', 'type', 'category', 'org', 'tags', 'from', 'to', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'to_ids', 'deleted');
|
||||||
val = self.__prepare_rest_search(kwargs.pop('values', None), kwargs.pop('not_values', None))
|
val = self.__prepare_rest_search(kwargs.pop('values', None), kwargs.pop('not_values', None))
|
||||||
if len(val) != 0:
|
if val:
|
||||||
query['value'] = val
|
query['value'] = val
|
||||||
|
|
||||||
query['type'] = kwargs.pop('type_attribute', None)
|
query['type'] = kwargs.pop('type_attribute', None)
|
||||||
|
@ -1076,7 +1072,7 @@ class PyMISP(object):
|
||||||
query['org'] = kwargs.pop('org', None)
|
query['org'] = kwargs.pop('org', None)
|
||||||
|
|
||||||
tag = self.__prepare_rest_search(kwargs.pop('tags', None), kwargs.pop('not_tags', None))
|
tag = self.__prepare_rest_search(kwargs.pop('tags', None), kwargs.pop('not_tags', None))
|
||||||
if len(tag) != 0:
|
if tag:
|
||||||
query['tags'] = tag
|
query['tags'] = tag
|
||||||
|
|
||||||
date_from = kwargs.pop('date_from', None)
|
date_from = kwargs.pop('date_from', None)
|
||||||
|
|
Loading…
Reference in New Issue