Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit ac7a851

Browse files
committed
Create malware for example
1 parent c87c85e commit ac7a851

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

examples/get_indicators_of_malware.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
# Variables
66
api_url = "http://opencti:4000"
77
api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159"
8-
malwareName = "Emotet"
8+
malwareName = "Example test malware"
99

1010
# OpenCTI initialization
11-
opencti_api_client = OpenCTIApiClient(api_url, api_token)
11+
opencti_api_client = OpenCTIApiClient(api_url, api_token, "info")
12+
13+
# Create the Malware
14+
malwareCreated = opencti_api_client.malware.create(
15+
name=malwareName, description="Example test malware"
16+
)
1217

1318
# Get the malware set in variable
1419
malwareEntity = opencti_api_client.malware.read(
@@ -18,14 +23,15 @@
1823
"filterGroups": [],
1924
}
2025
)
21-
print("Malware found")
22-
print(malwareEntity)
23-
26+
print("Malware found", malwareEntity)
27+
2428
# Get the relations from the malware to indicators
2529
stix_relations = opencti_api_client.stix_core_relationship.list(
2630
fromTypes=["Indicator"], toId=malwareEntity["id"]
2731
)
2832

33+
print("Rel:", stix_relations)
34+
2935
# Print
3036
for stix_relation in stix_relations:
3137
print(

0 commit comments

Comments
 (0)