Skip to content

Commit 28c7a37

Browse files
Bonsai8863ParamConstructor
authored andcommitted
financial observable creation examples
1 parent 408a746 commit 28c7a37

5 files changed

+84
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# coding: utf-8
2+
3+
from pycti import OpenCTIApiClient
4+
5+
# Variables
6+
api_url = "http://localhost:4000"
7+
api_token = "6C2C9EAE-6FF5-4421-B118-74A3CA5AAC20"
8+
9+
# OpenCTI initialization
10+
opencti_api_client = OpenCTIApiClient(api_url, api_token)
11+
12+
process = opencti_api_client.stix_cyber_observable.create(
13+
observableData={
14+
"type": "Financial-Account",
15+
"account_number": "123-45-9988",
16+
"account_status": "active",
17+
"account_type": "credit_credit_card",
18+
"x_opencti_score": 90,
19+
"iban_number": "55667",
20+
"bic_number": "009998877",
21+
"currency_code": "bahraini_dinar_(bhd)",
22+
}
23+
)
24+
25+
print(process)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# coding: utf-8
2+
3+
from pycti import OpenCTIApiClient
4+
5+
# Variables
6+
api_url = "http://localhost:4000"
7+
api_token = "6C2C9EAE-6FF5-4421-B118-74A3CA5AAC20"
8+
9+
# OpenCTI initialization
10+
opencti_api_client = OpenCTIApiClient(api_url, api_token)
11+
12+
process = opencti_api_client.stix_cyber_observable.create(
13+
observableData={
14+
"type": "Financial-Asset",
15+
"name": "Joe's Big Boat",
16+
"asset_type": "boat",
17+
"asset_value": 12000000,
18+
"currency_code": "belarusian_ruble_(byr)",
19+
}
20+
)
21+
22+
print(process)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# coding: utf-8
2+
from dateutil.parser import parse
3+
4+
from pycti import OpenCTIApiClient
5+
6+
# Variables
7+
api_url = "http://localhost:4000"
8+
api_token = "6C2C9EAE-6FF5-4421-B118-74A3CA5AAC20"
9+
10+
# OpenCTI initialization
11+
opencti_api_client = OpenCTIApiClient(api_url, api_token)
12+
13+
# Define the date
14+
date = parse("2019-02-06").strftime("%Y-%m-%dT%H:%M:%SZ")
15+
16+
process = opencti_api_client.stix_cyber_observable.create(
17+
observableData={
18+
"type": "Financial-Transaction",
19+
"transaction_date": date,
20+
"transaction_value": 62000000,
21+
"currency_code": "belarusian_ruble_(byr)",
22+
}
23+
)
24+
25+
print(process)

pycti/entities/opencti_stix_cyber_observable.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,10 @@ def create(self, **kwargs):
10221022
observable_data["value"] if "value" in observable_data else None
10231023
),
10241024
}
1025-
elif type == "Financial-Account" or type.lower() == "x-opencti-financial-account":
1025+
elif (
1026+
type == "Financial-Account"
1027+
or type.lower() == "x-opencti-financial-account"
1028+
):
10261029
input_variables["FinancialAccount"] = {
10271030
"iban_number": observable_data.get("iban_number"),
10281031
"bic_number": observable_data.get("bic_number"),
@@ -1031,14 +1034,19 @@ def create(self, **kwargs):
10311034
"account_type": observable_data.get("account_type"),
10321035
"currency_code": observable_data.get("currency_code"),
10331036
}
1034-
elif type == "Financial-Asset" or type.lower() == "x-opencti-financial-asset":
1037+
elif (
1038+
type == "Financial-Asset" or type.lower() == "x-opencti-financial-asset"
1039+
):
10351040
input_variables["FinancialAsset"] = {
10361041
"name": observable_data.get("name"),
10371042
"asset_type": observable_data.get("asset_type"),
10381043
"asset_value": observable_data.get("asset_value"),
10391044
"currency_code": observable_data.get("currency_code"),
10401045
}
1041-
elif type == "Financial-Transaction" or type.lower() == "x-opencti-transaction":
1046+
elif (
1047+
type == "Financial-Transaction"
1048+
or type.lower() == "x-opencti-transaction"
1049+
):
10421050
input_variables["FinancialTransaction"] = {
10431051
"transaction_date": observable_data.get("transaction_date"),
10441052
"transaction_value": observable_data.get("transaction_value"),

pycti/utils/constants.py

+1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ class CustomObservableCredential:
351351
# class CustomObservableCryptocurrencyWallet:
352352
# """Cryptocurrency wallet observable."""
353353

354+
354355
@CustomObservable(
355356
"phone-number",
356357
[

0 commit comments

Comments
 (0)