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

Commit 6e61fe4

Browse files
author
Samuel Hassine
committed
[client] Add a method to add tags on an entity
1 parent 89d80ca commit 6e61fe4

19 files changed

+102
-17
lines changed

examples/add_external_reference_to_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Variables
77
api_url = 'https://demo.opencti.io'
8-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
8+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
99

1010
# OpenCTI initialization
1111
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/add_organization_to_sector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Variables
88
api_url = 'https://demo.opencti.io'
9-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
9+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
1010

1111
# OpenCTI initialization
1212
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/add_tag_to_malwre.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# coding: utf-8
2+
3+
from dateutil.parser import parse
4+
from pycti import OpenCTIApiClient
5+
6+
# Variables
7+
api_url = 'https://demo.opencti.io'
8+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
9+
10+
# OpenCTI initialization
11+
opencti_api_client = OpenCTIApiClient(api_url, api_token)
12+
13+
# Create the malware
14+
malware = opencti_api_client.malware.create(
15+
name='My new malware',
16+
description='A new evil tool.'
17+
)
18+
19+
# Create the tag (if not exists)
20+
21+
# Add the tag
22+
23+
# Print
24+
print(malware)

examples/create_campaign_attributed-to_intrusion_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Variables
77
api_url = 'https://demo.opencti.io'
8-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
8+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
99

1010
# OpenCTI initialization
1111
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/create_incident_with_ttps_and_indicators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Variables
99
api_url = 'https://demo.opencti.io'
10-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
10+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
1111

1212
# OpenCTI initialization
1313
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/create_indicator_of_campaign.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Variables
99
api_url = 'https://demo.opencti.io'
10-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
10+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
1111

1212
# OpenCTI initialization
1313
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/create_intrusion_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Variables
77
api_url = 'https://demo.opencti.io'
8-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
8+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
99

1010
# OpenCTI initialization
1111
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/create_marking_definition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Variables
66
api_url = 'https://demo.opencti.io'
7-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
7+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
88

99
# OpenCTI initialization
1010
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/create_report_with_author.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Variables
77
api_url = 'https://demo.opencti.io'
8-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
8+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
99

1010
# OpenCTI initialization
1111
opencti_api_client = OpenCTIApiClient(api_url, api_token)

examples/export_intrusion_set_stix2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Variables
77
api_url = 'https://demo.opencti.io'
8-
api_token = 'c2d944bb-aea6-4bd6-b3d7-6c10451e2256'
8+
api_token = 'fa63eb1f-bf14-4777-9190-43b4571cbc8b'
99

1010
# OpenCTI initialization
1111
opencti_api_client = OpenCTIApiClient(api_url, api_token)

0 commit comments

Comments
 (0)