Home
log = logging.getLogger(__name__)
module-attribute
Encapsulates the logic of the API for the worker router
get_job_count(name)
async
Returns the number of jobs in the specified worker queue :param name: Contains the name of the worker :type name: WorkerEnum :return: The amount of jobs in the worker queue :rtype: int
Source code in src/mmisp/worker/controller/worker_controller.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
is_worker_active(name)
Checks if the specified worker is active :param name: Contains the name of the worker :type name: WorkerEnum :return: True if the worker active, else False :rtype: bool
Source code in src/mmisp/worker/controller/worker_controller.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
__convert_celery_task_state(job_state)
Converts a celery task state to a job status enum. :param job_state: The state of the job. :type job_state: str :return: returns a value of the job status enum :rtype: JobStatusEnum
Source code in src/mmisp/worker/controller/job_controller.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
cancel_job(job_id)
Revokes a given job. :param job_id: The ID of the job :type job_id: str :return: Whether the revoke action was successful. :rtype: bool
Source code in src/mmisp/worker/controller/job_controller.py
54 55 56 57 58 59 60 61 62 63 |
|
create_job(job, *args, **kwargs)
Enqueues a given celery task.
:param job: The celery Task to enqueue :type job: celery.Task :param args: Arguments passed to the job. :param kwargs: Arguments passed to the job. :return: The job_id of the created job and a success status. :rtype: CreateJobResponse
Source code in src/mmisp/worker/controller/job_controller.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
get_job_result(job_id)
Returns the result of the specified job :param job_id: is the id of the job :type job_id: str :return: a special ResponseData depending on the job :rtype: ResponseData
Source code in src/mmisp/worker/controller/job_controller.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
get_job_status(job_id)
Returns the status of the given job.
:param job_id: The ID of the job. :type job_id: str :return: The status of the job. :rtype: JobStatusEnum :raises NotExistentJobException: If there is no job with the specified ID.
Source code in src/mmisp/worker/controller/job_controller.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Module implements the Celery Application.
JOB_CREATED_STATE: str = 'ENQUEUED'
module-attribute
Custom Celery task state for enqueued tasks.
celery_app: Celery = Celery(backend=CeleryConfig.result_backend, broker=CeleryConfig.broker_url)
module-attribute
The celery instance
CeleryConfig
Encapsulates configuration for Celery.
Source code in src/mmisp/worker/controller/celery_client.py
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
update_sent_state(sender=None, headers=None, **kwargs)
Function sets a custom task state for enqueued tasks. :param sender: The name of the task to update its state. :type sender: celery.Task :param headers: The task message headers :type headers: dict :param kwargs: Not needed
Source code in src/mmisp/worker/controller/celery_client.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
ENV_PREFIX: str = 'MMISP'
module-attribute
Prefix for the configuration environment variables.
ConfigData
Bases: BaseModel
Base class for configuration data.
Source code in src/mmisp/worker/config.py
28 29 30 31 32 33 |
|
SystemConfigData
Bases: ConfigData
Encapsulates the general configuration of the MMISP Worker application.
Source code in src/mmisp/worker/config.py
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 |
|
api_host: str = '0.0.0.0'
class-attribute
instance-attribute
The host the API binds to.
api_key: str = ''
class-attribute
instance-attribute
The key for the API.
api_port: PositiveInt = 5000
class-attribute
instance-attribute
The port exposing the API.
autostart_correlation_worker: bool = False
class-attribute
instance-attribute
If True, the correlation worker will be started automatically at application start.
autostart_email_worker: bool = False
class-attribute
instance-attribute
If True, the email worker will be started automatically at application start.
autostart_enrichment_worker: bool = False
class-attribute
instance-attribute
If True, the enrichment worker will be started automatically at application start.
autostart_processfreetext_worker: bool = False
class-attribute
instance-attribute
If True, the process free text worker will be started automatically at application start.
autostart_pull_worker: bool = False
class-attribute
instance-attribute
If True, the pull worker will be started automatically at application start.
autostart_push_worker: bool = False
class-attribute
instance-attribute
If True, the push worker will be started automatically at application start.
worker_termination_timeout: int = 30
class-attribute
instance-attribute
The time in seconds to wait for the worker to terminate before kill.
is_autostart_for_worker_enabled(worker)
Returns the autostart configuration for the specified worker. :param worker: The worker to check the autostart configuration for.
Source code in src/mmisp/worker/config.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
read_from_env()
Reads the configuration from the environment.
Source code in src/mmisp/worker/config.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
ENV_REDIS_DB: str = f'{ENV_PREFIX}_REDIS_DB'
module-attribute
The environment variable name for the Redis database name.
ENV_REDIS_HOST: str = f'{ENV_PREFIX}_REDIS_HOST'
module-attribute
The environment variable name for the Redis host.
ENV_REDIS_PASSWORD: str = f'{ENV_PREFIX}_REDIS_PASSWORD'
module-attribute
The environment variable name for the Redis password.
ENV_REDIS_PORT: str = f'{ENV_PREFIX}_REDIS_PORT'
module-attribute
The environment variable name for the Redis port.
ENV_REDIS_USERNAME: str = f'{ENV_PREFIX}_REDIS_USERNAME'
module-attribute
The environment variable name for the Redis username.
MMispRedisConfigData
Bases: ConfigData
Encapsulates configuration data for the Redis connection.
Source code in src/mmisp/worker/misp_database/mmisp_redis_config.py
23 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 |
|
db: int = 0
class-attribute
instance-attribute
The database name of the Redis database.
host: str = 'localhost'
class-attribute
instance-attribute
The host of the Redis database.
password: str = ''
class-attribute
instance-attribute
The password of the Redis database.
port: int = 6379
class-attribute
instance-attribute
The port of the Redis database.
username: str = ''
class-attribute
instance-attribute
The username of the Redis database.
read_from_env()
Reads the configuration from the environment.
Source code in src/mmisp/worker/misp_database/mmisp_redis_config.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
decode_json_response(response)
Decodes the JSON response from the MISP API
:param response: response from the MISP API :type response: Response :return: returns the decoded JSON response :rtype: dict
Source code in src/mmisp/worker/misp_database/misp_api_utils.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
translate_dictionary(dictionary, translation_dict)
translates the keys of a dictionary according to the translation dictionary
:param dictionary: dictionary to be translated :type dictionary: dict :param translation_dict: translation dictionary including the old key as the key and the new key as the value :type translation_dict: dict[str, str] :return: returns the translated dictionary :rtype: dict
Source code in src/mmisp/worker/misp_database/misp_api_utils.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
MispAPI
This class is used to communicate with the MISP API.
it encapsulates the communication with the MISP API and provides methods to retrieve and send data. the data is parsed and validated by the MispAPIParser and MispAPIUtils classes, and returns the data as MMISP dataclasses.
Source code in src/mmisp/worker/misp_database/misp_api.py
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 95 96 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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
|
__get_session(server=None)
async
This method is used to get the session for the given server_id if a session for the given server_id already exists, it returns the existing session, otherwise it sets up a new session and returns it.
:param server: server to get the session for, if no server is given, the own API is used :type server: Server :return: returns a session to the specified server :rtype: Session
Source code in src/mmisp/worker/misp_database/misp_api.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
__get_url(path, server=None)
This method is used to get the url for the given server, adding the given path to the url.
if no server is given, it uses the default url from the config, otherwise it uses the url of the given server.
:param path: path to add to the url :type path: str :param server: remote server to get the url for :type server: Server :return: returns the url for the given server with the path added :rtype: str
Source code in src/mmisp/worker/misp_database/misp_api.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
__join_path(url, path)
staticmethod
This method is used to join the given path to the given url. it checks if the path starts with a slash, if it does not, it also adds a slash to the url.
:param url: url to join the path to :type url: str :param path: path to join to the url :type path: str :return: returns the url with the path added :rtype: str
Source code in src/mmisp/worker/misp_database/misp_api.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
__send_request(request, server=None, **kwargs)
async
This method is used to send the given request and return the response.
:param request: the request to send :type request: PreparedRequest :param kwargs: keyword arguments :type kwargs: dict[str, Any] :return: returns the response of the request :rtype: dict
Source code in src/mmisp/worker/misp_database/misp_api.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
__setup_api_session()
This method is used to set up the session for the API.
:return: returns the session that was set up :rtype: Session
Source code in src/mmisp/worker/misp_database/misp_api.py
54 55 56 57 58 59 60 61 62 63 64 65 |
|
__setup_remote_api_session(server_id)
async
This method is used to set up the session for the remote API.
:param server_id: server id of the remote server to set up the session for :type server_id: int :return: returns the session to the specified server that was set up :rtype: Session
Source code in src/mmisp/worker/misp_database/misp_api.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
attach_attribute_tag(attribute_id, tag_id, local, server=None)
async
Attaches a tag to an attribute
:param attribute_id: The ID of the attribute. :type attribute_id: int :param tag_id: The ID of the tag. :type tag_id: int :param local: If the tag is to be attached only locally. :type local: bool :param server: the server to attach the tag to the attribute on, if no server is given, the own API is used :type server: Server :return: true if the attachment was successful :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_api.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
|
attach_event_tag(event_id, tag_id, local, server=None)
async
Attaches a tag to an event
:param event_id: The ID of the event. :type event_id: int :param tag_id: The ID of the tag. :type tag_id: int :param local: If the tag is to be attached only locally. :type local: bool :param server: the server to attach the tag to the event on, if no server is given, the own API is used :type server: Server :return: :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_api.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
|
create_attribute(attribute, server=None)
async
creates the given attribute on the server
:param attribute: contains the required attributes to creat an attribute :type attribute: AddAttributeBody :param server: the server to create the attribute on, if no server is given, the own API is used :type server: Server :return: The attribute id if the creation was successful. -1 otherwise. :rtype: int
Source code in src/mmisp/worker/misp_database/misp_api.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
|
create_tag(tag, server=None)
async
Creates the given tag on the server :param tag: The tag to create. :type tag: TagCreateBody :param server: The server to create the tag on. If no server is given, the own MMISP-API Server is used. :type server: Server :return: the id of the created tag :rtype: int
Source code in src/mmisp/worker/misp_database/misp_api.py
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
|
get_attribute(attribute_id, server=None)
async
Returns the attribute with the given attribute_id.
:param attribute_id: the id of the attribute to get :type attribute_id: int :param server: the server to get the attribute from, if no server is given, the own API is used :type server: Server :return: returns the attribute with the given attribute_id :rtype: GetAttributeAttributes
Source code in src/mmisp/worker/misp_database/misp_api.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
|
get_event(event_id, server=None)
async
Returns the event with the given event_id from the given server, the own API is used if no server is given.
:param event_id: the id of the event to get :type event_id: int :param server: the server to get the event from, if no server is given, the own API is used :type server: Server :return: returns the event with the given event_id from the given server :rtype: AddEditGetEventDetails
Source code in src/mmisp/worker/misp_database/misp_api.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
get_event_attributes(event_id, server=None)
async
Returns all attribute object of the given event, represented by given event_id.
:param event_id: of the event :type event_id: int :param server: the server to get the attribute from, if no server is given, the own API is used :type server: Server :return: a list of all attributes :rtype: list[SearchAttributesAttributesDetails]
Source code in src/mmisp/worker/misp_database/misp_api.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|
get_object(object_id, server=None)
async
Returns the object with the given object_id.
:param object_id: id of the object :type object_id: int :param server: the server to get the object from, if no server is given, the own API is used :type server: Server :return: The object :rtype: ObjectWithAttributesResponse
Source code in src/mmisp/worker/misp_database/misp_api.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
get_sharing_group(sharing_group_id, server=None)
async
Returns the sharing group with the given sharing_group_id
:param sharing_group_id: id of the sharing group to get from the API :type sharing_group_id: int :param server: the server to get the sharing group from, if no server is given, the own API is used :type server: Server :return: returns the sharing group that got requested :rtype: ViewUpdateSharingGroupLegacyResponse
Source code in src/mmisp/worker/misp_database/misp_api.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
|
get_sharing_groups(server=None)
async
Returns all sharing groups from the given server, if no server is given, the own API is used.
:param server: the server to get the sharing groups from, if no server is given, the own API is used :type server: Server :return: returns all sharing groups from the given server :rtype: list[GetAllSharingGroupsResponseResponseItem]
Source code in src/mmisp/worker/misp_database/misp_api.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
get_user(user_id, server=None)
async
Returns the user with the given user_id.
:param user_id: id of the user :type user_id: int :param server: the server to get the user from, if no server is given, the own API is used :type server: Server :return: returns the user with the given user_id :rtype: MispUser
Source code in src/mmisp/worker/misp_database/misp_api.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
modify_attribute_tag_relationship(attribute_tag_id, relationship_type, server=None)
async
Modifies the relationship of the given tag to the given attribute Endpoint documented at: https://www.misp-project.org/2022/10/10/MISP.2.4.164.released.html/
:param attribute_tag_id: The ID of the attribute-tag assignment. :type attribute_tag_id: int :param relationship_type: The relationship type to set. :type relationship_type: str :param server: the server to modify the relationship on, if no server is given, the own API is used :type server: Server :return: returns true if the modification was successful :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_api.py
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
|
modify_event_tag_relationship(event_tag_id, relationship_type, server=None)
async
Modifies the relationship of the given tag to the given event Endpoint documented at: https://www.misp-project.org/2022/10/10/MISP.2.4.164.released.html/
:param event_tag_id: The ID of the event-tag assignment. :type event_tag_id: int :param relationship_type: The relationship type to set. :type relationship_type: str :param server: the server to modify the relationship on, if no server is given, the own API is used :type server: Server :return: returns true if the modification was successful :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_api.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
|
MMispRedis
Encapsulates the connection to the MMISP Redis database.
Source code in src/mmisp/worker/misp_database/mmisp_redis.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
get_enqueued_celery_tasks(queue)
async
Returns the number of enqueued celery tasks in the given queue. :param queue: The queue name. :type queue: str
Source code in src/mmisp/worker/misp_database/mmisp_redis.py
25 26 27 28 29 30 31 32 33 34 35 36 |
|
helper module to interact with misp database
add_correlation_value(session, value)
async
Adds a new value to correlation_values table or returns the id of the current entry with the same value. :param value: to add or get id of in the correlation_values table :type value: str :return: the id of the value in the correlation_values table :rtype: int
Source code in src/mmisp/worker/misp_database/misp_sql.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
add_correlations(session, correlations)
async
Adds a list of correlations to the database. Returns True if at least one correlation was added, False otherwise. Doesn't add correlations that are already in the database. :param correlations: list of correlations to add :type correlations: list[DefaultCorrelation] :return: true if at least one correlation was added, false otherwise :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_sql.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
|
add_over_correlating_value(session, value, count)
async
Adds a new value to over_correlating_values table or updates the current entry with the same value. Returns True if value was added or updated, False otherwise. :param value: add or update :type value: str :param count: occurrence of value :type count: int :return: True if value was added or updated, False otherwise :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_sql.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
delete_correlations(session, value)
async
Deletes all correlations with value from database. Returns True if value was in database, False otherwise. :param value: to delete the correlations of :type value: str :return: True if value was in database, False otherwise :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_sql.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
|
delete_over_correlating_value(session, value)
async
Deletes value from over_correlating_values table. Returns True if value was in table, False otherwise. :param value: row to delete :type value: str :return: true if value was in table, false otherwise :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_sql.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
filter_blocked_clusters(session, clusters)
async
Get all blocked clusters from database and remove them from clusters list. :param clusters: list of clusters to check :type clusters: list[GetGalaxyClusterResponse] :return: list without blocked clusters :rtype: list[MispGalaxyCluster]
Source code in src/mmisp/worker/misp_database/misp_sql.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
filter_blocked_events(session, events, use_event_blocklist, use_org_blocklist)
async
Clear the list from events that are listed as blocked in the misp database. Also, if the org is blocked, the events in the org are removed from the list. Return the list without the blocked events. :param events: list to remove blocked events from :type events: list[AddEditGetEventDetails] :param use_event_blocklist: if True, blocked events are removed from the list :type use_event_blocklist: bool :param use_org_blocklist: if True, the events from blocked orgs are removed from the list :type use_org_blocklist: bool :return: the list without the blocked events :rtype: list[MispEvent]
Source code in src/mmisp/worker/misp_database/misp_sql.py
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 |
|
get_api_authkey(session, server_id)
async
Method to get the API authentication key of the server with the given ID. :param server_id: The ID of the server. :type server_id: int :return: The API authentication key of the server. :rtype: str
Source code in src/mmisp/worker/misp_database/misp_sql.py
26 27 28 29 30 31 32 33 34 35 36 |
|
get_attribute_tag(session, attribute_tag_id)
async
Method to get the AttributeTag object with the given ID.
:param attribute_tag_id: The ID of the attribute-tag object. :type attribute_tag_id: int :return: The AttributeTag object or None if it doesn't exist. :rtype: AttributeTag | None
Source code in src/mmisp/worker/misp_database/misp_sql.py
380 381 382 383 384 385 386 387 388 389 390 391 |
|
get_attribute_tag_id(session, attribute_id, tag_id)
async
Method to get the ID of the attribute-tag object associated with the given attribute-ID and tag-ID.
:param attribute_id: The ID of the attribute. :type attribute_id: int :param tag_id: The ID of the tag. :type tag_id: int :return: The ID of the attribute-tag object or -1 if the object does not exist. :rtype: int
Source code in src/mmisp/worker/misp_database/misp_sql.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
get_attributes_with_same_value(session, value)
async
Method to get all attributes with the same value from database. :param value: to get attributes with :type value: str :return: list of attributes with the same value :rtype: list[Attribute]
Source code in src/mmisp/worker/misp_database/misp_sql.py
87 88 89 90 91 92 93 94 95 96 97 |
|
get_event_tag_id(session, event_id, tag_id)
async
Method to get the ID of the event-tag object associated with the given event-ID and tag-ID.
:param event_id: The ID of the event. :type event_id: int :param tag_id: The ID of the tag. :type tag_id: int :return: The ID of the event-tag object or -1 if the object does not exist. :rtype: int
Source code in src/mmisp/worker/misp_database/misp_sql.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
|
get_excluded_correlations(session)
async
Method to get all values from correlation_exclusions table. :return: all values from correlation_exclusions table :rtype: list[str]
Source code in src/mmisp/worker/misp_database/misp_sql.py
121 122 123 124 125 126 127 128 |
|
get_number_of_correlations(session, value, only_over_correlating_table)
async
Returns the number of correlations of value in the database. If only_over_correlating_table is True, only the value in the over_correlating_values table is returned. Else the number of correlations in the default_correlations table is returned Attention: It is assumed that the value is in the over_correlating_values table if only_over_correlating_table is True. :param value: to get number of correlations of :type value: str :param only_over_correlating_table: if True, only the value in the over_correlating_values table is returned :type only_over_correlating_table: bool :return: number of correlations of value in the database
Source code in src/mmisp/worker/misp_database/misp_sql.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
get_over_correlating_values(session)
async
Method to get all values from over_correlating_values table with their occurrence. :return: all values from over_correlating_values table with their occurrence :rtype: list[tuple[str, int]]
Source code in src/mmisp/worker/misp_database/misp_sql.py
111 112 113 114 115 116 117 118 |
|
get_post(session, post_id)
async
Method to get a post from database. :param post_id: the id of the post to get :type post_id: int :return: the post with the given id :rtype: MispPost
Source code in src/mmisp/worker/misp_database/misp_sql.py
139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
get_values_with_correlation(session)
async
" Method to get all values from correlation_values table. :return: all values from correlation_values table :rtype: list[str]
Source code in src/mmisp/worker/misp_database/misp_sql.py
100 101 102 103 104 105 106 107 108 |
|
is_excluded_correlation(session, value)
async
Checks if value is in correlation_exclusions table. :param value: to check :type value: str :return: True if value is in correlation_exclusions table, False otherwise :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_sql.py
154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
is_over_correlating_value(session, value)
async
Checks if value is in over_correlating_values table. Doesn't check if value has more correlations in the database than the current threshold. :param value: to check :type value: str :return: True if value is in over_correlating_values table, False otherwise :rtype: bool
Source code in src/mmisp/worker/misp_database/misp_sql.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
MispAPIConfigData
Bases: ConfigData
Source code in src/mmisp/worker/misp_database/misp_api_config.py
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 46 47 48 49 50 51 52 53 |
|
Config
Pydantic configuration.
Source code in src/mmisp/worker/misp_database/misp_api_config.py
19 20 21 22 23 24 |
|
read_from_env()
Read the environment variables and set the values to the class attributes that are used by the MISP API.
Source code in src/mmisp/worker/misp_database/misp_api_config.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
Encapsulates the response data for the jobs router.
CreateJobResponse
Bases: BaseModel
Encapsulates the response for a create jobs API call
Source code in src/mmisp/worker/api/response_schemas.py
42 43 44 45 46 47 48 49 50 |
|
job_id: str | None
instance-attribute
The id of the created job
success: bool
instance-attribute
The API call was successful or not
DeleteJobResponse
Bases: BaseModel
Encapsulates the response for a remove jobs API call
Source code in src/mmisp/worker/api/response_schemas.py
53 54 55 56 57 58 59 |
|
success: bool
instance-attribute
The API call was successful or not
ExceptionResponse
Bases: BaseModel
Encapsulates the response for a jobs where an exception was raised
Source code in src/mmisp/worker/api/response_schemas.py
33 34 35 36 37 38 39 |
|
message: str
instance-attribute
A costume message which describes the error that occurred
JobStatusEnum
Bases: str
, Enum
Encapsulates the status of a Job
Source code in src/mmisp/worker/api/response_schemas.py
10 11 12 13 14 15 16 17 18 19 |
|
JobStatusResponse
Bases: BaseModel
Encapsulates the response for a jobs status API call
Source code in src/mmisp/worker/api/response_schemas.py
22 23 24 25 26 27 28 29 30 |
|
message: str
instance-attribute
A costume message which describes the success of getting the job status
status: JobStatusEnum
instance-attribute
The status of the job
StartStopWorkerResponse
Bases: BaseModel
Represents the API response of starting and stopping a worker
Source code in src/mmisp/worker/api/response_schemas.py
77 78 79 80 81 82 83 84 85 86 87 |
|
message: str
instance-attribute
A costume message which describes the success of starting or stopping the worker
success: bool
instance-attribute
The API call was successful or not
url: str
instance-attribute
The API url
WorkerStatusEnum
Bases: str
, Enum
Represents different statuses of a worker
Source code in src/mmisp/worker/api/response_schemas.py
67 68 69 70 71 72 73 74 |
|
WorkerStatusResponse
Bases: BaseModel
Represents the API response of getting the status of a worker
Source code in src/mmisp/worker/api/response_schemas.py
90 91 92 93 94 95 96 97 98 |
|
jobs_queued: int
instance-attribute
The number of queued jobs of the worker
status: WorkerStatusEnum
instance-attribute
The status of the worker
Encapsulates input data classes for the jobs router.
UserData
Bases: BaseModel
Data class for user_id
Source code in src/mmisp/worker/api/requests_schemas.py
10 11 12 13 14 15 16 |
|
user_id: int
instance-attribute
The id of the user
WorkerEnum
Bases: StrEnum
Represents the implemented workers
Source code in src/mmisp/worker/api/requests_schemas.py
19 20 21 22 23 24 25 26 27 28 29 |
|
worker_router: APIRouter = APIRouter(prefix='/worker')
module-attribute
Every method in this file is a route for the worker_router every endpoint is prefixed with /worker and requires the user to be verified
Encapsulates input data classes for the jobs router.
UserData
Bases: BaseModel
Data class for user_id
Source code in src/mmisp/worker/api/requests_schemas.py
10 11 12 13 14 15 16 |
|
user_id: int
instance-attribute
The id of the user
WorkerEnum
Bases: StrEnum
Represents the implemented workers
Source code in src/mmisp/worker/api/requests_schemas.py
19 20 21 22 23 24 25 26 27 28 29 |
|
Every method in this file is a route for the job_router every endpoint is prefixed with /job and requires the user to be verified
verified(credentials=Depends(HTTPBearer(auto_error=False)))
A function to verify the api key that is sent by the client if the api key is not correct, it will raise an HTTPException
:param credentials: credentials sent by the client :type credentials: HTTPAuthorizationCredentials
Source code in src/mmisp/worker/api/api_verification.py
7 8 9 10 11 12 13 14 15 16 17 18 |
|
PluginInterface
Bases: Protocol
Protocol class (interface) providing the necessary functions each plugin must implement to be able to become loaded.
Source code in src/mmisp/worker/plugins/loader.py
15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
register(factory)
staticmethod
Registers the plugin in the given factory.
:param factory: The factory in which the plugin is registered. :type factory: PluginFactory
Source code in src/mmisp/worker/plugins/loader.py
20 21 22 23 24 25 26 27 |
|
PluginLoader
Implements the loading and registration process of plugins.
Source code in src/mmisp/worker/plugins/loader.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 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
load_plugins(plugins, factory)
classmethod
Loads the specified plugins and registers them in the given factory.
:param plugins: A list of paths to plugin modules to load. :type plugins: list[str] :param factory: The factory in which the plugins are to be registered. :type factory: PluginFactory
Source code in src/mmisp/worker/plugins/loader.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
load_plugins_from_directory(directory, factory)
classmethod
Loads all plugins that are in the specified directory.
:param directory: The path to a directory containing plugins to load. :type directory: str :param factory: The factory in which the plugins are to be registered. :type factory: PluginFactory
Source code in src/mmisp/worker/plugins/loader.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
Plugin
Bases: Protocol
Interface providing all attributes and methods a plugin must implement.
Source code in src/mmisp/worker/plugins/plugin.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
PLUGIN_INFO: PluginInfo
instance-attribute
Information about the plugin.
run()
Entry point of the plugin. Runs the plugin and returns any existing result.
:return: The result the plugin returns :rtype Any
Source code in src/mmisp/worker/plugins/plugin.py
14 15 16 17 18 19 20 21 |
|
PluginFactory
Bases: Generic[_T, _U]
, ABC
Provides a Factory for registering and managing plugins.
Instantiation of plugins is not part of this class.
Source code in src/mmisp/worker/plugins/factory.py
12 13 14 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 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
__init__()
Constructs a new plugin factory without any plugins registered.
Source code in src/mmisp/worker/plugins/factory.py
19 20 21 22 23 24 |
|
get_plugin_info(plugin_name)
Returns information about a registered plugin.
:param plugin_name: The name of the plugin. :type plugin_name: str :return: The information about the plugin. :rtype: U :raises PluginNotFound: If there is no plugin with the specified name.
Source code in src/mmisp/worker/plugins/factory.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
get_plugins()
Returns a list of registered Plugins.
:return: The list of plugins. :rtype: list[PluginInfo]
Source code in src/mmisp/worker/plugins/factory.py
84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
is_plugin_registered(plugin_name)
Checks if the given plugin is registered in the factory.
:param plugin_name: The name of the plugin to check. :type plugin_name: str :return: True if the plugin is registered
Source code in src/mmisp/worker/plugins/factory.py
98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
register(plugin)
Registers a new plugin.
:param plugin: The class of the plugin to register. :type plugin: type[T] :raises NotAValidPlugin: If the plugin is missing the 'PLUGIN_INFO' attribute. :raises PluginRegistrationError: If there is already a plugin registered with the same name.
Source code in src/mmisp/worker/plugins/factory.py
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 |
|
unregister(plugin_name)
Unregisters a plugin.
The plugin can be registered again later.
:param plugin_name: The name of the plugin to remove from the factory. :type plugin_name: str :raises PluginNotFound: If there is no plugin with the specified name.
Source code in src/mmisp/worker/plugins/factory.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
ASTypeValidator
Bases: TypeValidator
This Class implements a validationmethod for AS Numbers
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
|
validate(input_str)
This method is used when a String is validated as an ASAttribute
:param input_str: input string to validate :type input_str: str :return: returns the AttributeType when an AS is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
395 396 397 398 399 400 401 402 403 404 405 406 |
|
BTCTypeValidator
Bases: TypeValidator
This Class implements a validationmethod for bitcoin-addresses
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
validate(input_str)
This method is used when a String is validated as an BTCAttribute
:param input_str: input string to validate :type input_str: str :return: returns the AttributeType when a BTC address is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
418 419 420 421 422 423 424 425 426 427 428 429 |
|
CVETypeValidator
Bases: TypeValidator
This Class implements a validationmethod for vulnerabilites
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
validate(input_str)
This method is used when a String is validated as an CVEAttribute
:param input_str: input string to validate :type input_str: str :return: returns the AttributeType when a CVE is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
DomainFilenameTypeValidator
Bases: TypeValidator
This Class implements a validationmethod for Domain- and Filenames
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
validate(input_str)
This method is used when a String is validated as a Domain- or FilenameAttribute it checks if the string is a Domain, URL, Link, Filename or a Regkey and returns the AttributeType, otherwise None
:param input_str: the string to validate :type input_str: str :return: returns the AttributeType when a Domain or Filename is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
EmailTypeValidator
Bases: TypeValidator
This Class implements a validationmethod for email-adresses
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
validate(input_str)
This method is used when a String is validated as an EmailAttribute
:param input_str: input string to validate :type input_str: str :return: returns the AttributeType when an Email address is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
HashTypeValidator
Bases: TypeValidator
This Class implements a validationmethod for md5,sha1,sha224,sha256,sha384 and sha512 hashes
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
HashTypes
Bases: BaseModel
This class encapsulates a HashTypes-Object, which is used to differentiate between single or composite hashes
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
215 216 217 218 219 220 221 |
|
validate(input_str)
This method is used when a String is validated as an HashAttribute it checks if the string is a single or composite hash and returns the AttributeType, otherwise None valid hashes are md5,sha1,sha224,sha256,sha384,sha512 and ssdeep
:param input_str: input string to validate :type input_str: str :return: returns the AttributeType when a Hash is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
IPTypeValidator
Bases: TypeValidator
This Class implements a validationmethod for simple IPv4 and IPv6 adresses, without a port
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
__validate_ip(input_str)
This method is used to check if a string is an IPv4 or IPv6 IP returns True when an IP is found, otherwise False
:param input_str: the string to check :type input_str: str :return: returns True when an IP is found, otherwise False :rtype: bool
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
validate(input_str)
This method is used when a String is validated as an IPAttribute if the string is an IP, it returns the AttributeType, otherwise None
it checks if the string is an IPv4 or IPv6 IP with or without a Port, or a CIDR Block
:param input_str: input string to validate :type input_str: str :return: returns the AttributeType when an IP is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
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 95 96 97 98 99 100 101 102 103 104 |
|
PhonenumberTypeValidator
Bases: TypeValidator
This Class implements a validationmethod for phonenumbers
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
validate(input_str)
This method is used when a String is validated as an PhoneNumberAttribute
:param input_str: input string to validate :type input_str: str :return: returns the AttributeType when a PhoneNumber is found, otherwise None :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
TypeValidator
Bases: ABC
Abstract model of a Validator Object, which is used to decide, whether a String is a representation of a certain Attribute or not. It returns the Attribute Type when an Attribute is found, and None if not
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
validate(input_str)
abstractmethod
This method is used when a String is validated as an Attribute
:param input_str: the string to validate :type input_str: str :return: returns the AttributeType when an Attribute is found, and None if not :rtype: AttributeType | None
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
43 44 45 46 47 48 49 50 51 52 53 |
|
resolve_filename(input_str)
This method is used to check if a string is a filename, by checking if it has a file extension(an alphanumeric not numeric string) or a drive letter
:param input_str: the string to check :type input_str: str :return: returns True when the string is a filename, otherwise False :rtype: bool
Source code in src/mmisp/worker/jobs/processfreetext/attribute_types/type_validator.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
ProcessFreeTextData
Bases: BaseModel
Represents the input data of the ProcessFreeTextJob
Source code in src/mmisp/worker/jobs/processfreetext/job_data.py
6 7 8 9 10 11 |
|
ProcessFreeTextResponse
Bases: BaseModel
Represents the response of the ProcessFreeTextJob
Source code in src/mmisp/worker/jobs/processfreetext/job_data.py
14 15 16 17 18 19 |
|
ProcessfreetextConfigData
Bases: ConfigData
Encapsulates configuration for the processfreetext worker and its jobs.
Source code in src/mmisp/worker/jobs/processfreetext/processfreetext_config_data.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
security_vendors: list[str] = ['virustotal.com', 'hybrid-analysis.com']
class-attribute
instance-attribute
The security vendors to use for the processfreetext worker.
read_from_env()
Reads the configuration from the environment.
Source code in src/mmisp/worker/jobs/processfreetext/processfreetext_config_data.py
21 22 23 24 25 26 27 28 |
|
processfreetext_job(user, data)
celery task that processes the given free text and returns a list of found attributes
:param user: the user that requested the job :type user: UserData :param data: the data to process, containing the free text string :type data: ProcessFreeTextData :return: returns a list of found attributes :rtype: ProcessFreeTextData
Source code in src/mmisp/worker/jobs/processfreetext/processfreetext_job.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
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 15 16 17 18 19 20 21 |
|
attribute_id: NonNegativeInt
instance-attribute
The ID of the attribute to enrich.
enrichment_plugins: list[str]
instance-attribute
The list of enrichment plugins to use for enrichment
Config
Pydantic configuration.
Source code in src/mmisp/worker/jobs/enrichment/job_data.py
9 10 11 12 13 14 15 16 |
|
EnrichEventData
Bases: BaseModel
Encapsulates the data needed for an enrich-event job.
Source code in src/mmisp/worker/jobs/enrichment/job_data.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
enrichment_plugins: list[str]
instance-attribute
The list of enrichment plugins to use for enrichment
event_id: int
instance-attribute
The ID of the event to enrich.
Config
Pydantic configuration.
Source code in src/mmisp/worker/jobs/enrichment/job_data.py
29 30 31 32 33 34 35 36 |
|
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
44 45 46 47 48 49 50 51 52 |
|
created_attributes: NonNegativeInt = 0
class-attribute
instance-attribute
The number of created attributes.
enrich_attribute(misp_attribute, enrichment_plugins)
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
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
enrich_attribute_job(user_data, data)
Provides an implementation of the enrich-attribute job.
Takes a Misp event-attribute as input and runs specified plugins to enrich the attribute.
:param user_data: The user who created the job. (not used) :type user_data: UserData :param data: The data needed for the enrichment process. :type data: EnrichAttributeData :return: The created Attributes and Tags. :rtype: EnrichAttributeResult
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 |
|
ENV_ENRICHMENT_PLUGIN_DIRECTORY = f'{ENV_PREFIX}_ENRICHMENT_PLUGIN_DIRECTORY'
module-attribute
The name of the environment variable that configures the directory where enrichment plugins are loaded from.
EnrichmentConfigData
Bases: ConfigData
Encapsulates configuration for the enrichment worker and its jobs.
Source code in src/mmisp/worker/jobs/enrichment/enrichment_config_data.py
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
plugin_directory: str = _PLUGIN_DEFAULT_DIRECTORY
class-attribute
instance-attribute
The directory where the plugins are stored.
Config
Pydantic configuration.
Source code in src/mmisp/worker/jobs/enrichment/enrichment_config_data.py
23 24 25 26 27 28 |
|
read_config_from_env()
Reads the configuration of the enrichment worker from environment variables.
Source code in src/mmisp/worker/jobs/enrichment/enrichment_config_data.py
54 55 56 57 58 59 60 61 |
|
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
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
EnrichmentPlugin
Bases: Plugin
Interface for an enrichment plugin.
Provides functionality for enriching a given MISP Event-Attribute. Creates and returns new attributes and tags.
Source code in src/mmisp/worker/jobs/enrichment/plugins/enrichment_plugin.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
PLUGIN_INFO: EnrichmentPluginInfo
instance-attribute
Information about the plugin.
__init__(misp_attribute)
abstractmethod
Creates a new enrichment plugin initialized with an event attribute.
:param misp_attribute: The MISP Event-Attribute to enrich. :type misp_attribute: AttributeWithTagRelationship
Source code in src/mmisp/worker/jobs/enrichment/plugins/enrichment_plugin.py
21 22 23 24 25 26 27 28 29 |
|
run()
abstractmethod
Entry point for the plugin. Starts enrichment process and returns created attributes and tags. :return: The created (enriched) attributes and tags. :rtype: EnrichAttributeResult
Source code in src/mmisp/worker/jobs/enrichment/plugins/enrichment_plugin.py
31 32 33 34 35 36 37 38 |
|
EnrichmentPluginFactory
Bases: PluginFactory[EnrichmentPlugin, EnrichmentPluginInfo]
Encapsulates a factory specifically for Enrichment Plugins.
Source code in src/mmisp/worker/jobs/enrichment/plugins/enrichment_plugin_factory.py
10 11 12 13 14 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
create(plugin_name, misp_attribute)
Creates an instance of a given plugin initialized with the specified event attribute.
:param plugin_name: The name of the plugin. :type plugin_name: str :param misp_attribute: The MISP-Attribute to enrich. :type misp_attribute: AttributeWithTagRelationship :return: The instantiated enrichment plugin. :rtype: EnrichmentPlugin :raises PluginNotFound: If there is no plugin with the specified name. :raises NotAValidPlugin: If the constructor of the plugin does not match the interface.
Source code in src/mmisp/worker/jobs/enrichment/plugins/enrichment_plugin_factory.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 |
|
get_plugin_io(plugin_name)
Returns information about the accepted and returned attribute types of a given enrichment plugin. :param plugin_name: The name of the plugin. :type plugin_name: str :return: The accepted and returned types of attributes. :rtype: PluginIO
Source code in src/mmisp/worker/jobs/enrichment/plugins/enrichment_plugin_factory.py
42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
enrich_event_job(user_data, data)
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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
__regenerate_correlation_values(session, misp_api, 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 |
|
__regenerate_over_correlating(session, misp_api, 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
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
regenerate_occurrences_job(user)
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
24 25 26 27 28 29 30 31 32 33 34 |
|
clean_excluded_correlations_job(user)
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
10 11 12 13 14 15 16 17 18 19 20 21 |
|
correlate_value(session, misp_api, correlation_threshold, value)
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: CorrelateValueResponse
Source code in src/mmisp/worker/jobs/correlation/correlate_value_job.py
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 |
|
correlate_value_job(user, correlate_value_data)
Method to execute the job. In CorrelateValueData is the value to correlate.
:param user: the user who requested the job :type user: UserData :param correlate_value_data: value to correlate :type correlate_value_data: CorrelateValue :return: relevant information about the correlation :rtype: CorrelateValueResponse
Source code in src/mmisp/worker/jobs/correlation/correlate_value_job.py
16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
__process_result(session, misp_api, 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: CorrelateValueResponse :raises: PluginExecutionException: If the result of the plugin is invalid.
Source code in src/mmisp/worker/jobs/correlation/correlation_plugin_job.py
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 |
|
correlation_plugin_job(user, data)
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: CorrelateValueResponse
Source code in src/mmisp/worker/jobs/correlation/correlation_plugin_job.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
CorrelationPluginInfo
Bases: PluginInfo
Class to hold information about a correlation plugin.
Source code in src/mmisp/worker/jobs/correlation/plugins/correlation_plugin_info.py
16 17 18 19 20 21 |
|
CorrelationPluginType
Bases: str
, Enum
Enum for the type of correlation plugin.
Source code in src/mmisp/worker/jobs/correlation/plugins/correlation_plugin_info.py
6 7 8 9 10 11 12 13 |
|
CorrelationPlugin
Bases: Plugin
Class to be implemented by correlation plugins. It provides the basic functionality to run a correlation plugin.
Source code in src/mmisp/worker/jobs/correlation/plugins/correlation_plugin.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
run()
async
Runs the plugin. To be implemented by the plugin. :return: the result of the plugin :rtype: InternPluginResult :raises: PluginExecutionException: If the plugin is executed but an error occurs.
Source code in src/mmisp/worker/jobs/correlation/plugins/correlation_plugin.py
18 19 20 21 22 23 24 25 |
|
correlation_plugin_factory = CorrelationPluginFactory()
module-attribute
The factory to create correlation plugins for the whole application.
CorrelationPluginFactory
Bases: PluginFactory[CorrelationPlugin, CorrelationPluginInfo]
The factory to register and create correlation plugins.
Source code in src/mmisp/worker/jobs/correlation/plugins/correlation_plugin_factory.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
create(plugin_name, misp_value, misp_api, threshold)
Create an instance of a plugin.
:param threshold: the current correlation threshold :type threshold: int :param misp_api: the misp api for the plugin to use :type misp_api: MispAPI :param plugin_name: The name of the plugin. :type plugin_name: str :param misp_value: The value to correlate. :type misp_value: str :return: The instantiated correlation plugin, initialized with the value.
Source code in src/mmisp/worker/jobs/correlation/plugins/correlation_plugin_factory.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 |
|
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
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
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
121 122 123 124 125 126 127 128 129 130 131 |
|
save_correlations(db, misp_api, 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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
ChangeThresholdData
Bases: BaseModel
Data to change the threshold.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
67 68 69 70 71 72 |
|
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 |
|
CorrelateValueData
Bases: BaseModel
Data for the correlation of a value.
Source code in src/mmisp/worker/jobs/correlation/job_data.py
59 60 61 62 63 64 |
|
CorrelateValueResponse
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 |
|
CorrelationPluginJobData
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 |
|
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
75 76 77 78 79 80 81 82 83 84 85 86 |
|
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 = f'{ENV_PREFIX}_CORRELATION_PLUGIN_DIRECTORY'
module-attribute
The name of the environment variable that configures the directory where correlation plugins are loaded from.
PLUGIN_DEFAULT_DIRECTORY: str = ''
module-attribute
The default package used for correlation plugins.
CorrelationConfigData
Bases: ConfigData
Encapsulates configuration for the correlation worker and its jobs.
Source code in src/mmisp/worker/jobs/correlation/correlation_config_data.py
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
plugin_directory: str = PLUGIN_DEFAULT_DIRECTORY
class-attribute
instance-attribute
The directory where the plugins are stored.
Config
Pydantic configuration.
Source code in src/mmisp/worker/jobs/correlation/correlation_config_data.py
23 24 25 26 27 28 |
|
read_config_from_env()
Reads the configuration of the correlation worker from environment variables.
Source code in src/mmisp/worker/jobs/correlation/correlation_config_data.py
54 55 56 57 58 59 60 |
|
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
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
top_correlations_job(user)
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
10 11 12 13 14 15 16 17 18 19 20 |
|
alert_email_job(user, data)
prepares an alert email by filling and rendering a template. afterward it will be sent to all specified users. :param user: the user who requested the job :type user: UserData :param data: contains data for the template and the user ids who will receive the emails. :type data: AlertEmailData
Source code in src/mmisp/worker/jobs/email/alert_email_job.py
22 23 24 25 26 27 28 29 30 31 |
|
contact_email_job(requester, data)
Prepares a contact email by filling and rendering a template. Afterward it will be sent to all specified users. :param requester: is the user who wants to contact the users :type requester: UserData :param data: contains data for the template and the user ids who will receive the emails. :type data: ContactEmailData
Source code in src/mmisp/worker/jobs/email/contact_email_job.py
21 22 23 24 25 26 27 28 29 30 |
|
posts_email_job(user, data)
Prepares a posts email by filling and rendering a template. Afterward it will be sent to all specified users. :param user: the user who requested the job :type user: UserData :param data: contains data for the template and the user ids who will receive the emails. :type data: PostsEmailData
Source code in src/mmisp/worker/jobs/email/posts_email_job.py
23 24 25 26 27 28 29 30 31 32 |
|
AlertEmailData
Bases: BaseModel
Encapsulates the necessary data to send and create an alert email.
Source code in src/mmisp/worker/jobs/email/job_data.py
4 5 6 7 8 9 10 11 12 13 14 |
|
event_id: int
instance-attribute
The id of the event which triggered the alert
old_publish: str
instance-attribute
The timestamp of old publishing
receiver_ids: list[int]
instance-attribute
The ids of the receivers
ContactEmailData
Bases: BaseModel
Encapsulates the necessary data to send and create a contact email.
Source code in src/mmisp/worker/jobs/email/job_data.py
17 18 19 20 21 22 23 24 25 26 27 |
|
event_id: int
instance-attribute
The id of the event which the user wants to know more about
message: str
instance-attribute
The custom message of the user
receiver_ids: list[int]
instance-attribute
The ids of the receivers
PostsEmailData
Bases: BaseModel
Encapsulates the necessary data to send and create a posts email.
Source code in src/mmisp/worker/jobs/email/job_data.py
30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
message: str
instance-attribute
The message which was posted at the post
post_id: int
instance-attribute
The id of the post where something new was posted
receiver_ids: list[int]
instance-attribute
The ids of the receivers
title: str
instance-attribute
The title of the post
SmtpClient
Provides methods to build an SMTP connection to send emails.
Source code in src/mmisp/worker/jobs/email/utility/smtp_client.py
9 10 11 12 13 14 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
__init__(host, port)
Initializes a new SMTP object. :param port: is the port of the SMTP server :type port: int :param host: is the host of the SMTP server :type host: str
Source code in src/mmisp/worker/jobs/email/utility/smtp_client.py
14 15 16 17 18 19 20 21 22 |
|
close_smtp_connection()
Closes the SMTP Connection.
Source code in src/mmisp/worker/jobs/email/utility/smtp_client.py
53 54 55 56 57 |
|
open_smtp_connection(email, password)
Connects to the SMTP server and logs in with the misp email. If no password is given, the connection will be established without a password. :param email: is the email of misp :type email: str :param password: is the password of the email :type password: str
Source code in src/mmisp/worker/jobs/email/utility/smtp_client.py
24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
send_email(from_addr, to_addr, email)
Sends an email. :param from_addr: is the address of the sender (misp email9 :type from_addr: str :param to_addr: is the address of the receiver (user) :type to_addr: str :param email: is the content of the email :type email: str
Source code in src/mmisp/worker/jobs/email/utility/smtp_client.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
EmailConfigData
Bases: ConfigData
Encapsulates configuration for the email worker and its jobs.
Source code in src/mmisp/worker/jobs/email/utility/email_config_data.py
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
email_subject_string: str = 'tlp'
class-attribute
instance-attribute
The tlp string to search for an email subject
mmisp_email_address: str = 'misp@localhost'
class-attribute
instance-attribute
The email of MISP
mmisp_email_password: str = ''
class-attribute
instance-attribute
The password of the MISP email
mmisp_email_username: str = 'misp'
class-attribute
instance-attribute
The username of the MISP email
mmisp_smtp_host: str = 'localhost'
class-attribute
instance-attribute
The host of the SMTP server
mmisp_smtp_port: NonNegativeInt = 25
class-attribute
instance-attribute
The port of the SMTP server
mmisp_url: str = 'http://127.0.0.1'
class-attribute
instance-attribute
The url of MISP
read_from_env()
Reads the configuration from the environment.
Source code in src/mmisp/worker/jobs/email/utility/email_config_data.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
UtilityEmail
Provides functionality to built emails.
Source code in src/mmisp/worker/jobs/email/utility/utility_email.py
9 10 11 12 13 14 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 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 |
|
get_email_subject_mark_for_event(event, email_subject_string)
staticmethod
Returns the tlp tag of the given event as a subject for emails.
:param event: the event to get the subject for :type event: AddEditGetEventDetails :param email_subject_string: is the tlp string to search :type email_subject_string: str :return: the tlp tag of the event :rtype: str
Source code in src/mmisp/worker/jobs/email/utility/utility_email.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
send_emails(misp_api, misp_email_address, email_username, email_password, smtp_port, smtp_host, receiver_ids, email_msg)
async
staticmethod
Sends emails to the given users by opening an SMTP connection
:param misp_email_address: is the email of misp :type misp_email_address: str :param email_username: is the username of misp :type email_username: str :param email_password: is the password of misp :type email_password: str :param smtp_port: is the port of the SMTP server :type smtp_port: int :param smtp_host: is the host of the SMTP server :type smtp_host: str :param receiver_ids: are the ids of the users who get the email :type receiver_ids: list[int] :param email_msg: is the email which will be sent :type email_msg: EmailMessage
Source code in src/mmisp/worker/jobs/email/utility/utility_email.py
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 |
|
app = init_app()
module-attribute
The FastAPI instance.
main()
The entry point of the MMISP Worker application. Starts the enabled workers and sets up the API.
Source code in src/mmisp/worker/main.py
41 42 43 44 45 46 47 48 49 |
|
InvalidPluginResult
Bases: Exception
Exception that is raised when a plugin returns an invalid result that can not be utilized.
Source code in src/mmisp/worker/exceptions/plugin_exceptions.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
NotAValidPlugin
Bases: Exception
Exception that is raised when a class does not match the requirements of a valid plugin.
Source code in src/mmisp/worker/exceptions/plugin_exceptions.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
PluginExecutionException
Bases: Exception
Exception that is raised when a plugin execution fails. Can be thrown by the plugin itself.
Source code in src/mmisp/worker/exceptions/plugin_exceptions.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
PluginImportError
Bases: Exception
Exceptions that is raised when a python module of a plugin could not be imported.
Source code in src/mmisp/worker/exceptions/plugin_exceptions.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
PluginNotFound
Bases: Exception
Exception that is raised when a requested plugin could not be found.
Source code in src/mmisp/worker/exceptions/plugin_exceptions.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
PluginRegistrationError
Bases: Exception
Exception that is raised when a plugin could not be registered.
Source code in src/mmisp/worker/exceptions/plugin_exceptions.py
37 38 39 40 41 42 43 44 |
|
JobException
Bases: Exception
Exception raised when an error occurred while processing a job
Source code in src/mmisp/worker/exceptions/job_exceptions.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
JobHasNoResultException
Bases: Exception
Exception raised when a requested job has no result that can be returned
Source code in src/mmisp/worker/exceptions/job_exceptions.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
JobNotFinishedException
Bases: Exception
Exception raised when a requested job is not finished yet
Source code in src/mmisp/worker/exceptions/job_exceptions.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
NotExistentJobException
Bases: Exception
Exception raised when a requested job does not exist
Source code in src/mmisp/worker/exceptions/job_exceptions.py
20 21 22 23 24 25 26 27 28 29 30 31 |
|
EnvVariableNotFound
Bases: Exception
Exception raised when an environment variable is not found
Source code in src/mmisp/worker/exceptions/environment_exceptions.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
APIException
Bases: Exception
Exception raised when an error occurred while processing an API request
Source code in src/mmisp/worker/exceptions/misp_api_exceptions.py
4 5 6 7 8 9 10 11 |
|
InvalidAPIResponse
Bases: Exception
Exception raised when an API response is not valid
Source code in src/mmisp/worker/exceptions/misp_api_exceptions.py
14 15 16 17 18 19 20 21 |
|
ForbiddenByServerSettings
Bases: Exception
Exception raised when a requested action was denied by another servers settings
Source code in src/mmisp/worker/exceptions/server_exceptions.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
InvalidServerVersion
Bases: Exception
Exception raised when a server has an invalid version
Source code in src/mmisp/worker/exceptions/server_exceptions.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
ServerNotReachable
Bases: Exception
Exception raised when a server is not reachable
Source code in src/mmisp/worker/exceptions/server_exceptions.py
21 22 23 24 25 26 27 28 29 30 31 |
|