Skip to content

Commit

Permalink
#12 Add task doc
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Sep 6, 2021
1 parent 3e84d94 commit c27c5fd
Show file tree
Hide file tree
Showing 11 changed files with 556 additions and 5 deletions.
12 changes: 11 additions & 1 deletion docs/thehive/api/task/.pages
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
nav:
- create.md
- update.md
- update.md
- get.md
- list.md
- run-responder.md
- responder-jobs.md
- create-log.md
- delete-lod.md
- log-run-responder.md
- log-responder-jobs.md
- logs.md
- waiting-tasks.md
84 changes: 84 additions & 0 deletions docs/thehive/api/task/create-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Add log

Add a *Log* to an existing task (requires `manageTask` permission).

## Query

```plain
POST /api/case/task/{id}/log
```

With:

- `id`: Task identifier

## Request Body Example

!!! Example ""

```json
{
"message": "The sandbox hasn't detected any suspicious activity",
"startDate": 1630683608000,
}
```

The only required field is `message`.


If you want to attach a file to the log, you need to use a multipart request

!!! Example ""


```
curl -XPOST http://THEHIVE/api/v0/case/task/{taskId}/log -F [email protected] -F _json='
{
"message": "The sandbox report"
}
'
```

## Response

### Status codes

- `201`: if *Log* is created successfully
- `401`: Authentication error
- `403`: Authorization error

### Response Body Example

!!! Example ""

=== "201"

```json
{
"id": "~4264",
"_id": "~4264",
"createdBy": "[email protected]",
"createdAt": 1630684502715,
"_type": "case_taskçlog",
"message": "The sandbox hasn't detected any suspicious activity",
"startDate": 1630683608000
}
```

=== "401"

```json
{
"type": "AuthenticationError",
"message": "Authentication failure"
}
```

=== "403"

```json
{
"type": "AuthorizationError",
"message": "Your are not authorized to create Log, you haven't the permission manageTask"
}
```
21 changes: 21 additions & 0 deletions docs/thehive/api/task/delete-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add log

Add a *Log* to an existing task (requires `manageTask` permission).

## Query

```plain
DELETE /api/case/task/log/{id}
```

With:

- `id`: Log identifier

## Response

### Status codes

- `204`: if *Log* is created successfully
- `401`: Authentication error
- `403`: Authorization error
65 changes: 65 additions & 0 deletions docs/thehive/api/task/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# List

List *Task*s of a case.

## Query

```plain
GET /api/case/task/{id}
```

with:

- `id`: id of the task.

## Response

### Status codes

- `200`: if query is run successfully
- `401`: Authentication error
- `404`: The *Task* is not found

### ResponseBody Example

!!! Example ""

=== "201"

```json
{
"id": "~4264",
"_id": "~4264",
"createdBy": "[email protected]",
"createdAt": 1630684502715,
"_type": "case_task",
"title": "Malware analysis",
"group": "identification",
"description": "Analysis of the file to identify the malware",
"owner": "[email protected]",
"status": "InProgress",
"flag": false,
"startDate": 1630683608000,
"endDate": 1630684608000,
"order": 3,
"dueDate": 1630694608000
}
```

=== "401"

```json
{
"type": "AuthenticationError",
"message": "Authentication failure"
}
```

=== "404"

```json
{
"type": "AuthenticationError",
"message": "Task not found"
}
```
6 changes: 3 additions & 3 deletions docs/thehive/api/task/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

## Case task log oprations

- [List task logs](logs.md)
- [List task logs](logs.md) TODO
- [Create task log](create-log.md)
- [delete task log](delete-log.md)
- [Run responder on log](log-run-responder.md)
- [List responder jobs on log](log-responder-jobs.md)
- [List responder jobs on log](log-responder-jobs.md) TODO

## Global task operations

- [List waiting tasks](waiting-tasks.md)
- [List waiting tasks](waiting-tasks.md) TODO
2 changes: 1 addition & 1 deletion docs/thehive/api/task/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ POST /api/v0/query

### Status codes

- `200`: if *Task* is updated successfully
- `200`: if query is run successfully
- `401`: Authentication error

### ResponseBody Example
Expand Down
54 changes: 54 additions & 0 deletions docs/thehive/api/task/log-responder-jobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# List responder actions

List actions run on a log.

## Query

```plain
GET /api/connector/cortex/action/case_task_log/{id}
```

With:

- `id`: Log identifier

## Response

### Status codes

- `200`: if query is run successfully
- `401`: Authentication error

### Response Body Example

!!! Example ""

=== "200"

```json
[
{
"responderId": "25dcbbb69d50dd5a5ae4bd55f4ca5903",
"responderName": "reponderName_1_0",
"responderDefinition": "reponderName_1_0",
"cortexId": "local-cortex",
"cortexJobId": "408-unsB3SwW9-eEPXXW",
"objectType": "Log",
"objectId": "~25313328",
"status": "Success",
"startDate": 1630917246993,
"endDate": 1630917254406,
"operations": "[]",
"report": "{\"summary\":{\"taxonomies\":[]},\"full\":null,\"success\":true,\"artifacts\":[],\"operations\":[],\\\"message\\\":\\\"Ok\\\",\\\"parameters\\\":{\\\"organisation\\\":\\\"StrangeBee\\\",\\\"user\\\":\\\"[email protected]\\\"},\\\"config\\\":{\\\"proxy_https\\\":null,\\\"cacerts\\\":null,\\\"check_tlp\\\":false,\\\"max_tlp\\\":2,\\\"check_pap\\\":false,\\\"max_pap\\\":2,\\\"jobTimeout\\\":30,\\\"proxy_http\\\":null}}\"}"
}
]
```

=== "401"

```json
{
"type": "AuthenticationError",
"message": "Authentication failure"
}
```
82 changes: 82 additions & 0 deletions docs/thehive/api/task/log-run-responder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Run responder

Run a responder on a *Log* (requires `manageAction` permission).

## Query

```plain
POST /api/connector/cortex/action
```

## Request Body Example

!!! Example ""

```json
{
"responderId": "25dcbbb69d50dd5a5ae4bd55f4ca5903",
"cortexId": "local-cortex",
"objectType": "case_task_log",
"objectId": "~11123"
}
```

The required fields are `responderId`, `objectType` and `objectId`.

## Response

### Status codes

- `201`: if responder is started successfully
- `401`: Authentication error
- `403`: Authorization error
- `404`: Log is not found

### Response Body Example

!!! Example ""

=== "201"

```json
{
"responderId": "25dcbbb69d50dd5a5ae4bd55f4ca5903",
"responderName": "reponderName_1_0",
"responderDefinition": "reponderName_1_0",
"cortexId": "local-cortex",
"cortexJobId": "408-unsB3SwW9-eEPXXW",
"objectType": "Log",
"objectId": "~25313328",
"status": "Waiting",
"startDate": 1630917246993,
"operations": "[]",
"report": "{}"
}
```

=== "401"

```json
{
"type": "AuthenticationError",
"message": "Authentication failure"
}
```

=== "403"

```json
{
"type": "AuthorizationError",
"message": "Your are not authorized to create action, you haven't the permission manageTask"
}
```

=== "404"

```json
{
"type": "AuthenticationError",
"message": "Log not found"
}
```
Loading

0 comments on commit c27c5fd

Please sign in to comment.