Skip to content

Commit eaa7812

Browse files
committed
[client] Added crypto-wallet back
1 parent 2185f8f commit eaa7812

8 files changed

+67
-41
lines changed

docs/pycti/pycti.rst

+10
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ Classes
200200
- :py:class:`CustomObservableFinancialTransaction`:
201201
Financial Transaction observable.
202202

203+
- :py:class:`CustomObservableCryptocurrencyWallet`:
204+
Cryptocurrency wallet observable.
205+
203206
- :py:class:`CustomObservableText`:
204207
Text observable.
205208

@@ -617,6 +620,13 @@ Classes
617620
.. inheritance-diagram:: CustomObservableFinancialTransaction
618621
:parts: 1
619622

623+
.. autoclass:: CustomObservableCryptocurrencyWallet
624+
:members:
625+
626+
.. rubric:: Inheritance
627+
.. inheritance-diagram:: CustomObservableCryptocurrencyWallet
628+
:parts: 1
629+
620630
.. autoclass:: CustomObservableText
621631
:members:
622632

examples/create_observable_financial_account.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"account_status": "active",
1717
"account_type": "credit_credit_card",
1818
"x_opencti_score": 90,
19-
"iban_number": "55667",
20-
"bic_number": "009998877",
19+
"iban": "55667",
20+
"bic": "009998877",
2121
"currency_code": "bahraini_dinar_(bhd)",
2222
}
2323
)

pycti/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
CustomObjectChannel,
5757
CustomObjectTask,
5858
CustomObservableCredential,
59+
CustomObservableCryptocurrencyWallet,
5960
CustomObservableFinancialAccount,
6061
CustomObservableFinancialAsset,
6162
CustomObservableFinancialTransaction,
@@ -141,6 +142,7 @@
141142
"CustomObservableFinancialAccount",
142143
"CustomObservableFinancialAsset",
143144
"CustomObservableFinancialTransaction",
145+
"CustomObservableCryptocurrencyWallet",
144146
"CustomObservableHostname",
145147
"CustomObservablePaymentCard",
146148
"CustomObservablePhoneNumber",

