Enrichment
EnrichAttributeData
Bases: BaseModel
Encapsulates the necessary data to create an enrich-attribute job.
Source code in src/mmisp/worker/jobs/enrichment/job_data.py
4 5 6 7 8 9 10 11 12 13 14 |
|
attribute_id
instance-attribute
The ID of the attribute to enrich.
enrichment_plugins
instance-attribute
The list of enrichment plugins to use for enrichment
EnrichEventData
Bases: BaseModel
Encapsulates the data needed for an enrich-event job.
Source code in src/mmisp/worker/jobs/enrichment/job_data.py
17 18 19 20 21 22 23 24 25 26 27 |
|
enrichment_plugins
instance-attribute
The list of enrichment plugins to use for enrichment
event_id
instance-attribute
The ID of the event to enrich.
EnrichEventResult
Bases: BaseModel
Encapsulates the result of an enrich-event job.
Contains the number of created attributes.
Source code in src/mmisp/worker/jobs/enrichment/job_data.py
30 31 32 33 34 35 36 37 38 |
|
created_attributes = 0
class-attribute
instance-attribute
The number of created attributes.
enrich_attribute(db, misp_attribute, enrichment_plugins)
async
Enriches the given event attribute with the specified plugins and returns the created attributes and tags.
:param misp_attribute: The attribute to enrich. :type misp_attribute: AttributeWithTagRelationship :param enrichment_plugins: The plugins to use for enriching the attribute. :type enrichment_plugins: list[str] :return: The created Attributes and Tags. :rtype: EnrichAttributeData
Source code in src/mmisp/worker/jobs/enrichment/enrich_attribute_job.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
enrich_attribute_job(ctx, user_data, data)
async
Provides an implementation of the enrich-attribute job.
Takes a Misp event-attribute as input and runs specified plugins to enrich the attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_data
|
UserData
|
The user who created the job. (not used) |
required |
data
|
EnrichAttributeData
|
The data needed for the enrichment process. |
required |
Returns: The created Attributes and Tags.
Source code in src/mmisp/worker/jobs/enrichment/enrich_attribute_job.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
ENV_ENRICHMENT_PLUGIN_DIRECTORY = 'ENRICHMENT_PLUGIN_DIRECTORY'
module-attribute
The name of the environment variable that configures the directory where enrichment plugins are loaded from.
EnrichmentConfigData
Bases: BaseSettings
Encapsulates configuration for the enrichment worker and its jobs.
Source code in src/mmisp/worker/jobs/enrichment/enrichment_config_data.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
plugin_directory = Field(_PLUGIN_DEFAULT_DIRECTORY, validation_alias=ENV_ENRICHMENT_PLUGIN_DIRECTORY)
class-attribute
instance-attribute
The directory where the plugins are stored.
validate_plugin_module(value)
classmethod
Validates the plugin_directory. If the module is not valid or could not be found a default value is assigned. :param value: The plugin_directory value. :type value: str :return: The given or a default plugin directory.
Source code in src/mmisp/worker/jobs/enrichment/enrichment_config_data.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
enrich_event_job(ctx, user_data, data)
async
Encapsulates a Job enriching a given MISP Event.
Job fetches MISP Attributes from a given Event and executes the specified enrichment plugins for each of these attributes. Newly created Attributes and Tags are attached to the Event in the MISP-Database.
:param user_data: The user who created the job. (not used) :type user_data: UserData :param data: The event id and enrichment plugins. :return: The number of newly created attributes. :rtype: EnrichEventResult
Source code in src/mmisp/worker/jobs/enrichment/enrich_event_job.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|