chg: [tron] add TRON crytocurrency detection + correlation. Thanks @pventuzelo for the contribution

pull/607/head v5.6
terrtia 2024-05-08 15:14:51 +02:00
parent 0c28b38638
commit 0dfd92bcd6
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
3 changed files with 14 additions and 8 deletions

View File

@ -68,7 +68,7 @@ def get_object_all_subtypes(obj_type): # TODO Dynamic subtype
if obj_type == 'chat-thread': if obj_type == 'chat-thread':
return r_object.smembers(f'all_chat-thread:subtypes') return r_object.smembers(f'all_chat-thread:subtypes')
if obj_type == 'cryptocurrency': if obj_type == 'cryptocurrency':
return ['bitcoin', 'bitcoin-cash', 'dash', 'ethereum', 'litecoin', 'monero', 'zcash'] return ['bitcoin', 'bitcoin-cash', 'dash', 'ethereum', 'litecoin', 'monero', 'tron', 'zcash']
if obj_type == 'pgp': if obj_type == 'pgp':
return ['key', 'mail', 'name'] return ['key', 'mail', 'name']
if obj_type == 'username': if obj_type == 'username':

View File

@ -60,7 +60,7 @@ class CryptoCurrency(AbstractSubtypeObject):
pass pass
def is_valid_address(self): def is_valid_address(self):
if self.type == 'bitcoin' or self.type == 'dash' or self.type == 'litecoin': if self.subtype == 'bitcoin' or self.subtype == 'dash' or self.subtype == 'litecoin' or self.subtype == 'tron':
return check_base58_address(self.id) return check_base58_address(self.id)
else: else:
return True return True
@ -80,6 +80,8 @@ class CryptoCurrency(AbstractSubtypeObject):
return 'ZEC' return 'ZEC'
elif self.subtype == 'dash': elif self.subtype == 'dash':
return 'DASH' return 'DASH'
elif self.subtype == 'tron':
return 'TRX'
return None return None
def get_link(self, flask_context=False): def get_link(self, flask_context=False):
@ -140,7 +142,7 @@ class CryptoCurrency(AbstractSubtypeObject):
def get_all_subtypes(): def get_all_subtypes():
# return ail_core.get_object_all_subtypes(self.type) # return ail_core.get_object_all_subtypes(self.type)
return ['bitcoin', 'bitcoin-cash', 'dash', 'ethereum', 'litecoin', 'monero', 'zcash'] return ['bitcoin', 'bitcoin-cash', 'dash', 'ethereum', 'litecoin', 'monero', 'tron', 'zcash']
# def build_crypto_regex(subtype, search_id): # def build_crypto_regex(subtype, search_id):
@ -172,6 +174,8 @@ def get_subtype_by_symbol(symbol):
return 'zcash' return 'zcash'
elif symbol == 'DASH': elif symbol == 'DASH':
return 'dash' return 'dash'
elif symbol == 'TRX':
return 'tron'
return None return None
@ -189,10 +193,6 @@ def get_all_cryptocurrencies_by_subtype(subtype):
def sanitize_cryptocurrency_name_to_search(name_to_search, subtype): # TODO FILTER NAME + Key + mail def sanitize_cryptocurrency_name_to_search(name_to_search, subtype): # TODO FILTER NAME + Key + mail
if subtype == '': if subtype == '':
pass pass
elif subtype == 'name':
pass
elif subtype == 'mail':
pass
return name_to_search return name_to_search
def search_cryptocurrency_by_name(name_to_search, subtype, r_pos=False): def search_cryptocurrency_by_name(name_to_search, subtype, r_pos=False):

View File

@ -92,7 +92,13 @@ CURRENCIES = {
'regex': r'\b(?<![+/=])X[A-Za-z0-9]{33}(?![+/=])\b', 'regex': r'\b(?<![+/=])X[A-Za-z0-9]{33}(?![+/=])\b',
'max_execution_time': default_max_execution_time, 'max_execution_time': default_max_execution_time,
'tag': 'infoleak:automatic-detection="dash-address"', 'tag': 'infoleak:automatic-detection="dash-address"',
} },
'tron': {
'name': 'tron', # e.g. TYdds9VLDjUshf9tbsXSfGUZNzJSbbBeat
'regex': r'\b(?<![+/=])T[0-9a-zA-Z]{33}(?![+/=])\b',
'max_execution_time': default_max_execution_time,
'tag': 'infoleak:automatic-detection="tron-address"',
},
} }
################################## ##################################
################################## ##################################