From 79588f1269b5c35529209a829eb658f05ce8f50c Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" An advanced alert
Fortunately we can use thehive4py
's type hints to the rescue and specify more complex input alerts outside of the method call.
Here's how:
from thehive4py import TheHiveApi
+from thehive4py.types.alert import InputAlert
hive = TheHiveApi(url="http://localhost:9000", apikey="h1v3b33")
-simple_alert = hive.alert.create(
- alert={
- "type": "simple",
- "source": "tutorial",
- "sourceRef": "should-be-unique",
- "title": "a simple alert",
- "description": "a bit too simple",
- }
-)
+input_alert: InputAlert = {
+ "type": "advanced",
+ "source": "tutorial",
+ "sourceRef": "should-be-unique",
+ "title": "an advanced alert",
+ "description": "a bit more advanced",
+ "tags": ["advanced", "example"],
+ "severity": 1,
+ "caseTemplate": "my-template",
+}
+
+output_alert = hive.alert.create(alert=input_alert)
In the above snippet input_alert
is created before the create call and later passed to the alert
argument.
Finally after the creation of the alert we saved the response in the output_alert
to be able to use it later.
This way TheHive will know which attachment to pair with which observable behind the scenes.
In our example attachment_key
is used to specify the relationship between the observable and the actual file. In this case its value is a uuid, however it can be any arbitrary value, though it's important that it should uniquely identify the attachment and the observable we would like to pair in TheHive.
Sometimes an existing alert needs to be updated. TheHive offers multiple ways to accomplish this task either with a single alert or multiple ones.
+Sometimes an existing alert needs to be updated. thehive4py
offers multiple ways to accomplish this task either with a single alert or multiple ones.
A single alert can be updated using alert.update method. The method requires the alert_id
of the alert to be updated and the fields
to update.
import uuid
diff --git a/main/examples/client/index.html b/main/examples/client/index.html
index e99e7ec..e769fa3 100644
--- a/main/examples/client/index.html
+++ b/main/examples/client/index.html
@@ -16,7 +16,7 @@
-
+
diff --git a/main/index.html b/main/index.html
index d343e4e..be3eb54 100644
--- a/main/index.html
+++ b/main/index.html
@@ -14,7 +14,7 @@
-
+
diff --git a/main/reference/index.html b/main/reference/index.html
index 3a1b9ce..5ffe215 100644
--- a/main/reference/index.html
+++ b/main/reference/index.html
@@ -14,7 +14,7 @@
-
+
diff --git a/main/sitemap.xml.gz b/main/sitemap.xml.gz
index 8f2bbf57c823a26f80a69dd6cdd1f1e7cb7c1f01..b251d309b96f88a0f4fc8af5654d43d02f3e5d9a 100644
GIT binary patch
delta 13
Ucmb=gXP58h;9&4HoXB1Q02jOiN&o-=
delta 13
Ucmb=gXP58h;9z(yHj%vo02+D&(EtDd