Shared Query Filters (DEPRECATED)
Warning
Incydr functionality is deprecated. Use the resources at https://developer.code42.com/ instead.
- class py42.sdk.queries.query_filter.FilterGroup(filter_list, filter_clause='AND')
Bases:
objectClass for constructing a logical sub-group of related filters from a list of
QueryFilterobjects. Takes a list ofQueryFilterobjects and combines them logically using the passed in filter clause (ANDorOR).When
str()is called on aFilterGroupinstance, the combined filter items are transformed into a JSON string to be used as part of a Forensic Search or Alert query.When
dict()is called on aFilterGroupinstance, the combined filter items are transformed into the Python dict equivalent of their JSON representation. This can be useful for programmatically manipulating aFilterGroupafter it’s been created.- property filter_clause
The clause joining the filters, such as
ANDorOR.
- property filter_list
The list of
QueryFilterobjects in this group.
- classmethod from_dict(_dict)
Creates an instance of
FilterGroupfrom the values found in_dict._dictmust contain keysfiltersandfilterClause.- Parameters:
_dict (dict) – A dictionary containing keys
term,operator, andvalue.- Returns:
- class py42.sdk.queries.query_filter.QueryFilter(term, operator, value=None)
Bases:
objectClass for constructing a single filter object for use in a search query.
When
str()is called on aQueryFilterinstance, the (term,operator,value) attribute combination is transformed into a JSON string to be used as part of a Forensic Search or Alert query.When
dict()is called on aQueryFilterinstance, the (term,operator,value) attribute combination is transformed into the Python dict equivalent of their JSON representation. This can be useful for programmatically manipulating aQueryFilterafter it’s been created.- classmethod from_dict(_dict)
Creates an instance of
QueryFilterfrom the values found in_dict._dictmust contain keysterm,operator, andvalue.- Parameters:
_dict (dict) – A dictionary containing keys
term,operator, andvalue.- Returns:
- property operator
The operator between
termandvalue, such asISor IS_NOT.
- property term
The term of the filter, such as
actororsharedWith.
- property value
The value used to filter results.
- class py42.sdk.queries.query_filter.QueryFilterBooleanField
Bases:
objectHelper class for creating filters where the search value is a boolean.
- classmethod is_false()
Returns a
FilterGroupthat is useful for finding results where the value with keyself._termis False.- Returns:
- classmethod is_true()
Returns a
FilterGroupthat is useful for finding results where the value with keyself._termis True.- Returns:
- class py42.sdk.queries.query_filter.QueryFilterStringField
Bases:
objectHelper class for creating filters where the search value is a string.
- classmethod eq(value)
Returns a
FilterGroupthat is useful for finding results where the value with keyself._termequals the providedvalue.- Parameters:
value (str) – The value to match on.
- Returns:
- classmethod is_in(value_list)
Returns a
FilterGroupthat is useful for finding results where the value with the keyself._termis in the providedvalue_list.- Parameters:
value_list (list) – The list of values to match on.
- Returns:
- classmethod not_eq(value)
Returns a
FilterGroupthat is useful for finding results where the value with keyself._termdoes not equal the providedvalue.- Parameters:
value (str) – The value to exclude on.
- Returns:
- classmethod not_in(value_list)
Returns a
FilterGroupthat is useful for finding results where the value with the keyself._termis not in the providedvalue_list.- Parameters:
value_list (list) – The list of values to exclude on.
- Returns:
- class py42.sdk.queries.query_filter.QueryFilterTimestampField
Bases:
objectHelper class for creating filters where the search value is a timestamp.
- classmethod in_range(start_value, end_value)
Returns a
FilterGroupthat is useful for finding results where the value with keyself._termis in range between the providedstart_valueandend_value.- Parameters:
start_value (str or int or float or datetime) – The start value used to filter results.
end_value (str or int or float or datetime) – The end value used to filter results.
- Returns:
- classmethod on_or_after(value)
Returns a
FilterGroupthat is useful for finding results where the value with keyself._term` is on or after the provided ``value.- Parameters:
value (str or int or float or datetime) – The value used to filter results.
- Returns:
- classmethod on_or_before(value)
Returns a
FilterGroupthat is useful for finding results where the value with keyself._termis on or before the providedvalue.- Parameters:
value (str or int or float or datetime) – The value used to filter results.
- Returns:
- classmethod on_same_day(value)
Returns a
FilterGroupthat is useful for finding results where the value with keyself._termis within the same calendar day as the providedvalue.- Parameters:
value (str or int or float or datetime) – The value used to filter results.
- Returns:
- py42.sdk.queries.query_filter.create_eq_filter_group(term, value)
“Creates a
FilterGroupfor filtering results where the value with keytermequals the given value. Useful for creatingISfilters that are not yet supported in py42 or programmatically crafting filter groups.- Parameters:
term – (str): The term of the filter, such as
actororsharedWith.value (str) – The value used to match on.
- Returns:
- py42.sdk.queries.query_filter.create_filter_group(query_filter_list, filter_clause)
Creates a
FilterGroupobject. Useful for programmatically crafting query filters, such as filters not yet defined in py42. Alternatively, if you want to create custom filter groups with already defined operators (such as IS or IS_IN), see the other methods in this module, such ascreate_eq_filter_group().- Parameters:
query_filter_list (list) – a list of
QueryFilterobjects.filter_clause (str) – The clause joining the filters, such as
ANDorOR.
- Returns:
- py42.sdk.queries.query_filter.create_in_range_filter_group(term, start_value, end_value)
“Creates a
FilterGroupfor filtering results where the value with keytermis in the given range. Examples include values describing dates. Useful for creating a combination ofON_OR_AFTERandON_OR_BEFOREfilters that are not yet supported in py42 or programmatically crafting filter groups.- Parameters:
term – (str): The term of the filter, such as
eventTimestamp.start_value (str or int) – The start value used to filter results.
end_value (str or int) – The end value used to filter results.
- Returns:
- py42.sdk.queries.query_filter.create_is_in_filter_group(term, value_list)
“Creates a
FilterGroupfor filtering results where the value with keytermis one of several values. Useful for creatingIS_INfilters that are not yet supported in py42 or programmatically crafting filter groups.- Parameters:
term – (str): The term of the filter, such as
actororsharedWith.value_list (list) – The list of values to match on.
- Returns:
- py42.sdk.queries.query_filter.create_not_eq_filter_group(term, value)
“Creates a
FilterGroupfor filtering results where the value with keytermdoes not equal the given value. Useful for creatingIS_NOTfilters that are not yet supported in py42 or programmatically crafting filter groups.- Parameters:
term – (str): The term of the filter, such as
actororsharedWith.value (str) – The value used to exclude on.
- Returns:
- py42.sdk.queries.query_filter.create_not_in_filter_group(term, value_list)
“Creates a
FilterGroupfor filtering results where the value with keytermis not one of several values. Useful for creatingNOT_INfilters that are not yet supported in py42 or programmatically crafting filter groups.- Parameters:
term – (str): The term of the filter, such as
actororsharedWith.value_list (list) – The list of values to exclude on.
- Returns:
- py42.sdk.queries.query_filter.create_on_or_after_filter_group(term, value)
“Creates a
FilterGroupfor filtering results where the value with keytermis on or after the given value. Examples include values describing dates. Useful for creatingON_OR_AFTERfilters that are not yet supported in py42 or programmatically crafting filter groups.- Parameters:
term – (str): The term of the filter, such as
eventTimestamp.value (str or int) – The value used to filter results.
- Returns:
- py42.sdk.queries.query_filter.create_on_or_before_filter_group(term, value)
“Creates a
FilterGroupfor filtering results where the value with keytermis on or before the given value. Examples include values describing dates. Useful for creatingON_OR_BEFOREfilters that are not yet supported in py42 or programmatically crafting filter groups.- Parameters:
term – (str): The term of the filter, such as
eventTimestamp.value (str or int) – The value used to filter results.
- Returns:
- py42.sdk.queries.query_filter.create_query_filter(term, operator, value=None)
Creates a
QueryFilterobject. Useful for programmatically crafting query filters, such as filters not yet defined in py42.- Parameters:
term (str) – The term of the filter, such as
actororsharedWith.operator (str) – The operator between
termandvalue, such asISor IS_NOT.value (str) – The value used to filter results.
- Returns:
- py42.sdk.queries.query_filter.create_within_the_last_filter_group(term, value)
Returns a
FilterGroupthat is useful for finding results where the keytermis anEventTimestamp._termand the value is one of the EventTimestamp attributes as value.- Parameters:
value (str) – EventTimestamp attribute.
- Returns: