diff --git a/examples/create_observable_financial_account.py b/examples/create_observable_financial_account.py new file mode 100644 index 00000000..78bf2186 --- /dev/null +++ b/examples/create_observable_financial_account.py @@ -0,0 +1,25 @@ +# coding: utf-8 + +from pycti import OpenCTIApiClient + +# Variables +api_url = "http://localhost:4000" +api_token = "6C2C9EAE-6FF5-4421-B118-74A3CA5AAC20" + +# OpenCTI initialization +opencti_api_client = OpenCTIApiClient(api_url, api_token) + +process = opencti_api_client.stix_cyber_observable.create( + observableData={ + "type": "Financial-Account", + "account_number": "123-45-9988", + "account_status": "active", + "account_type": "credit_credit_card", + "x_opencti_score": 90, + "iban_number": "55667", + "bic_number": "009998877", + "currency_code": "bahraini_dinar_(bhd)", + } +) + +print(process) diff --git a/examples/create_observable_financial_asset.py b/examples/create_observable_financial_asset.py new file mode 100644 index 00000000..cac9e886 --- /dev/null +++ b/examples/create_observable_financial_asset.py @@ -0,0 +1,22 @@ +# coding: utf-8 + +from pycti import OpenCTIApiClient + +# Variables +api_url = "http://localhost:4000" +api_token = "6C2C9EAE-6FF5-4421-B118-74A3CA5AAC20" + +# OpenCTI initialization +opencti_api_client = OpenCTIApiClient(api_url, api_token) + +process = opencti_api_client.stix_cyber_observable.create( + observableData={ + "type": "Financial-Asset", + "name": "Joe's Big Boat", + "asset_type": "boat", + "asset_value": 12000000, + "currency_code": "belarusian_ruble_(byr)", + } +) + +print(process) diff --git a/examples/create_observable_financial_transaction.py b/examples/create_observable_financial_transaction.py new file mode 100644 index 00000000..ad3997ba --- /dev/null +++ b/examples/create_observable_financial_transaction.py @@ -0,0 +1,25 @@ +# coding: utf-8 +from dateutil.parser import parse + +from pycti import OpenCTIApiClient + +# Variables +api_url = "http://localhost:4000" +api_token = "6C2C9EAE-6FF5-4421-B118-74A3CA5AAC20" + +# OpenCTI initialization +opencti_api_client = OpenCTIApiClient(api_url, api_token) + +# Define the date +date = parse("2019-02-06").strftime("%Y-%m-%dT%H:%M:%SZ") + +process = opencti_api_client.stix_cyber_observable.create( + observableData={ + "type": "Financial-Transaction", + "transaction_date": date, + "transaction_value": 62000000, + "currency_code": "belarusian_ruble_(byr)", + } +) + +print(process) diff --git a/pycti/entities/opencti_stix_cyber_observable.py b/pycti/entities/opencti_stix_cyber_observable.py index 8cd08628..7e4ca980 100644 --- a/pycti/entities/opencti_stix_cyber_observable.py +++ b/pycti/entities/opencti_stix_cyber_observable.py @@ -1636,7 +1636,10 @@ def create(self, **kwargs): observable_data["value"] if "value" in observable_data else None ), } - elif type == "Financial-Account" or type.lower() == "x-opencti-financial-account": + elif ( + type == "Financial-Account" + or type.lower() == "x-opencti-financial-account" + ): input_variables["FinancialAccount"] = { "iban_number": observable_data.get("iban_number"), "bic_number": observable_data.get("bic_number"), @@ -1645,14 +1648,19 @@ def create(self, **kwargs): "account_type": observable_data.get("account_type"), "currency_code": observable_data.get("currency_code"), } - elif type == "Financial-Asset" or type.lower() == "x-opencti-financial-asset": + elif ( + type == "Financial-Asset" or type.lower() == "x-opencti-financial-asset" + ): input_variables["FinancialAsset"] = { "name": observable_data.get("name"), "asset_type": observable_data.get("asset_type"), "asset_value": observable_data.get("asset_value"), "currency_code": observable_data.get("currency_code"), } - elif type == "Financial-Transaction" or type.lower() == "x-opencti-transaction": + elif ( + type == "Financial-Transaction" + or type.lower() == "x-opencti-transaction" + ): input_variables["FinancialTransaction"] = { "transaction_date": observable_data.get("transaction_date"), "transaction_value": observable_data.get("transaction_value"), diff --git a/pycti/utils/constants.py b/pycti/utils/constants.py index 600f016a..be7b9e01 100644 --- a/pycti/utils/constants.py +++ b/pycti/utils/constants.py @@ -351,6 +351,7 @@ class CustomObservableCredential: # class CustomObservableCryptocurrencyWallet: # """Cryptocurrency wallet observable.""" + @CustomObservable( "phone-number", [