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 intelmq.bots.experts.sieve.expert.SieveExpertBot

class intelmq.bots.experts.sieve.expert.Procedure

Bases: object

CONTINUE = 1
DROP = 3
KEEP = 2
class intelmq.bots.experts.sieve.expert.SieveExpertBot(bot_id: str, start: bool = False, sighup_event=None, disable_multithreading: Optional[bool] = None)

Bases: intelmq.lib.bot.Bot

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

static compute_basic_math(action, event)
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.

harmonization = None
init()
static init_metamodel()
static is_numeric(num)

Returns True if argument is a number (integer or float).

match_expression(expr, event)
process()
static process_action(action, event)
process_condition(cond, event)
process_conjunction(conj, event)
static process_exist_match(key, op, event)
process_ip_range_match(key, ip_range, event)
process_numeric_match(key, op, value, event)
process_numeric_operator(lhs, op, rhs)
process_rule(rule, event)
process_string_match(key, op, value, event)
static process_string_operator(lhs, op, rhs)
static read_sieve_file(filename, metamodel)
static validate_ip_address(ipaddr)
static validate_ip_range(ip_range)
static validate_numeric_match(num_match)

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)

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.

intelmq.bots.experts.sieve.validator module

Module contents