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

Commit a91952a

Browse files
committed
financial observable creation examples
1 parent 5a3f228 commit a91952a

5 files changed

Lines changed: 84 additions & 3 deletions
Lines changed: 25 additions & 0 deletions
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)
Lines changed: 22 additions & 0 deletions
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)
Lines changed: 25 additions & 0 deletions
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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,10 @@ def create(self, **kwargs):
16361636
observable_data["value"] if "value" in observable_data else None
16371637
),
16381638
}
1639-
elif type == "Financial-Account" or type.lower() == "x-opencti-financial-account":
1639+
elif (
1640+
type == "Financial-Account"
1641+
or type.lower() == "x-opencti-financial-account"
1642+
):
16401643
input_variables["FinancialAccount"] = {
16411644
"iban_number": observable_data.get("iban_number"),
16421645
"bic_number": observable_data.get("bic_number"),
@@ -1645,14 +1648,19 @@ def create(self, **kwargs):
16451648
"account_type": observable_data.get("account_type"),
16461649
"currency_code": observable_data.get("currency_code"),
16471650
}
1648-
elif type == "Financial-Asset" or type.lower() == "x-opencti-financial-asset":
1651+
elif (
1652+
type == "Financial-Asset" or type.lower() == "x-opencti-financial-asset"
1653+
):
16491654
input_variables["FinancialAsset"] = {
16501655
"name": observable_data.get("name"),
16511656
"asset_type": observable_data.get("asset_type"),
16521657
"asset_value": observable_data.get("asset_value"),
16531658
"currency_code": observable_data.get("currency_code"),
16541659
}
1655-
elif type == "Financial-Transaction" or type.lower() == "x-opencti-transaction":
1660+
elif (
1661+
type == "Financial-Transaction"
1662+
or type.lower() == "x-opencti-transaction"
1663+
):
16561664
input_variables["FinancialTransaction"] = {
16571665
"transaction_date": observable_data.get("transaction_date"),
16581666
"transaction_value": observable_data.get("transaction_value"),

pycti/utils/constants.py

Lines changed: 1 addition & 0 deletions
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)