pycti/entities/opencti_stix_core_object.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@ def __init__(self, opencti, file):
604604
... on CryptographicKey {
605605
value
606606
}
607+
... on CryptocurrencyWallet {
608+
value
609+
}
607610
... on Hostname {
608611
value
609612
}
@@ -639,8 +642,8 @@ def __init__(self, opencti, file):
639642
account_number
640643
account_status
641644
account_type
642-
iban_number
643-
bic_number
645+
iban
646+
bic
644647
currency_code
645648
}
646649
... on FinancialAsset {
@@ -1279,6 +1282,9 @@ def __init__(self, opencti, file):
12791282
... on CryptographicKey {
12801283
value
12811284
}
1285+
... on CryptocurrencyWallet {
1286+
value
1287+
}
12821288
... on Hostname {
12831289
value
12841290
}
@@ -1308,8 +1314,8 @@ def __init__(self, opencti, file):
13081314
account_number
13091315
account_status
13101316
account_type
1311-
iban_number
1312-
bic_number
1317+
iban
1318+
bic
13131319
currency_code
13141320
}
13151321
... on FinancialAsset {

pycti/entities/opencti_stix_cyber_observable.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ def create(self, **kwargs):
394394
$WindowsRegistryKey: WindowsRegistryKeyAddInput,
395395
$WindowsRegistryValueType: WindowsRegistryValueTypeAddInput,
396396
$CryptographicKey: CryptographicKeyAddInput,
397+
$CryptocurrencyWallet: CryptocurrencyWalletAddInput,
397398
$Hostname: HostnameAddInput
398399
$Text: TextAddInput,
399400
$UserAgent: UserAgentAddInput
@@ -439,6 +440,7 @@ def create(self, **kwargs):
439440
WindowsRegistryKey: $WindowsRegistryKey,
440441
WindowsRegistryValueType: $WindowsRegistryValueType,
441442
CryptographicKey: $CryptographicKey,
443+
CryptocurrencyWallet: $CryptocurrencyWallet,
442444
Hostname: $Hostname,
443445
Text: $Text,
444446
UserAgent: $UserAgent
@@ -999,15 +1001,15 @@ def create(self, **kwargs):
9991001
else None
10001002
),
10011003
}
1002-
# elif (
1003-
# type == "Cryptocurrency-Wallet"
1004-
# or type.lower() == "x-opencti-cryptocurrency-wallet"
1005-
# ):
1006-
# input_variables["CryptocurrencyWallet"] = {
1007-
# "value": (
1008-
# observable_data["value"] if "value" in observable_data else None
1009-
# ),
1010-
# }
1004+
elif (
1005+
type == "Cryptocurrency-Wallet"
1006+
or type.lower() == "x-opencti-cryptocurrency-wallet"
1007+
):
1008+
input_variables["CryptocurrencyWallet"] = {
1009+
"value": (
1010+
observable_data["value"] if "value" in observable_data else None
1011+
),
1012+
}
10111013
elif type == "Credential" or type.lower() == "x-opencti-credential":
10121014
input_variables["Credential"] = {
10131015
"value": (
@@ -1027,8 +1029,8 @@ def create(self, **kwargs):
10271029
or type.lower() == "x-opencti-financial-account"
10281030
):
10291031
input_variables["FinancialAccount"] = {
1030-
"iban_number": observable_data.get("iban_number"),
1031-
"bic_number": observable_data.get("bic_number"),
1032+
"iban": observable_data.get("iban"),
1033+
"bic": observable_data.get("bic"),
10321034
"account_number": observable_data.get("account_number"),
10331035
"account_status": observable_data.get("account_status"),
10341036
"account_type": observable_data.get("account_type"),

pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_properties.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@
249249
... on CryptographicKey {
250250
value
251251
}
252+
... on CryptocurrencyWallet {
253+
value
254+
}
252255
... on Hostname {
253256
value
254257
}
@@ -284,8 +287,8 @@
284287
account_number
285288
account_status
286289
account_type
287-
iban_number
288-
bic_number
290+
iban
291+
bic
289292
currency_code
290293
}
291294
... on FinancialAsset {
@@ -560,6 +563,9 @@
560563
... on CryptographicKey {
561564
value
562565
}
566+
... on CryptocurrencyWallet {
567+
value
568+
}
563569
... on Hostname {
564570
value
565571
}
@@ -608,8 +614,8 @@
608614
account_number
609615
account_status
610616
account_type
611-
iban_number
612-
bic_number
617+
iban
618+
bic
613619
currency_code
614620
}
615621
... on FinancialAsset {

pycti/utils/constants.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class StixCyberObservableTypes(Enum):
3737
WINDOWS_REGISTRY_VALUE_TYPE = "Windows-Registry-Value-Type"
3838
HOSTNAME = "Hostname"
3939
CRYPTOGRAPHIC_KEY = "Cryptographic-Key"
40-
# CRYPTOCURRENCY_WALLET = "Cryptocurrency-Wallet"
40+
CRYPTOCURRENCY_WALLET = "Cryptocurrency-Wallet"
4141
FINANCIAL_ACCOUNT = "Financial-Account"
4242
FINANCIAL_ASSET = "Financial-Asset"
4343
FINANCIAL_TRANSACTION = "Financial-Transaction"
@@ -354,22 +354,22 @@ class CustomObservableCredential:
354354
pass
355355

356356

357-
# @CustomObservable(
358-
# "cryptocurrency-wallet",
359-
# [
360-
# ("value", StringProperty(required=True)),
361-
# ("spec_version", StringProperty(fixed="2.1")),
362-
# (
363-
# "object_marking_refs",
364-
# ListProperty(
365-
# ReferenceProperty(valid_types="marking-definition", spec_version="2.1")
366-
# ),
367-
# ),
368-
# ],
369-
# ["value"],
370-
# )
371-
# class CustomObservableCryptocurrencyWallet:
372-
# """Cryptocurrency wallet observable."""
357+
@CustomObservable(
358+
"cryptocurrency-wallet",
359+
[
360+
("value", StringProperty(required=True)),
361+
("spec_version", StringProperty(fixed="2.1")),
362+
(
363+
"object_marking_refs",
364+
ListProperty(
365+
ReferenceProperty(valid_types="marking-definition", spec_version="2.1")
366+
),
367+
),
368+
],
369+
["value"],
370+
)
371+
class CustomObservableCryptocurrencyWallet:
372+
"""Cryptocurrency wallet observable."""
373373

374374

375375
@CustomObservable(
@@ -463,8 +463,8 @@ class CustomObservableMediaContent:
463463
("account_number", StringProperty()),
464464
("account_status", StringProperty()),
465465
("account_type", StringProperty()),
466-
("iban_number", StringProperty()),
467-
("bic_number", StringProperty()),
466+
("iban", StringProperty()),
467+
("bic", StringProperty()),
468468
("currency_code", StringProperty()),
469469
("spec_version", StringProperty(fixed="2.1")),
470470
(

pycti/utils/opencti_stix2_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"windows-registry-value-type": "Windows-Registry-Value-Type",
2626
"hostname": "Hostname",
2727
"cryptographic-key": "Cryptographic-Key",
28-
# "cryptocurrency-wallet": "Cryptocurrency-Wallet",
28+
"cryptocurrency-wallet": "Cryptocurrency-Wallet",
2929
"text": "Text",
3030
"user-agent": "User-Agent",
3131
# "bank-account": "Bank-Account",

0 commit comments

Comments
 (0)