forked from OpenCTI-Platform/client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_observable_exact_match.py
41 lines (35 loc) · 1.18 KB
/
get_observable_exact_match.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# coding: utf-8
from pycti import OpenCTIApiClient
# Variables
api_url = "https://demo.opencti.io"
api_token = "YOUR_TOKEN"
# OpenCTI initialization
opencti_api_client = OpenCTIApiClient(api_url, api_token)
# Exact IP match
opencti_api_client.stix_cyber_observable.create(
simple_observable_key="IPv4-Addr.value", simple_observable_value="110.172.180.180"
)
print("IP ADDRESS")
observable = opencti_api_client.stix_cyber_observable.read(
filters=[{"key": "value", "values": ["110.172.180.180"]}]
)
print(observable)
# Exact File name match
opencti_api_client.stix_cyber_observable.create(
simple_observable_key="File.name", simple_observable_value="activeds.dll"
)
print("FILE NAME")
observable = opencti_api_client.stix_cyber_observable.read(
filters=[{"key": "name", "values": ["activeds.dll"]}]
)
print(observable)
# Exact File name match
opencti_api_client.stix_cyber_observable.create(
simple_observable_key="File.hashes.MD5",
simple_observable_value="3aad33e025303dbae12c12b4ec5258c1",
)
print("FILE MD5")
observable = opencti_api_client.stix_cyber_observable.read(
filters=[{"key": "hashes_MD5", "values": ["3aad33e025303dbae12c12b4ec5258c1"]}]
)
print(observable)