intelmq.bots.experts.sieve package¶
Submodules¶
intelmq.bots.experts.sieve.expert module¶
SieveExpertBot filters and modifies events based on a specification language similar to mail sieve.
- param file:
string
- intelmq.bots.experts.sieve.expert.BOT¶
alias of
SieveExpertBot
- class intelmq.bots.experts.sieve.expert.Procedure(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
Enum
- CONTINUE = 1¶
- DROP = 3¶
- KEEP = 2¶
- class intelmq.bots.experts.sieve.expert.SieveExpertBot(*args, **kwargs)¶
Bases:
ExpertBot
Filter and modify events based on a sieve-based language
- static check(parameters)¶
The bot’s own check function can perform individual checks on it’s parameters. init() is not called before, this is a staticmethod which does not require class initialization.
- Parameters:
parameters – Bot’s parameters, defaults and runtime merged together
- Returns:
- None or a list of [log_level, log_message] pairs, both
strings. log_level must be a valid log level.
- Return type:
output
- compute_basic_math(action, event) str ¶
- file: str = '/opt/intelmq/var/lib/bots/sieve/filter.sieve'¶
- static get_linecol(model_obj, as_dict=False)¶
Gets the position of a model object in the sieve file.
- Parameters:
model_obj – the model object
as_dict – return the position as a dict instead of a tuple.
- Returns:
Returns the line and column number for the model object’s position in the sieve file. Default return type is a tuple of (line,col). Optionally, returns a dict when as_dict == True.
- init() None ¶
- static init_metamodel()¶
- match_expression(expr, event) bool ¶
- parse_timeattr(time_attr) datetime | timedelta ¶
Parses relative or absolute time specification.
- process() None ¶
- process_bool_match(key, op, value, event)¶
- process_condition(cond, event) bool ¶
- process_conjunction(conj, event) bool ¶
- process_date_match(key, op, value, event) bool ¶
- static process_exist_match(key, op, event) bool ¶
- process_ip_range_match(key, ip_range, event) bool ¶
- process_list_match(key, op, value, event) bool ¶
- process_multi_numeric_match(key, op, value, event) bool ¶
- process_multi_string_match(key, op, value, event) bool ¶
- process_single_numeric_match(key, op, value, event) bool ¶
- process_single_string_match(key, op, value, event) bool ¶
- process_statement(statement, event)¶
- static read_sieve_file(filename, metamodel)¶
- static validate_ip_address(ipaddr) None ¶
- static validate_ip_range(ip_range) None ¶
- static validate_numeric_match(num_match) None ¶
Validates a numeric match expression.
Checks if the event key (given on the left hand side of the expression) is of a valid type for a numeric match, according the the IntelMQ harmonization.
- Raises:
TextXSemanticError – when the key is of an incompatible type for numeric match expressions.
- static validate_string_match(str_match) None ¶
Validates a string match expression.
Checks if the type of the value given on the right hand side of the expression matches the event key in the left hand side, according to the IntelMQ harmonization.
- Raises:
TextXSemanticError – when the value is of incompatible type with the event key.