From b5999629b0a7a2772f979c565fb272812ad075c7 Mon Sep 17 00:00:00 2001 From: Angelique Date: Fri, 3 Oct 2025 09:19:04 +0200 Subject: [PATCH 1/5] Lint example file --- examples/get_indicators_of_malware.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/get_indicators_of_malware.py b/examples/get_indicators_of_malware.py index 84cc2e1e5..0a6e75917 100644 --- a/examples/get_indicators_of_malware.py +++ b/examples/get_indicators_of_malware.py @@ -1,5 +1,4 @@ # coding: utf-8 -import datetime from pycti import OpenCTIApiClient @@ -27,4 +26,9 @@ # Print for stix_relation in stix_relations: - print("[" + stix_relation["from"]["standard_id"] + "] " + stix_relation["from"]["name"]) \ No newline at end of file + print( + "[" + + stix_relation["from"]["standard_id"] + + "] " + + stix_relation["from"]["name"] + ) From c87c85e288068050d1a5c6ee9ea6f2bd48e5d898 Mon Sep 17 00:00:00 2001 From: Angelique Date: Fri, 3 Oct 2025 09:41:41 +0200 Subject: [PATCH 2/5] Update var names --- examples/get_indicators_of_malware.py | 70 ++++++++++++++------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/examples/get_indicators_of_malware.py b/examples/get_indicators_of_malware.py index 0a6e75917..46e60ea70 100644 --- a/examples/get_indicators_of_malware.py +++ b/examples/get_indicators_of_malware.py @@ -1,34 +1,36 @@ -# coding: utf-8 - -from pycti import OpenCTIApiClient - -# Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" -malware = "Emotet" - -# OpenCTI initialization -opencti_api_client = OpenCTIApiClient(api_url, api_token) - -# Get the malware set in variable -malware = opencti_api_client.malware.read( - filters={ - "mode": "and", - "filters": [{"key": "name", "values": [malware]}], - "filterGroups": [], - } -) - -# Get the relations from the malware to indicators -stix_relations = opencti_api_client.stix_core_relationship.list( - fromTypes=["Indicator"], toId=malware["id"] -) - -# Print -for stix_relation in stix_relations: - print( - "[" - + stix_relation["from"]["standard_id"] - + "] " - + stix_relation["from"]["name"] - ) +# coding: utf-8 + +from pycti import OpenCTIApiClient + +# Variables +api_url = "http://opencti:4000" +api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +malwareName = "Emotet" + +# OpenCTI initialization +opencti_api_client = OpenCTIApiClient(api_url, api_token) + +# Get the malware set in variable +malwareEntity = opencti_api_client.malware.read( + filters={ + "mode": "and", + "filters": [{"key": "name", "values": [malwareName]}], + "filterGroups": [], + } +) +print("Malware found") +print(malwareEntity) + +# Get the relations from the malware to indicators +stix_relations = opencti_api_client.stix_core_relationship.list( + fromTypes=["Indicator"], toId=malwareEntity["id"] +) + +# Print +for stix_relation in stix_relations: + print( + "[" + + stix_relation["from"]["standard_id"] + + "] " + + stix_relation["from"]["name"] + ) From ac7a851390e4c303296229aab9c1dad36512b116 Mon Sep 17 00:00:00 2001 From: Angelique Date: Fri, 3 Oct 2025 09:59:52 +0200 Subject: [PATCH 3/5] Create malware for example --- examples/get_indicators_of_malware.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/get_indicators_of_malware.py b/examples/get_indicators_of_malware.py index 46e60ea70..281141dc5 100644 --- a/examples/get_indicators_of_malware.py +++ b/examples/get_indicators_of_malware.py @@ -5,10 +5,15 @@ # Variables api_url = "http://opencti:4000" api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" -malwareName = "Emotet" +malwareName = "Example test malware" # OpenCTI initialization -opencti_api_client = OpenCTIApiClient(api_url, api_token) +opencti_api_client = OpenCTIApiClient(api_url, api_token, "info") + +# Create the Malware +malwareCreated = opencti_api_client.malware.create( + name=malwareName, description="Example test malware" +) # Get the malware set in variable malwareEntity = opencti_api_client.malware.read( @@ -18,14 +23,15 @@ "filterGroups": [], } ) -print("Malware found") -print(malwareEntity) - +print("Malware found", malwareEntity) + # Get the relations from the malware to indicators stix_relations = opencti_api_client.stix_core_relationship.list( fromTypes=["Indicator"], toId=malwareEntity["id"] ) +print("Rel:", stix_relations) + # Print for stix_relation in stix_relations: print( From 29d0a4776d41fdbe6dc173822a30f837e4d3d5e7 Mon Sep 17 00:00:00 2001 From: Angelique Date: Fri, 3 Oct 2025 10:14:03 +0200 Subject: [PATCH 4/5] Make example opencti url and token configurable --- README.md | 14 ++++++++++++++ examples/add_external_reference_to_report.py | 5 +++-- examples/add_label_to_malware.py | 5 +++-- examples/add_label_to_observable.py | 5 +++-- examples/add_organization_to_sector.py | 5 +++-- examples/add_tool_usage_to_intrusion-set.py | 5 +++-- examples/ask_enrichment_of_observable.py | 6 ++++-- .../cmd_line_tag_latest_indicators_of_threat.py | 5 +++-- .../create_campaign_attributed-to_intrusion_set.py | 5 +++-- examples/create_file_with_hashes.py | 5 +++-- .../create_incident_with_ttps_and_indicators.py | 5 +++-- examples/create_indicator_of_campaign.py | 5 +++-- examples/create_intrusion_set.py | 5 +++-- examples/create_ip_domain_resolution.py | 5 +++-- examples/create_marking_definition.py | 5 +++-- examples/create_observable_relationships.py | 5 +++-- examples/create_process_observable.py | 5 +++-- examples/create_report_with_author.py | 5 +++-- examples/delete_intrusion_set.py | 5 +++-- examples/delete_relation.py | 6 +++--- examples/export_async_of_indicators.py | 6 +++--- examples/export_async_of_malware.py | 6 +++--- examples/export_incident_stix2.py | 6 +++--- examples/export_incidents_stix2.py | 6 +++--- examples/export_intrusion_set_stix2.py | 6 +++--- examples/export_report_stix2.py | 6 +++--- examples/get_all_indicators_using_pagination.py | 6 +++--- examples/get_all_reports_using_pagination.py | 6 +++--- examples/get_attack_pattern_by_mitre_id.py | 6 +++--- examples/get_entity_by_name_or_alias.py | 6 +++--- examples/get_indicators_of_malware.py | 5 +++-- examples/get_malwares_of_intrusion_set.py | 5 +++-- examples/get_marking_definitions.py | 6 +++--- examples/get_observable_exact_match.py | 6 +++--- examples/get_observables_search.py | 6 +++--- examples/get_reports_about_intrusion_set.py | 6 +++--- examples/import_stix2_file.py | 6 +++--- examples/promote_observable_to_indicator.py | 7 +++---- examples/run_all.sh | 0 examples/search_attack_pattern.py | 6 +++--- examples/search_malware.py | 6 +++--- examples/update_entity_attribute.py | 5 +++-- examples/update_observable_attributes.py | 6 +++--- examples/upload_artifacts.py | 4 ++-- examples/upload_file.py | 6 +++--- examples/upload_file_to_intrusion_set.py | 6 +++--- 46 files changed, 146 insertions(+), 111 deletions(-) mode change 100644 => 100755 examples/run_all.sh diff --git a/README.md b/README.md index 18e04eea1..15a87a34d 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,20 @@ Integration testing $ pytest ./tests/02-integration/ ``` +Example testing: + +> OpenCTI must be running + +```bash +cd examples +# Configure with you local instance of OpenCTI +export OPENCTI_API_URL="http://localhost:4000" +export OPENCTI_API_TOKEN="xxxxxxxxxxxxxxxxxxxxxx" + +#Run one example file +python get_indicators_of_malware.py +``` + ## About OpenCTI is a product designed and developed by the company [Filigran](https://filigran.io). diff --git a/examples/add_external_reference_to_report.py b/examples/add_external_reference_to_report.py index 7653f4d05..9aa2803a4 100644 --- a/examples/add_external_reference_to_report.py +++ b/examples/add_external_reference_to_report.py @@ -1,12 +1,13 @@ # coding: utf-8 +import os from dateutil.parser import parse from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/add_label_to_malware.py b/examples/add_label_to_malware.py index 48daa11a5..cd5097531 100644 --- a/examples/add_label_to_malware.py +++ b/examples/add_label_to_malware.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/add_label_to_observable.py b/examples/add_label_to_observable.py index 7bf249508..b7e6eb3ad 100644 --- a/examples/add_label_to_observable.py +++ b/examples/add_label_to_observable.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/add_organization_to_sector.py b/examples/add_organization_to_sector.py index 692bb38ba..7d3e39830 100644 --- a/examples/add_organization_to_sector.py +++ b/examples/add_organization_to_sector.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/add_tool_usage_to_intrusion-set.py b/examples/add_tool_usage_to_intrusion-set.py index 154c8af11..13c36ebd1 100644 --- a/examples/add_tool_usage_to_intrusion-set.py +++ b/examples/add_tool_usage_to_intrusion-set.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/ask_enrichment_of_observable.py b/examples/ask_enrichment_of_observable.py index a8516071c..c7f5db1d9 100644 --- a/examples/ask_enrichment_of_observable.py +++ b/examples/ask_enrichment_of_observable.py @@ -1,9 +1,11 @@ # coding: utf-8 +import os + from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # Define name of INTERNAL_ENRICHMENT Connector which can enrich IPv4 addresses connector_name = "AbuseIPDB" diff --git a/examples/cmd_line_tag_latest_indicators_of_threat.py b/examples/cmd_line_tag_latest_indicators_of_threat.py index 748d7b4c6..99e7e9223 100644 --- a/examples/cmd_line_tag_latest_indicators_of_threat.py +++ b/examples/cmd_line_tag_latest_indicators_of_threat.py @@ -1,4 +1,5 @@ # coding: utf-8 +import os import argparse from dateutil.parser import parse @@ -6,8 +7,8 @@ from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_campaign_attributed-to_intrusion_set.py b/examples/create_campaign_attributed-to_intrusion_set.py index 8be3fbd3b..17ba332dd 100644 --- a/examples/create_campaign_attributed-to_intrusion_set.py +++ b/examples/create_campaign_attributed-to_intrusion_set.py @@ -1,12 +1,13 @@ # coding: utf-8 +import os from dateutil.parser import parse from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_file_with_hashes.py b/examples/create_file_with_hashes.py index 2ef369619..f930075d1 100644 --- a/examples/create_file_with_hashes.py +++ b/examples/create_file_with_hashes.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_incident_with_ttps_and_indicators.py b/examples/create_incident_with_ttps_and_indicators.py index f51aa8a5f..68b631725 100644 --- a/examples/create_incident_with_ttps_and_indicators.py +++ b/examples/create_incident_with_ttps_and_indicators.py @@ -1,12 +1,13 @@ # coding: utf-8 +import os from dateutil.parser import parse from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_indicator_of_campaign.py b/examples/create_indicator_of_campaign.py index ed0d8e6c6..ea8b767b0 100644 --- a/examples/create_indicator_of_campaign.py +++ b/examples/create_indicator_of_campaign.py @@ -1,12 +1,13 @@ # coding: utf-8 +import os from dateutil.parser import parse from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_intrusion_set.py b/examples/create_intrusion_set.py index 29db15374..418cdbc2f 100644 --- a/examples/create_intrusion_set.py +++ b/examples/create_intrusion_set.py @@ -1,12 +1,13 @@ # coding: utf-8 +import os import datetime from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_ip_domain_resolution.py b/examples/create_ip_domain_resolution.py index e924c3c55..a4ac78ab3 100644 --- a/examples/create_ip_domain_resolution.py +++ b/examples/create_ip_domain_resolution.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_marking_definition.py b/examples/create_marking_definition.py index 05f4e5807..08ef2e1e4 100644 --- a/examples/create_marking_definition.py +++ b/examples/create_marking_definition.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_observable_relationships.py b/examples/create_observable_relationships.py index 36374e9cb..a8f55066d 100644 --- a/examples/create_observable_relationships.py +++ b/examples/create_observable_relationships.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_process_observable.py b/examples/create_process_observable.py index 41092038a..5ad674310 100644 --- a/examples/create_process_observable.py +++ b/examples/create_process_observable.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/create_report_with_author.py b/examples/create_report_with_author.py index a9aa2406c..54c51b575 100644 --- a/examples/create_report_with_author.py +++ b/examples/create_report_with_author.py @@ -1,12 +1,13 @@ # coding: utf-8 +import os from dateutil.parser import parse from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/delete_intrusion_set.py b/examples/delete_intrusion_set.py index b438e3d69..12aa6b571 100644 --- a/examples/delete_intrusion_set.py +++ b/examples/delete_intrusion_set.py @@ -1,11 +1,12 @@ # coding: utf-8 +import os import datetime from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/delete_relation.py b/examples/delete_relation.py index e981bdb82..771ba9440 100644 --- a/examples/delete_relation.py +++ b/examples/delete_relation.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/export_async_of_indicators.py b/examples/export_async_of_indicators.py index cdc819ad8..9877c5521 100644 --- a/examples/export_async_of_indicators.py +++ b/examples/export_async_of_indicators.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/export_async_of_malware.py b/examples/export_async_of_malware.py index cdc819ad8..9877c5521 100644 --- a/examples/export_async_of_malware.py +++ b/examples/export_async_of_malware.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/export_incident_stix2.py b/examples/export_incident_stix2.py index b2320aa4b..4480ad11b 100644 --- a/examples/export_incident_stix2.py +++ b/examples/export_incident_stix2.py @@ -1,12 +1,12 @@ # coding: utf-8 - +import os import json from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/export_incidents_stix2.py b/examples/export_incidents_stix2.py index 8fe5bdaab..57955284e 100644 --- a/examples/export_incidents_stix2.py +++ b/examples/export_incidents_stix2.py @@ -1,12 +1,12 @@ # coding: utf-8 - +import os import json from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/export_intrusion_set_stix2.py b/examples/export_intrusion_set_stix2.py index d153c95ed..515accb17 100644 --- a/examples/export_intrusion_set_stix2.py +++ b/examples/export_intrusion_set_stix2.py @@ -1,12 +1,12 @@ # coding: utf-8 - +import os import json from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/export_report_stix2.py b/examples/export_report_stix2.py index 402898bee..04266e614 100644 --- a/examples/export_report_stix2.py +++ b/examples/export_report_stix2.py @@ -1,12 +1,12 @@ # coding: utf-8 - +import os import json from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_all_indicators_using_pagination.py b/examples/get_all_indicators_using_pagination.py index 668619a64..62f84c175 100644 --- a/examples/get_all_indicators_using_pagination.py +++ b/examples/get_all_indicators_using_pagination.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_all_reports_using_pagination.py b/examples/get_all_reports_using_pagination.py index 10b66e805..2d7443092 100644 --- a/examples/get_all_reports_using_pagination.py +++ b/examples/get_all_reports_using_pagination.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_attack_pattern_by_mitre_id.py b/examples/get_attack_pattern_by_mitre_id.py index d60b75a71..55699265d 100644 --- a/examples/get_attack_pattern_by_mitre_id.py +++ b/examples/get_attack_pattern_by_mitre_id.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_entity_by_name_or_alias.py b/examples/get_entity_by_name_or_alias.py index e25a03a35..9d967d134 100644 --- a/examples/get_entity_by_name_or_alias.py +++ b/examples/get_entity_by_name_or_alias.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_indicators_of_malware.py b/examples/get_indicators_of_malware.py index 281141dc5..11ef6f789 100644 --- a/examples/get_indicators_of_malware.py +++ b/examples/get_indicators_of_malware.py @@ -1,10 +1,11 @@ # coding: utf-8 +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") malwareName = "Example test malware" # OpenCTI initialization diff --git a/examples/get_malwares_of_intrusion_set.py b/examples/get_malwares_of_intrusion_set.py index 574327354..a98a7c0f1 100644 --- a/examples/get_malwares_of_intrusion_set.py +++ b/examples/get_malwares_of_intrusion_set.py @@ -1,11 +1,12 @@ # coding: utf-8 +import os import datetime from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_marking_definitions.py b/examples/get_marking_definitions.py index 91e1c71be..e5cab7649 100644 --- a/examples/get_marking_definitions.py +++ b/examples/get_marking_definitions.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_observable_exact_match.py b/examples/get_observable_exact_match.py index c26127e66..b6b1ad40b 100644 --- a/examples/get_observable_exact_match.py +++ b/examples/get_observable_exact_match.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_observables_search.py b/examples/get_observables_search.py index 73bd7744c..702f3fc9d 100644 --- a/examples/get_observables_search.py +++ b/examples/get_observables_search.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/get_reports_about_intrusion_set.py b/examples/get_reports_about_intrusion_set.py index 3078f55fc..d0fdacd1f 100644 --- a/examples/get_reports_about_intrusion_set.py +++ b/examples/get_reports_about_intrusion_set.py @@ -1,12 +1,12 @@ # coding: utf-8 +import os import datetime from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" - +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/import_stix2_file.py b/examples/import_stix2_file.py index e7026f76f..cb1627993 100644 --- a/examples/import_stix2_file.py +++ b/examples/import_stix2_file.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/promote_observable_to_indicator.py b/examples/promote_observable_to_indicator.py index 56e6be30d..ddc95b2f9 100644 --- a/examples/promote_observable_to_indicator.py +++ b/examples/promote_observable_to_indicator.py @@ -1,11 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" - +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/run_all.sh b/examples/run_all.sh old mode 100644 new mode 100755 diff --git a/examples/search_attack_pattern.py b/examples/search_attack_pattern.py index 0c7ff433d..d07d786fb 100644 --- a/examples/search_attack_pattern.py +++ b/examples/search_attack_pattern.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/search_malware.py b/examples/search_malware.py index c3ae3bf1c..7394a0e1d 100644 --- a/examples/search_malware.py +++ b/examples/search_malware.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/update_entity_attribute.py b/examples/update_entity_attribute.py index 3a8e51988..69bfad5ca 100644 --- a/examples/update_entity_attribute.py +++ b/examples/update_entity_attribute.py @@ -1,11 +1,12 @@ # coding: utf-8 +import os import datetime from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/update_observable_attributes.py b/examples/update_observable_attributes.py index 1ef7fbf4e..626736da6 100644 --- a/examples/update_observable_attributes.py +++ b/examples/update_observable_attributes.py @@ -1,10 +1,10 @@ # coding: utf-8 - +import os from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/upload_artifacts.py b/examples/upload_artifacts.py index 9a5d3ecc5..36cf2847f 100644 --- a/examples/upload_artifacts.py +++ b/examples/upload_artifacts.py @@ -5,8 +5,8 @@ from pycti import OpenCTIApiClient -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI instantiation OPENCTI_API_CLIENT = OpenCTIApiClient(api_url, api_token) diff --git a/examples/upload_file.py b/examples/upload_file.py index 934ad4717..47b0c6a57 100644 --- a/examples/upload_file.py +++ b/examples/upload_file.py @@ -1,12 +1,12 @@ # coding: utf-8 - +import os from stix2 import TLP_GREEN from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) diff --git a/examples/upload_file_to_intrusion_set.py b/examples/upload_file_to_intrusion_set.py index 4887406e6..0ee07ff6c 100644 --- a/examples/upload_file_to_intrusion_set.py +++ b/examples/upload_file_to_intrusion_set.py @@ -1,12 +1,12 @@ # coding: utf-8 - +import os import datetime from pycti import OpenCTIApiClient # Variables -api_url = "http://opencti:4000" -api_token = "bfa014e0-e02e-4aa6-a42b-603b19dcf159" +api_url = os.getenv("OPENCTI_API_URL", "http://opencti:4000") +api_token = os.getenv("OPENCTI_API_TOKEN", "bfa014e0-e02e-4aa6-a42b-603b19dcf159") # OpenCTI initialization opencti_api_client = OpenCTIApiClient(api_url, api_token) From e99b1c87c7d7420477091ac5330921e2a791a202 Mon Sep 17 00:00:00 2001 From: Angelique Date: Fri, 3 Oct 2025 10:17:49 +0200 Subject: [PATCH 5/5] Sorting import --- examples/cmd_line_tag_latest_indicators_of_threat.py | 2 +- examples/create_intrusion_set.py | 3 +-- examples/delete_intrusion_set.py | 2 +- examples/delete_relation.py | 1 + examples/export_async_of_indicators.py | 1 + examples/export_async_of_malware.py | 1 + examples/export_incident_stix2.py | 2 +- examples/export_incidents_stix2.py | 2 +- examples/export_intrusion_set_stix2.py | 2 +- examples/export_report_stix2.py | 2 +- examples/get_all_indicators_using_pagination.py | 1 + examples/get_all_reports_using_pagination.py | 1 + examples/get_attack_pattern_by_mitre_id.py | 1 + examples/get_entity_by_name_or_alias.py | 1 + examples/get_malwares_of_intrusion_set.py | 2 +- examples/get_marking_definitions.py | 1 + examples/get_observable_exact_match.py | 1 + examples/get_observables_search.py | 1 + examples/get_reports_about_intrusion_set.py | 2 +- examples/import_stix2_file.py | 1 + examples/promote_observable_to_indicator.py | 1 + examples/search_attack_pattern.py | 1 + examples/search_malware.py | 1 + examples/update_entity_attribute.py | 2 +- examples/update_observable_attributes.py | 1 + examples/upload_file.py | 1 + examples/upload_file_to_intrusion_set.py | 2 +- 27 files changed, 27 insertions(+), 12 deletions(-) diff --git a/examples/cmd_line_tag_latest_indicators_of_threat.py b/examples/cmd_line_tag_latest_indicators_of_threat.py index 99e7e9223..ec165b48e 100644 --- a/examples/cmd_line_tag_latest_indicators_of_threat.py +++ b/examples/cmd_line_tag_latest_indicators_of_threat.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import argparse +import os from dateutil.parser import parse diff --git a/examples/create_intrusion_set.py b/examples/create_intrusion_set.py index 418cdbc2f..babec9ae2 100644 --- a/examples/create_intrusion_set.py +++ b/examples/create_intrusion_set.py @@ -1,7 +1,6 @@ # coding: utf-8 -import os - import datetime +import os from pycti import OpenCTIApiClient diff --git a/examples/delete_intrusion_set.py b/examples/delete_intrusion_set.py index 12aa6b571..25f279271 100644 --- a/examples/delete_intrusion_set.py +++ b/examples/delete_intrusion_set.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import datetime +import os from pycti import OpenCTIApiClient diff --git a/examples/delete_relation.py b/examples/delete_relation.py index 771ba9440..3e41e5084 100644 --- a/examples/delete_relation.py +++ b/examples/delete_relation.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/export_async_of_indicators.py b/examples/export_async_of_indicators.py index 9877c5521..31e2ee1bb 100644 --- a/examples/export_async_of_indicators.py +++ b/examples/export_async_of_indicators.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/export_async_of_malware.py b/examples/export_async_of_malware.py index 9877c5521..31e2ee1bb 100644 --- a/examples/export_async_of_malware.py +++ b/examples/export_async_of_malware.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/export_incident_stix2.py b/examples/export_incident_stix2.py index 4480ad11b..32420ab90 100644 --- a/examples/export_incident_stix2.py +++ b/examples/export_incident_stix2.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import json +import os from pycti import OpenCTIApiClient diff --git a/examples/export_incidents_stix2.py b/examples/export_incidents_stix2.py index 57955284e..a0ad44587 100644 --- a/examples/export_incidents_stix2.py +++ b/examples/export_incidents_stix2.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import json +import os from pycti import OpenCTIApiClient diff --git a/examples/export_intrusion_set_stix2.py b/examples/export_intrusion_set_stix2.py index 515accb17..fc93882d8 100644 --- a/examples/export_intrusion_set_stix2.py +++ b/examples/export_intrusion_set_stix2.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import json +import os from pycti import OpenCTIApiClient diff --git a/examples/export_report_stix2.py b/examples/export_report_stix2.py index 04266e614..642438d66 100644 --- a/examples/export_report_stix2.py +++ b/examples/export_report_stix2.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import json +import os from pycti import OpenCTIApiClient diff --git a/examples/get_all_indicators_using_pagination.py b/examples/get_all_indicators_using_pagination.py index 62f84c175..6c3de77b8 100644 --- a/examples/get_all_indicators_using_pagination.py +++ b/examples/get_all_indicators_using_pagination.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/get_all_reports_using_pagination.py b/examples/get_all_reports_using_pagination.py index 2d7443092..acd79fb15 100644 --- a/examples/get_all_reports_using_pagination.py +++ b/examples/get_all_reports_using_pagination.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/get_attack_pattern_by_mitre_id.py b/examples/get_attack_pattern_by_mitre_id.py index 55699265d..31b58caa5 100644 --- a/examples/get_attack_pattern_by_mitre_id.py +++ b/examples/get_attack_pattern_by_mitre_id.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/get_entity_by_name_or_alias.py b/examples/get_entity_by_name_or_alias.py index 9d967d134..483426880 100644 --- a/examples/get_entity_by_name_or_alias.py +++ b/examples/get_entity_by_name_or_alias.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/get_malwares_of_intrusion_set.py b/examples/get_malwares_of_intrusion_set.py index a98a7c0f1..c616c5665 100644 --- a/examples/get_malwares_of_intrusion_set.py +++ b/examples/get_malwares_of_intrusion_set.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import datetime +import os from pycti import OpenCTIApiClient diff --git a/examples/get_marking_definitions.py b/examples/get_marking_definitions.py index e5cab7649..89c91d397 100644 --- a/examples/get_marking_definitions.py +++ b/examples/get_marking_definitions.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/get_observable_exact_match.py b/examples/get_observable_exact_match.py index b6b1ad40b..f05ea8f8e 100644 --- a/examples/get_observable_exact_match.py +++ b/examples/get_observable_exact_match.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/get_observables_search.py b/examples/get_observables_search.py index 702f3fc9d..7e8e8cebb 100644 --- a/examples/get_observables_search.py +++ b/examples/get_observables_search.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/get_reports_about_intrusion_set.py b/examples/get_reports_about_intrusion_set.py index d0fdacd1f..57ed68d4a 100644 --- a/examples/get_reports_about_intrusion_set.py +++ b/examples/get_reports_about_intrusion_set.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import datetime +import os from pycti import OpenCTIApiClient diff --git a/examples/import_stix2_file.py b/examples/import_stix2_file.py index cb1627993..6b73bb611 100644 --- a/examples/import_stix2_file.py +++ b/examples/import_stix2_file.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/promote_observable_to_indicator.py b/examples/promote_observable_to_indicator.py index ddc95b2f9..048f2ed7f 100644 --- a/examples/promote_observable_to_indicator.py +++ b/examples/promote_observable_to_indicator.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/search_attack_pattern.py b/examples/search_attack_pattern.py index d07d786fb..30937b5f8 100644 --- a/examples/search_attack_pattern.py +++ b/examples/search_attack_pattern.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/search_malware.py b/examples/search_malware.py index 7394a0e1d..c62914a58 100644 --- a/examples/search_malware.py +++ b/examples/search_malware.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/update_entity_attribute.py b/examples/update_entity_attribute.py index 69bfad5ca..16f2b2eb3 100644 --- a/examples/update_entity_attribute.py +++ b/examples/update_entity_attribute.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import datetime +import os from pycti import OpenCTIApiClient diff --git a/examples/update_observable_attributes.py b/examples/update_observable_attributes.py index 626736da6..26f4b8e47 100644 --- a/examples/update_observable_attributes.py +++ b/examples/update_observable_attributes.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from pycti import OpenCTIApiClient # Variables diff --git a/examples/upload_file.py b/examples/upload_file.py index 47b0c6a57..2fbea5694 100644 --- a/examples/upload_file.py +++ b/examples/upload_file.py @@ -1,5 +1,6 @@ # coding: utf-8 import os + from stix2 import TLP_GREEN from pycti import OpenCTIApiClient diff --git a/examples/upload_file_to_intrusion_set.py b/examples/upload_file_to_intrusion_set.py index 0ee07ff6c..66973a1fe 100644 --- a/examples/upload_file_to_intrusion_set.py +++ b/examples/upload_file_to_intrusion_set.py @@ -1,6 +1,6 @@ # coding: utf-8 -import os import datetime +import os from pycti import OpenCTIApiClient