Skip to content

Instantly share code, notes, and snippets.

@2xyo
Last active January 28, 2020 12:47
Show Gist options
  • Save 2xyo/8345de7706fe7109997b4bbfb095d241 to your computer and use it in GitHub Desktop.
Save 2xyo/8345de7706fe7109997b4bbfb095d241 to your computer and use it in GitHub Desktop.
testcase
# coding: utf-8
import datetime
from dateutil.parser import parse
from pprint import pprint
from pycti import OpenCTIApiClient
api_url = "https://demo.opencti.io"
api_token = "609caced-7610-4c84-80b4-f3a380d1939b"
opencti_api_client = OpenCTIApiClient(api_url, api_token)
observable_ttp1 = opencti_api_client.stix_observable.create(
type="Email-Address", observable_value="[email protected]", createIndicator=True
)
pprint(observable_ttp1)
observable_ttp2 = opencti_api_client.stix_observable.create(
type="Email-Address", observable_value="[email protected]", createIndicator=False
)
pprint(observable_ttp2)
{'createdByRef': None,
'created_at': '2020-01-28T12:44:54.061Z',
'description': None,
'entity_type': 'email-address',
'externalReferences': [],
'externalReferencesIds': [],
'id': '876f3b97-54e1-45d8-86f5-e67d297dba88',
'indicators': [{'created': '2020-01-28T12:44:55.111Z',
'createdByRef': None,
'entity_type': 'indicator',
'id': '8cfd3951-436e-4799-b732-522f10c69b95',
'indicator_pattern': '[email-addr:value = '
"'[email protected]']",
'modified': '2020-01-28T12:44:55.111Z',
'pattern_type': 'stix',
'remote_relation_id': 'd0c70b9a-2dc1-526d-a808-8004391ce4a3',
'score': 50,
'stix_id_key': 'indicator--da818d0e-7482-4dfd-910d-71bc9b9ad407',
'valid_from': '2020-01-28T12:44:55.110Z',
'valid_until': '2021-01-27T12:44:55.110Z'}],
'indicatorsIds': ['8cfd3951-436e-4799-b732-522f10c69b95'],
'markingDefinitions': [],
'markingDefinitionsIds': [],
'name': '',
'observable_value': '[email protected]',
'stix_id_key': 'observable--3c5d2a87-0ea4-4ebf-87b1-89fe3de8bf9f',
'tags': [],
'tagsIds': [],
'updated_at': '2020-01-28T12:44:54.061Z'}
{'createdByRef': None,
'created_at': '2020-01-28T12:44:58.695Z',
'description': None,
'entity_type': 'email-address',
'externalReferences': [],
'externalReferencesIds': [],
'id': 'f0319b81-0ba8-44bd-b286-312ac7eee852',
'indicators': [],
'indicatorsIds': [],
'markingDefinitions': [],
'markingDefinitionsIds': [],
'name': '',
'observable_value': '[email protected]',
'stix_id_key': 'observable--e191d389-774e-4dc3-a27f-4cc21b8dd97b',
'tags': [],
'tagsIds': [],
'updated_at': '2020-01-28T12:44:58.695Z'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment