forked from TheHive-Project/TheHiveDocs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TheHiveDocs.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Alert | ||
|
||
## Model definition | ||
|
||
Required attributes: | ||
- `title` (text) : title of the alert | ||
- `description` (text) : description of the alert | ||
- `severity` (number) : severity of the alert (0: not set; 1: low; 2: medium; 3: high) **default=2** | ||
- `date` (date) : date and time when the alert was raised **default=now** | ||
- `tags` (multi-string) : case tags **default=empty** | ||
- `tlp` (number) : [TLP](https://www.us-cert.gov/tlp) (`-1`: `unknown`; `0`: `white`; `1`: `green`; `2: amber`; | ||
`3: red`) **default=2** | ||
- `status` (AlertStatus) : status of the alert (*New*, *Updated*, *Ignored*, *Imported*) **default=New** | ||
- `type` (string) : type of the alert (read only) | ||
- `source` (string) : source of the alert (read only) | ||
- `sourceRef` (string) : source reference of the alert (read only) | ||
- `artifacts` (multi-artifact) : artifact of the alert. It is a array of JSON object containing artifact attributes | ||
**default=empty** | ||
- `follow` (boolean) : if true, the alert becomes active when updated **default=true** | ||
|
||
Optional attributes: | ||
- `caseTemplate` (string) : cate template to use when case is created from this alert | ||
|
||
Attributes generated by the backend: | ||
- `lastSyncDate` (date) : date of the last synchronization | ||
- `case` (string) : id of the case, if created | ||
|
||
Alert ID is computed from `type`, `source` and`sourceRef`. | ||
|
||
## Alert Manipulation | ||
|
||
### Alert methods | ||
|
||
|HTTP Mehod |URI |Action | | ||
|-----------|----------------------------------------|--------------------------------------| | ||
|GET |/api/alert |List alerts | | ||
|POST |/api/alert/_search |Find alerts | | ||
|PATCH |/api/alert/_bulk |Update alerts in bulk | | ||
|POST |/api/alert/_stats |Compute stats on alerts | | ||
|POST |/api/alert |[Create an alert](#Create-a-case) | | ||
|GET |/api/alert/:alertId |Get an alert | | ||
|PATCH |/api/alert/:alertId |Update an alert | | ||
|DELETE |/api/alert/:alertId |Delete an alert | | ||
|POST |/api/alert/:alertId/markAsRead |Mark an alert as read | | ||
|POST |/api/alert/:alertId/markAsUnread |Mark an alert as unread | | ||
|POST |/api/alert/:alertId/createCase |Create a case from an alert | | ||
|POST |/api/alert/:alertId/follow |Follow an alert | | ||
|POST |/api/alert/:alertId/unfollow |Unfollow an alert | | ||
|
||
|
||
### Create a Case | ||
|
||
An alert can be created using the following url : | ||
``` | ||
POST /api/alert | ||
``` | ||
Required case attributes (cf. models) must be provided. | ||
|
||
If an alert with the same tuple `type`, `source` and`sourceRef` already exists, TheHive refuses to create it. | ||
|
||
This call returns attributes of the created alert. | ||
|
||
#### Examples | ||
Creation of a simple alert: | ||
``` | ||
curl -XPOST -u myuser:mypassword -H 'Content-Type: application/json' http://127.0.0.1:9000/api/case -d '{ | ||
"title": "New Alert", | ||
"description": "N/A", | ||
"type": "external", | ||
"source": "instance1", | ||
"sourceRef": "alert-ref" | ||
}' | ||
``` | ||
It returns: | ||
``` | ||
{ | ||
"_id": "ce2c00f17132359cb3c50dfbb1901810", | ||
"_type": "alert", | ||
"artifacts": [], | ||
"createdAt": 1495012062014, | ||
"createdBy": "myuser", | ||
"date": 1495012062016, | ||
"description": "N/A", | ||
"follow": true, | ||
"id": "ce2c00f17132359cb3c50dfbb1901810", | ||
"lastSyncDate": 1495012062016, | ||
"severity": 2, | ||
"source": "instance1", | ||
"sourceRef": "alert-ref", | ||
"status": "New", | ||
"title": "New Alert", | ||
"tlp": 2, | ||
"type": "external", | ||
"user": "myuser" | ||
} | ||
``` | ||
|
||
|
||
Creation of another alert: | ||
``` | ||
curl -XPOST -u myuser:mypassword -H 'Content-Type: application/json' http://127.0.0.1:9000/api/alert -d '{ | ||
"title": "Other alert", | ||
"description": "alert description", | ||
"type": "external", | ||
"source": "instance1", | ||
"sourceRef": "alert-ref", | ||
"severity": 3, | ||
"tlp": 3, | ||
"artifacts": [ | ||
{ "dataType": "ip", "data": "127.0.0.1" }, | ||
{ "dataType": "domain", "data": "thehive-project.org" }, | ||
{ "dataType": "file", "data": "logo.svg;image/svg+xml;PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOC4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgNjI0IDIwMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNjI0IDIwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8Zz4NCgkJPHBhdGggZmlsbD0iIzE1MTYzMiIgZD0iTTE3Mi4yLDczdjY2LjRoLTIwLjdWNzNoLTI3LjRWNTQuOGg3NS41VjczSDE3Mi4yeiIvPg0KCQk8cGF0aCBmaWxsPSIjMTUxNjMyIiBkPSJNMjcyLjgsMTAw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l0PSIxMCIgcG9pbnRzPSINCgkJCTk0LjgsMTAzLjUgMTA1LjUsODQuMiA4MS4xLDQyLjEgMzIuNyw0Mi4xIDguMyw4NC4yIDIwLDEwMy41IAkJIi8+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=" } | ||
], | ||
"caseTemplate": "external-alert" | ||
}' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters