You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,19 @@
1
-
[](https://gitter.im/TheHive-Project/TheHive?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Cortex4py is a Python API client for [Cortex](https://thehive-project.org/), a powerful observable analysis engine where observables such as IP and email addresses, URLs, domain names, files or hashes can be analyzed one by one using a Web interface.
@@ -44,7 +58,7 @@ We welcome your contributions. Please feel free to fork the code, play with it,
44
58
We do have a [Code of conduct](code_of_conduct.md). Make sure to check it out before contributing.
45
59
46
60
# Support
47
-
Please [open an issue on GitHub](https://github.com/CERT-BDF/Cortex4py/issues/new) if you'd like to report a bug or request a feature. We are also available on [Gitter](https://gitter.im/TheHive-Project/TheHive) to help you out.
61
+
Please [open an issue on GitHub](https://github.com/TheHive-Project/Cortex4py/issues/new) if you'd like to report a bug or request a feature. We are also available on [Discord](https://chat.thehive-project.org) to help you out.
48
62
49
63
If you need to contact the project team, send an email to <support@thehive-project.org>.
@@ -392,6 +396,7 @@ An analyzer is represented by the following model class:
392
396
|`dataTypeList`| Allowed datatypes | readonly |
393
397
|`baseConfig`| Base configuration name. This identifies the shared set of configuration with all the analyzer's flavors | readonly |
394
398
|`jobCache`| Report cache timeout in minutes, visible for `orgAdmin` users only | writable |
399
+
|`jobTimeout`| Job timeout in minutes, visible for `orgAdmin` users only | writable |
395
400
|`rate`| Numeric amount of analyzer calls authorized for the specified `rateUnit`, visible for `orgAdmin` users only | writable |
396
401
|`rateUnit`| Period of availability of the rate limite: `Day` or `Month`, visible for `orgAdmin` users only | writable |
397
402
|`configuration`| A JSON object where key/value pairs represent the config names, and their values. It includes the default properties `proxy_http`, `proxy_https`, `auto_extract_artifacts`, `check_tlp`, and `max_tlp`, visible for `orgAdmin` users only | writable |
The `RespondersController` class provides a set of methods to handle responders.
512
+
513
+
### Model
514
+
515
+
A responder is an instance of a responder definition, and both models share the same fields.
516
+
517
+
A responder definition is represented by the following model class:
518
+
519
+
| Field | Description | Type |
520
+
| --------- | ----------- | ---- |
521
+
|`id`| Responder ID once enabled within an organization | readonly |
522
+
|`workerDefinitionId`| Responder definition name | readonly |
523
+
|`name`| Name of the responder | readonly |
524
+
|`version`| Version of the responder | readonly |
525
+
|`description`| Description of the responder | readonly |
526
+
|`author`| Author of the responder | readonly |
527
+
|`url`| URL where the responder has been published | readonly |
528
+
|`license`| License of the responder | readonly |
529
+
|`dataTypeList`| Allowed datatypes | readonly |
530
+
|`configurationItems`| A list that describes the configuration options of the responder | readonly |
531
+
|`baseConfig`| Base configuration name. This identifies the shared set of configuration with all the responder's flavors | readonly |
532
+
|`createdBy`| User who enabled the responder | computed |
533
+
|`updatedAt`| Last update date | computed |
534
+
|`updatedBy`| User who last updated the responder | computed |
535
+
536
+
A responder is represented by the following model class:
537
+
538
+
| Field | Description | Type |
539
+
| --------- | ----------- | ---- |
540
+
|`id`| Responder ID once enabled within an organization | readonly |
541
+
|`workerDefinitionId`| Responder definition name | readonly |
542
+
|`name`| Name of the responder | readonly |
543
+
|`version`| Version of the responder | readonly |
544
+
|`description`| Description of the responder | readonly |
545
+
|`author`| Author of the responder | readonly |
546
+
|`url`| URL where the responder has been published | readonly |
547
+
|`license`| License of the responder | readonly |
548
+
|`dataTypeList`| Allowed datatypes | readonly |
549
+
|`baseConfig`| Base configuration name. This identifies the shared set of configuration with all the responder's flavors | readonly |
550
+
|`jobCache`| Report cache timeout in minutes, visible for `orgAdmin` users only | writable |
551
+
|`rate`| Numeric amount of responder calls authorized for the specified `rateUnit`, visible for `orgAdmin` users only | writable |
552
+
|`rateUnit`| Period of availability of the rate limite: `Day` or `Month`, visible for `orgAdmin` users only | writable |
553
+
|`configuration`| A JSON object where key/value pairs represent the config names, and their values. It includes the default properties `proxy_http`, `proxy_https`, `auto_extract_artifacts`, `check_tlp`, and `max_tlp`, visible for `orgAdmin` users only | writable |
554
+
|`createdBy`| User who enabled the analyzer | computed |
555
+
|`updatedAt`| Last update date | computed |
556
+
|`updatedBy`| User who last updated the analyzer | computed |
557
+
558
+
### Methods
559
+
560
+
| Method | Description | Return type |
561
+
| --------- | ----------- | ---- |
562
+
|`find_all(query,**kwargs)`| Returns a list of `Responder` objects, based on `query`, `range` and `sort` parameters | List[Responder]|
563
+
|`find_one_by(query,**kwargs)`| Returns the first `Responder` object, based on `query` and `sort` parameters | Responder |
564
+
|`get_by_id(worker_id)`| Returns a `Responder` by its `id`| Responder |
565
+
|`get_by_name(name)`| Returns a `Responder` by its `name`| Responder |
566
+
|`get_by_type(data_type)`| Returns a list of available `Responder` applicable to the given `data_type`| List[Responder]|
567
+
|`enable(responder_name,config)`| Activate an responder and returns its `Responder` object | Responder |
568
+
|`update(worker_id)`| Update the configuration of an `Responder` and returns the updated version | Responder |
569
+
|`disable(worker_id)`| Removes a responder from an organization and returns `true` if it completes successfully | Boolean |
570
+
|`run_by_id(worker_id, data,**kwargs)`| Returns a `Job` by its `name`| Job |
571
+
|`run_by_name(responder_name, data,**kwargs)`| Runs a responder by its name and returns the resulting `Job`| Job |
572
+
|`definitions()`| Returns the list of all the responder definitions including the enabled and disabled responders | List[ResponderDefinition]|
573
+
574
+
### Examples
575
+
576
+
The following example shows how to manipulate responders:
577
+
578
+
```python
579
+
import json
580
+
581
+
from cortex4py.api import Api
582
+
from cortex4py.query import*
583
+
584
+
api = Api('http://CORTEX_APP_URL:9001', '**API_KEY**')
The `JobsController` class provides a set of methods to handle jobs. A job is the execution of a specific analyzer.
637
+
The `JobsController` class provides a set of methods to handle jobs. A job is the execution of a specific worker (analyzer or responder).
504
638
505
639
### Model
506
640
@@ -509,18 +643,19 @@ A job is represented by the following model class:
509
643
| Attribute | Description | Type |
510
644
| --------- | ----------- | ---- |
511
645
|`id`| Job ID | computed |
512
-
|`analyzerDefinitionId`| Analyzer definition name | readonly |
513
-
|`analyzerId`| Instance ID of the analyzer to which the job is associated | readonly |
646
+
|`type`| Job type: `responder` or `analyzer`| computed |
647
+
|`workerDefinitionId`| Worker definition name | readonly |
648
+
|`workerId`| Instance ID of the worker to which the job is associated | readonly |
649
+
|`workerName`| Name of the worker to which the job is associated | readonly |
514
650
|`organization`| Organization to which the user belongs (set upon account creation) | readonly |
515
-
|`analyzerName`| Name of the analyzer to which the job is associated | readonly |
516
-
|`dataType`| the datatype of the analyzed observable | readonly |
651
+
|`dataType`| the datatype of the worker's input data | readonly |
517
652
|`status`| Status of the job (`Waiting`, `InProgress`, `Success`, `Failure`, `Deleted`) | computed |
518
-
|`data`| Value of the analyzed observable (does not apply to `file` observables) | readonly |
653
+
|`data`| Value of the worker's input (does not apply to `file` observables). Contains all the data of a `Case` if the job is a result of a case responder. | readonly |
519
654
|`attachment`| JSON object representing `file` observables (does not apply to non-`file` observables). It defines the`name`, `hashes`, `size`, `contentType` and `id` of the `file` observable | readonly |
520
655
|`parameters`| JSON object of key/value pairs set during job creation | readonly |
521
656
|`message`| A free text field to set additional text/context for a job | readonly |
522
657
|`tlp`| The TLP of the analyzed observable | readonly |
523
-
|`report`| The analysy report as a JSON object including `success`, `full`, `summary` and `artifacts` peoperties.<br>In case of failure, the resport contains a `errorMessage` property | readonly |
658
+
|`report`| The analysis report as a JSON object including `success`, `full`, `summary` and `artifacts` peoperties.<br>In case of failure, the resport contains a `errorMessage` property | readonly |
524
659
|`startDate`| Start date | computed |
525
660
|`endDate`| End date | computed |
526
661
|`createdAt`| Creation date. Please note that a job can be requested but not immediately honored. The actual time at which it is started is the value of `startDate`| computed |
0 commit comments