Correlation
__regenerate_correlation_values(session, correlation_threshold)
async
Method to regenerate the amount of correlations for the values with correlations. :return: if the database was changed :rtype: bool
Source code in src/mmisp/worker/jobs/correlation/regenerate_occurrences_job.py
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 |
|
__regenerate_over_correlating(session, correlation_threshold)
async
Method to regenerate the amount of correlations for the over correlating values. :return: if the database was changed :rtype: bool
Source code in src/mmisp/worker/jobs/correlation/regenerate_occurrences_job.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
regenerate_occurrences_job(ctx, user)
async
Method to regenerate the occurrences of the correlations in the database. Over correlating values and values with correlations are checked. :param user: the user who requested the job :type user: UserData :return: if the job was successful and if the database was changed :rtype: DatabaseChangedResponse
Source code in src/mmisp/worker/jobs/correlation/regenerate_occurrences_job.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
clean_excluded_correlations_job(ctx, user)
async
Task to clean the excluded correlations from the correlations of the MISP database. For every excluded value the correlations are removed. :param user: the user who requested the job :type user: UserData :return: if the job was successful and if the database was changed :rtype: DatabaseChangedResponse
Source code in src/mmisp/worker/jobs/correlation/clean_excluded_correlations_job.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
__process_result(session, plugin_name, value, result)
async
Processes the result of the plugin. :param result: the result of the plugin :type result: InternPluginResult :return: a response with the result of the plugin :rtype: CorrelationResponse :raises: PluginExecutionException: If the result of the plugin is invalid.
Source code in src/mmisp/worker/jobs/correlation/correlation_job.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
correlation_job(ctx, user, data)
async
Method to execute a correlation plugin job. It creates a plugin based on the given data and runs it. Finally, it processes the result and returns a response.
:param user: the user who requested the job :type user: UserData :param data: specifies the value and the plugin to use :type data: CorrelationPluginJobData :return: a response with the result of the correlation by the plugin :rtype: CorrelationResponse
Source code in src/mmisp/worker/jobs/correlation/correlation_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 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 83 84 85 86 87 88 89 90 91 92 93 94 |
|
run(db, attribute, correlation_threshold)
async
Static method to correlate the given value based on the misp_sql database and misp_api interface. :param value: to correlate :param value: string :return: relevant information about the correlation :rtype: CorrelationResponse
Source code in src/mmisp/worker/jobs/correlation/plugins/simple_value.py
24 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
create_correlations(attributes, events, objects, value_id)
Method to create DefaultCorrelation objects based on the given list of MispEventAttribute und list of AddEditGetEventDetails. For every attribute a correlation is created with any other attribute in the list (except itself). The MispEventAttribute at place i in the list has to be an attribute of the AddEditGetEventDetails at place i in the list of AddEditGetEventDetails to function properly.
:param attributes: list of MispEventAttribute to create correlations from :param events: list of the MispEvents the MispEventAttribute occurs in :param value_id: the id of the value for the correlation :return: a list of DefaultCorrelation
Source code in src/mmisp/worker/jobs/correlation/utility.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
get_amount_of_possible_correlations(attributes)
Method to calculate the amount of possible correlations for the given list of Attribute. The amount of possible correlations is the amount of attributes minus the amount of attributes which are in the same event. :param attributes: the attributes to calculate the amount of possible correlations for :type attributes: list[Attribute] :return: the amount of possible correlations :rtype: int
Source code in src/mmisp/worker/jobs/correlation/utility.py
124 125 126 127 128 129 130 131 132 133 134 |
|
save_correlations(db, attributes, value)
async
Method to generate DefaultCorrelation objects from the given list of MispEventAttribute and save them in the database. All MispEventAttribute in the list have to be attributes which have the same value and are correlated with each other. :param attributes: the attributes to correlate with each other :type attributes: list[Attribute] :param value: on which the correlations are based :type value: str :return: a set of UUIDs representing the events the correlation are associated with :rtype: set[UUID]
Source code in src/mmisp/worker/jobs/correlation/utility.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
ChangeThresholdData
Bases: BaseModel
Data to change the threshold.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
59 60 61 62 63 64 |
|
ChangeThresholdResponse
Bases: BaseModel
Response for the change of the threshold.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
40 41 42 43 44 45 46 47 |
|
CorrelationJobData
Bases: BaseModel
Data for a correlation plugin job.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
50 51 52 53 54 55 56 |
|
CorrelationResponse
Bases: BaseModel
Response for the correlation of a value.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
9 10 11 12 13 14 15 16 17 18 19 |
|
DatabaseChangedResponse
Bases: BaseModel
Response for jobs that only change the database.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
31 32 33 34 35 36 37 |
|
InternPluginResult
Bases: BaseModel
Result of a plugin to process by the job.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
67 68 69 70 71 72 73 74 75 76 |
|
TopCorrelationsResponse
Bases: BaseModel
Response for the top correlations job.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
22 23 24 25 26 27 28 |
|
ENV_CORRELATION_PLUGIN_DIRECTORY = 'CORRELATION_PLUGIN_DIRECTORY'
module-attribute
The name of the environment variable that configures the directory where correlation plugins are loaded from.
PLUGIN_DEFAULT_DIRECTORY = ''
module-attribute
The default package used for correlation plugins.
CorrelationConfigData
Bases: BaseSettings
Encapsulates configuration for the correlation worker and its jobs.
Source code in src/mmisp/worker/jobs/correlation/correlation_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_CORRELATION_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/correlation/correlation_config_data.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
top_correlations_job(ctx, user)
async
Method to get a list of all correlations with their occurrence in the database. The list is sorted decreasing by the occurrence. :param user: the user who requested the job :type user: UserData :return: TopCorrelationsResponse with the list and if the job was successful :rtype: TopCorrelationsResponse
Source code in src/mmisp/worker/jobs/correlation/top_correlations_job.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|