mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
chg: [dashboard] nb objects per days + websocket update
This commit is contained in:
parent
73543ae5ad
commit
edfd48b8e6
17 changed files with 303 additions and 318 deletions
|
@ -158,7 +158,23 @@ class ChatSubChannel(AbstractChatObject):
|
||||||
|
|
||||||
class ChatSubChannels(AbstractChatObjects):
|
class ChatSubChannels(AbstractChatObjects):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__('chat-subchannel')
|
super().__init__('chat-subchannel', ChatSubChannel)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'Chat-SubChannels'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'far', 'icon': 'comments'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('chats_explorer.chats_explorer_protocols')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/chats/explorer/protocols'
|
||||||
|
return url
|
||||||
|
|
||||||
|
def sanitize_id_to_search(self, subtypes, name_to_search):
|
||||||
|
return name_to_search
|
||||||
|
|
||||||
# if __name__ == '__main__':
|
# if __name__ == '__main__':
|
||||||
# chat = Chat('test', 'telegram')
|
# chat = Chat('test', 'telegram')
|
||||||
|
|
|
@ -112,7 +112,23 @@ def create(thread_id, chat_instance, chat_id, subchannel_id, message_id, contain
|
||||||
|
|
||||||
class ChatThreads(AbstractChatObjects):
|
class ChatThreads(AbstractChatObjects):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__('chat-thread')
|
super().__init__('chat-thread', ChatThread)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'Chat-Threads'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'fas', 'icon': 'grip-lines'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('chats_explorer.chats_explorer_protocols')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/chats/explorer/protocols'
|
||||||
|
return url
|
||||||
|
|
||||||
|
def sanitize_id_to_search(self, subtypes, name_to_search):
|
||||||
|
return name_to_search
|
||||||
|
|
||||||
# if __name__ == '__main__':
|
# if __name__ == '__main__':
|
||||||
# chat = Chat('test', 'telegram')
|
# chat = Chat('test', 'telegram')
|
||||||
|
|
|
@ -60,6 +60,14 @@ class Chat(AbstractChatObject):
|
||||||
username = username.split(':', 2)[2]
|
username = username.split(':', 2)[2]
|
||||||
return f'https://t.me/{username}'
|
return f'https://t.me/{username}'
|
||||||
|
|
||||||
|
def get_chat_instance(self):
|
||||||
|
if self.subtype == '00098785-7e70-5d12-a120-c5cdc1252b2b':
|
||||||
|
return 'telegram'
|
||||||
|
elif self.subtype == 'd2426e3f-22f3-5a57-9a98-d2ae9794e683':
|
||||||
|
return 'discord'
|
||||||
|
else:
|
||||||
|
return self.subtype
|
||||||
|
|
||||||
def get_svg_icon(self): # TODO
|
def get_svg_icon(self): # TODO
|
||||||
# if self.subtype == 'telegram':
|
# if self.subtype == 'telegram':
|
||||||
# style = 'fab'
|
# style = 'fab'
|
||||||
|
@ -164,6 +172,21 @@ class Chat(AbstractChatObject):
|
||||||
def update_username_timeline(self, username_global_id, timestamp):
|
def update_username_timeline(self, username_global_id, timestamp):
|
||||||
self._get_timeline_username().add_timestamp(timestamp, username_global_id)
|
self._get_timeline_username().add_timestamp(timestamp, username_global_id)
|
||||||
|
|
||||||
|
def get_label(self):
|
||||||
|
username = self.get_username()
|
||||||
|
if username:
|
||||||
|
username = username.split(':', 2)[2]
|
||||||
|
name = self.get_name()
|
||||||
|
if username and name:
|
||||||
|
label = f'{username} - {name}'
|
||||||
|
elif username:
|
||||||
|
label = username
|
||||||
|
elif name:
|
||||||
|
label = name
|
||||||
|
else:
|
||||||
|
label = ''
|
||||||
|
return label
|
||||||
|
|
||||||
#### ChatSubChannels ####
|
#### ChatSubChannels ####
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,7 +226,23 @@ class Chat(AbstractChatObject):
|
||||||
|
|
||||||
class Chats(AbstractChatObjects):
|
class Chats(AbstractChatObjects):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__('chat')
|
super().__init__('chat', Chat)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'Chats'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'fas', 'icon': 'comment'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('chats_explorer.chats_explorer_protocols')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/chats/explorer/protocols'
|
||||||
|
return url
|
||||||
|
|
||||||
|
def sanitize_id_to_search(self, subtypes, name_to_search):
|
||||||
|
return name_to_search
|
||||||
|
|
||||||
def get_ids_with_messages_by_subtype(self, subtype):
|
def get_ids_with_messages_by_subtype(self, subtype):
|
||||||
return r_object.smembers(f'{self.type}_w_mess:{subtype}')
|
return r_object.smembers(f'{self.type}_w_mess:{subtype}')
|
||||||
|
|
|
@ -15,7 +15,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
from lib.ConfigLoader import ConfigLoader
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from lib.objects.abstract_subtype_object import AbstractSubtypeObject, get_all_id
|
from lib.objects.abstract_subtype_object import AbstractSubtypeObject, AbstractSubtypeObjects, get_all_id
|
||||||
|
|
||||||
config_loader = ConfigLoader()
|
config_loader = ConfigLoader()
|
||||||
baseurl = config_loader.get_config_str("Notifications", "ail_domain")
|
baseurl = config_loader.get_config_str("Notifications", "ail_domain")
|
||||||
|
@ -166,6 +166,31 @@ class CryptoCurrency(AbstractSubtypeObject):
|
||||||
meta['tags'] = self.get_tags(r_list=True)
|
meta['tags'] = self.get_tags(r_list=True)
|
||||||
return meta
|
return meta
|
||||||
|
|
||||||
|
|
||||||
|
class CryptoCurrencies(AbstractSubtypeObjects):
|
||||||
|
"""
|
||||||
|
Usernames Objects
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__('cryptocurrency', CryptoCurrency)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'Cryptocurrencies'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'fas', 'icon': 'coins'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('objects_subtypes.objects_dashboard_cryptocurrency')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/objects/cryptocurrencies'
|
||||||
|
return url
|
||||||
|
|
||||||
|
def sanitize_id_to_search(self, subtypes, name_to_search):
|
||||||
|
return name_to_search
|
||||||
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
from lib.ConfigLoader import ConfigLoader
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from lib.objects.abstract_daterange_object import AbstractDaterangeObject
|
from lib.objects.abstract_daterange_object import AbstractDaterangeObject, AbstractDaterangeObjects
|
||||||
from packages import Date
|
from packages import Date
|
||||||
|
|
||||||
sys.path.append('../../configs/keys')
|
sys.path.append('../../configs/keys')
|
||||||
|
@ -321,6 +321,32 @@ class Decoded(AbstractDaterangeObject):
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
class Decodeds(AbstractDaterangeObjects):
|
||||||
|
"""
|
||||||
|
Barcodes Objects
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__('decoded', Decoded)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'Decodeds'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fa': 'fas', 'icon': 'lock-open'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('objects_decoded.decodeds_dashboard')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/objects/decodeds'
|
||||||
|
return url
|
||||||
|
|
||||||
|
def sanitize_id_to_search(self, name_to_search):
|
||||||
|
return name_to_search
|
||||||
|
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
|
||||||
def is_vt_enabled():
|
def is_vt_enabled():
|
||||||
return VT_ENABLED
|
return VT_ENABLED
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class DomHash(AbstractDaterangeObject):
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def get_svg_icon(self):
|
def get_svg_icon(self):
|
||||||
return {'style': 'fas', 'icon': '\uf714', 'color': 'grey', 'radius': 5}
|
return {'style': 'fas', 'icon': '\ue58a', 'color': 'grey', 'radius': 5}
|
||||||
|
|
||||||
def get_misp_object(self):
|
def get_misp_object(self):
|
||||||
obj_attrs = []
|
obj_attrs = []
|
||||||
|
@ -118,7 +118,7 @@ class DomHashs(AbstractDaterangeObjects):
|
||||||
return 'DomHashs'
|
return 'DomHashs'
|
||||||
|
|
||||||
def get_icon(self):
|
def get_icon(self):
|
||||||
return {'fa': 'fas', 'icon': 'align-left'}
|
return {'fa': 'fa-solid', 'icon': 'trowel-bricks'}
|
||||||
|
|
||||||
def get_link(self, flask_context=False):
|
def get_link(self, flask_context=False):
|
||||||
if flask_context:
|
if flask_context:
|
||||||
|
|
|
@ -727,6 +727,32 @@ def cluster_onion_domain_vanity(len_vanity=4):
|
||||||
res = dict(sorted(occurrences.items(), key=lambda item: item[1], reverse=True))
|
res = dict(sorted(occurrences.items(), key=lambda item: item[1], reverse=True))
|
||||||
print(json.dumps(res))
|
print(json.dumps(res))
|
||||||
|
|
||||||
|
class Domains:
|
||||||
|
def __init__(self):
|
||||||
|
self.type = 'message'
|
||||||
|
self.obj_class = Domain
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'Domains'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'fas', 'icon': 'spider'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('crawler_splash.crawlers_dashboard')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/crawlers/dashboard'
|
||||||
|
return url
|
||||||
|
|
||||||
|
# def get_by_date(self, date):
|
||||||
|
# pass
|
||||||
|
|
||||||
|
def get_nb_by_date(self, date):
|
||||||
|
nb = 0
|
||||||
|
for domain_type in get_all_domains_types():
|
||||||
|
nb += r_crawler.scard(f'{domain_type}_up:{date}')
|
||||||
|
return nb
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
_rebuild_vanity_clusters()
|
_rebuild_vanity_clusters()
|
||||||
|
|
|
@ -13,7 +13,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
from lib.ConfigLoader import ConfigLoader
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from lib.objects.abstract_subtype_object import AbstractSubtypeObject, get_all_id, get_all_id_iterator
|
from lib.objects.abstract_subtype_object import AbstractSubtypeObject, AbstractSubtypeObjects, get_all_id, get_all_id_iterator
|
||||||
|
|
||||||
config_loader = ConfigLoader()
|
config_loader = ConfigLoader()
|
||||||
baseurl = config_loader.get_config_str("Notifications", "ail_domain")
|
baseurl = config_loader.get_config_str("Notifications", "ail_domain")
|
||||||
|
@ -93,6 +93,30 @@ class Pgp(AbstractSubtypeObject):
|
||||||
obj_attr.add_tag(tag)
|
obj_attr.add_tag(tag)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
class Pgps(AbstractSubtypeObjects):
|
||||||
|
"""
|
||||||
|
Usernames Objects
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__('pgp', Pgp)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'PGP Dumps'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'fas', 'icon': 'key'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('objects_subtypes.objects_dashboard_pgp')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/objects/pgps'
|
||||||
|
return url
|
||||||
|
|
||||||
|
def sanitize_id_to_search(self, subtypes, name_to_search):
|
||||||
|
return name_to_search
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,19 @@ class Usernames(AbstractSubtypeObjects):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__('username', Username)
|
super().__init__('username', Username)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'Usernames'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'far', 'icon': 'user'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('objects_subtypes.objects_dashboard_username')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/objects/usernames'
|
||||||
|
return url
|
||||||
|
|
||||||
def sanitize_id_to_search(self, subtypes, name_to_search):
|
def sanitize_id_to_search(self, subtypes, name_to_search):
|
||||||
return name_to_search
|
return name_to_search
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
##################################
|
##################################
|
||||||
from lib import ail_core
|
from lib import ail_core
|
||||||
from lib.ConfigLoader import ConfigLoader
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from lib.objects.abstract_subtype_object import AbstractSubtypeObject, get_all_id
|
from lib.objects.abstract_subtype_object import AbstractSubtypeObject, AbstractSubtypeObjects, get_all_id
|
||||||
from lib.timeline_engine import Timeline
|
from lib.timeline_engine import Timeline
|
||||||
from lib.objects import Usernames
|
from lib.objects import Usernames
|
||||||
|
|
||||||
|
@ -220,8 +220,6 @@ class UserAccount(AbstractSubtypeObject):
|
||||||
obj_attr.add_tag(tag)
|
obj_attr.add_tag(tag)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
def get_user_by_username():
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_all_subtypes():
|
def get_all_subtypes():
|
||||||
return ail_core.get_object_all_subtypes('user-account')
|
return ail_core.get_object_all_subtypes('user-account')
|
||||||
|
@ -236,6 +234,30 @@ def get_all_by_subtype(subtype):
|
||||||
return get_all_id('user-account', subtype)
|
return get_all_id('user-account', subtype)
|
||||||
|
|
||||||
|
|
||||||
|
class UserAccounts(AbstractSubtypeObjects):
|
||||||
|
"""
|
||||||
|
Usernames Objects
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__('user-account', UserAccount)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return 'User-Accounts'
|
||||||
|
|
||||||
|
def get_icon(self):
|
||||||
|
return {'fas': 'fas', 'icon': 'user-circle'}
|
||||||
|
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
if flask_context:
|
||||||
|
url = url_for('objects_subtypes.objects_dashboard_user_account')
|
||||||
|
else:
|
||||||
|
url = f'{baseurl}/objects/user-accounts'
|
||||||
|
return url
|
||||||
|
|
||||||
|
def sanitize_id_to_search(self, subtypes, name_to_search):
|
||||||
|
return name_to_search
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from lib.objects import Chats
|
from lib.objects import Chats
|
||||||
chat = Chats.Chat('', '00098785-7e70-5d12-a120-c5cdc1252b2b')
|
chat = Chats.Chat('', '00098785-7e70-5d12-a120-c5cdc1252b2b')
|
||||||
|
|
|
@ -18,7 +18,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
##################################
|
##################################
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
from lib.objects.abstract_subtype_object import AbstractSubtypeObject
|
from lib.objects.abstract_subtype_object import AbstractSubtypeObject, AbstractSubtypeObjects
|
||||||
from lib.ail_core import unpack_correl_objs_id, zscan_iter ################
|
from lib.ail_core import unpack_correl_objs_id, zscan_iter ################
|
||||||
from lib.ConfigLoader import ConfigLoader
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from lib.objects import Messages
|
from lib.objects import Messages
|
||||||
|
@ -314,9 +314,10 @@ class AbstractChatObject(AbstractSubtypeObject, ABC):
|
||||||
return self.get_correlation_iter('user-account', self.subtype, user_id, 'message')
|
return self.get_correlation_iter('user-account', self.subtype, user_id, 'message')
|
||||||
|
|
||||||
# TODO move me to abstract subtype
|
# TODO move me to abstract subtype
|
||||||
class AbstractChatObjects(ABC):
|
class AbstractChatObjects(AbstractSubtypeObjects, ABC):
|
||||||
def __init__(self, type):
|
|
||||||
self.type = type
|
def __init__(self, obj_type, obj_class):
|
||||||
|
super().__init__(obj_type, obj_class)
|
||||||
|
|
||||||
def add_subtype(self, subtype):
|
def add_subtype(self, subtype):
|
||||||
r_object.sadd(f'all_{self.type}:subtypes', subtype)
|
r_object.sadd(f'all_{self.type}:subtypes', subtype)
|
||||||
|
|
|
@ -18,7 +18,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
from lib.objects.abstract_object import AbstractObject
|
from lib.objects.abstract_object import AbstractObject
|
||||||
from lib.ail_core import get_object_all_subtypes, zscan_iter
|
from lib.ail_core import get_object_all_subtypes, zscan_iter, get_object_all_subtypes
|
||||||
from lib.ConfigLoader import ConfigLoader
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from lib.item_basic import is_crawled, get_item_domain
|
from lib.item_basic import is_crawled, get_item_domain
|
||||||
from lib.data_retention_engine import update_obj_date
|
from lib.data_retention_engine import update_obj_date
|
||||||
|
@ -198,10 +198,46 @@ class AbstractSubtypeObjects(ABC):
|
||||||
"""
|
"""
|
||||||
Abstract Subtype Objects
|
Abstract Subtype Objects
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, obj_type, obj_class):
|
def __init__(self, obj_type, obj_class):
|
||||||
|
""" Abstract for Daterange Objects
|
||||||
|
|
||||||
|
:param obj_type: object type (item, ...)
|
||||||
|
:param obj_class: object python class (Item, ...)
|
||||||
|
"""
|
||||||
self.type = obj_type
|
self.type = obj_type
|
||||||
self.obj_class = obj_class
|
self.obj_class = obj_class
|
||||||
|
|
||||||
|
def get_subtypes(self):
|
||||||
|
return get_object_all_subtypes(self.type)
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def get_name(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def get_icon(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def get_link(self, flask_context=False):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_by_date_subtype(self, subtype, date):
|
||||||
|
return r_object.hkeys(f'{self.type}:{subtype}:{date}')
|
||||||
|
|
||||||
|
def get_by_date(self, date):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_nb_by_date_subtype(self, subtype, date):
|
||||||
|
return r_object.hlen(f'{self.type}:{subtype}:{date}')
|
||||||
|
|
||||||
|
def get_nb_by_date(self, date):
|
||||||
|
nb = 0
|
||||||
|
for subtype in self.get_subtypes():
|
||||||
|
nb += self.get_nb_by_date_subtype(subtype, date)
|
||||||
|
return nb
|
||||||
|
|
||||||
def get_ids(self): # TODO FORMAT
|
def get_ids(self): # TODO FORMAT
|
||||||
ids = []
|
ids = []
|
||||||
for subtype in get_object_all_subtypes(self.type):
|
for subtype in get_object_all_subtypes(self.type):
|
||||||
|
@ -249,6 +285,8 @@ class AbstractSubtypeObjects(ABC):
|
||||||
########################################################################
|
########################################################################
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
# TODO REFACTOR
|
||||||
|
|
||||||
def get_all_id(obj_type, subtype):
|
def get_all_id(obj_type, subtype):
|
||||||
return r_object.zrange(f'{obj_type}_all:{subtype}', 0, -1)
|
return r_object.zrange(f'{obj_type}_all:{subtype}', 0, -1)
|
||||||
|
|
||||||
|
@ -303,5 +341,3 @@ def get_subtypes_objs_range_json(obj_type, date_from, date_to):
|
||||||
objs_range.append(day_dict)
|
objs_range.append(day_dict)
|
||||||
|
|
||||||
return objs_range
|
return objs_range
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ from lib.objects import ChatThreads
|
||||||
from lib.objects import CryptoCurrencies
|
from lib.objects import CryptoCurrencies
|
||||||
from lib.objects import CookiesNames
|
from lib.objects import CookiesNames
|
||||||
from lib.objects import Cves
|
from lib.objects import Cves
|
||||||
from lib.objects.Decodeds import Decoded, get_all_decodeds_objects, get_nb_decodeds_objects
|
from lib.objects import Decodeds
|
||||||
from lib.objects.Domains import Domain
|
from lib.objects import Domains
|
||||||
from lib.objects import Etags
|
from lib.objects import Etags
|
||||||
from lib.objects import Favicons
|
from lib.objects import Favicons
|
||||||
from lib.objects import FilesNames
|
from lib.objects import FilesNames
|
||||||
|
@ -50,29 +50,29 @@ from lib.objects import Usernames
|
||||||
# TODO INIT objs classes ????
|
# TODO INIT objs classes ????
|
||||||
OBJECTS_CLASS = {
|
OBJECTS_CLASS = {
|
||||||
'barcode': {'obj': BarCodes.Barcode, 'objs': BarCodes.Barcodes},
|
'barcode': {'obj': BarCodes.Barcode, 'objs': BarCodes.Barcodes},
|
||||||
'chat': {'obj': Chats.Chat, 'objs': None}, ## SUBTYPE #########################################
|
'chat': {'obj': Chats.Chat, 'objs': Chats.Chats},
|
||||||
'chat-subchannel': {'obj': ChatSubChannels.ChatSubChannel, 'objs': None}, ###### ######
|
'chat-subchannel': {'obj': ChatSubChannels.ChatSubChannel, 'objs': None}, ###### ######
|
||||||
'chat-thread': {'obj': ChatThreads.ChatThread, 'objs': None}, ###### ######
|
'chat-thread': {'obj': ChatThreads.ChatThread, 'objs': None}, ###### ######
|
||||||
'cookie-name': {'obj': CookiesNames.CookieName, 'objs': CookiesNames.CookiesNames},
|
'cookie-name': {'obj': CookiesNames.CookieName, 'objs': CookiesNames.CookiesNames},
|
||||||
'cve': {'obj': Cves.Cve, 'objs': Cves.Cves},
|
'cve': {'obj': Cves.Cve, 'objs': Cves.Cves},
|
||||||
'cryptocurrency': {'obj': CryptoCurrencies.CryptoCurrency, 'objs': None}, ## SUBTYPE #########################################
|
'cryptocurrency': {'obj': CryptoCurrencies.CryptoCurrency, 'objs': CryptoCurrencies.CryptoCurrencies},
|
||||||
'decoded': {'obj': Decoded, 'objs': None}, ###############################################################################################
|
'decoded': {'obj': Decodeds.Decoded, 'objs': Decodeds.Decodeds},
|
||||||
'domain': {'obj': Domain, 'objs': None}, ####################################################################################################
|
'domain': {'obj': Domains.Domain, 'objs': Domains.Domains},
|
||||||
'dom-hash': {'obj': DomHashs.DomHash, 'objs': DomHashs.DomHashs},
|
'dom-hash': {'obj': DomHashs.DomHash, 'objs': DomHashs.DomHashs},
|
||||||
'etag': {'obj': Etags.Etag, 'objs': Etags.Etags},
|
'etag': {'obj': Etags.Etag, 'objs': Etags.Etags},
|
||||||
'favicon': {'obj': Favicons.Favicon, 'objs': Favicons.Favicons},
|
'favicon': {'obj': Favicons.Favicon, 'objs': Favicons.Favicons},
|
||||||
'file-name': {'obj': FilesNames.FileName, 'objs': FilesNames.FilesNames},
|
'file-name': {'obj': FilesNames.FileName, 'objs': FilesNames.FilesNames},
|
||||||
'hhhash': {'obj': HHHashs.HHHash, 'objs': HHHashs.HHHashs},
|
'hhhash': {'obj': HHHashs.HHHash, 'objs': HHHashs.HHHashs},
|
||||||
'item': {'obj': Item, 'objs': None}, ######
|
'item': {'obj': Item, 'objs': None}, ####################################################################################################
|
||||||
'image': {'obj': Images.Image, 'objs': Images.Images},
|
'image': {'obj': Images.Image, 'objs': Images.Images},
|
||||||
'message': {'obj': Messages.Message, 'objs': None}, ######
|
'message': {'obj': Messages.Message, 'objs': None}, #############################################################
|
||||||
'ocr': {'obj': Ocrs.Ocr, 'objs': Ocrs.Ocrs},
|
'ocr': {'obj': Ocrs.Ocr, 'objs': Ocrs.Ocrs},
|
||||||
'pgp': {'obj': Pgps.Pgp, 'objs': None}, ## SUBTYPE ###########################################################################
|
'pgp': {'obj': Pgps.Pgp, 'objs': Pgps.Pgps},
|
||||||
'qrcode': {'obj': QrCodes.Qrcode, 'objs': QrCodes.Qrcodes},
|
'qrcode': {'obj': QrCodes.Qrcode, 'objs': QrCodes.Qrcodes},
|
||||||
'screenshot': {'obj': Screenshots.Screenshot, 'objs': None}, ######
|
'screenshot': {'obj': Screenshots.Screenshot, 'objs': None}, ####################################################################################################
|
||||||
'title': {'obj': Titles.Title, 'objs': Titles.Titles},
|
'title': {'obj': Titles.Title, 'objs': Titles.Titles},
|
||||||
'user-account': {'obj': UsersAccount.UserAccount, 'objs': None}, ## SUBTYPE ###########################################################################
|
'user-account': {'obj': UsersAccount.UserAccount, 'objs': UsersAccount.UserAccounts},
|
||||||
'username': {'obj': Usernames.Username, 'objs': None}, ## SUBTYPE ###########################################################################
|
'username': {'obj': Usernames.Username, 'objs': Usernames.Usernames},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ def get_object(obj_type, subtype, obj_id):
|
||||||
return obj_class(obj_id)
|
return obj_class(obj_id)
|
||||||
# SUBTYPES
|
# SUBTYPES
|
||||||
else:
|
else:
|
||||||
obj_class(obj_id, subtype)
|
return obj_class(obj_id, subtype)
|
||||||
|
|
||||||
def exists_obj(obj_type, subtype, obj_id):
|
def exists_obj(obj_type, subtype, obj_id):
|
||||||
obj = get_object(obj_type, subtype, obj_id)
|
obj = get_object(obj_type, subtype, obj_id)
|
||||||
|
@ -354,7 +354,7 @@ def is_filtered(obj, filters):
|
||||||
|
|
||||||
def obj_iterator(obj_type, filters):
|
def obj_iterator(obj_type, filters):
|
||||||
if obj_type == 'decoded':
|
if obj_type == 'decoded':
|
||||||
return get_all_decodeds_objects(filters=filters)
|
return Decodeds.get_all_decodeds_objects(filters=filters)
|
||||||
elif obj_type == 'image':
|
elif obj_type == 'image':
|
||||||
return Images.get_all_images_objects(filters=filters)
|
return Images.get_all_images_objects(filters=filters)
|
||||||
elif obj_type == 'screenshot':
|
elif obj_type == 'screenshot':
|
||||||
|
@ -377,7 +377,7 @@ def card_objs_iterators(filters):
|
||||||
|
|
||||||
def card_obj_iterator(obj_type, filters):
|
def card_obj_iterator(obj_type, filters):
|
||||||
if obj_type == 'decoded':
|
if obj_type == 'decoded':
|
||||||
return get_nb_decodeds_objects(filters=filters)
|
return Decodeds.get_nb_decodeds_objects(filters=filters)
|
||||||
elif obj_type == 'item':
|
elif obj_type == 'item':
|
||||||
return get_nb_items_objects(filters=filters)
|
return get_nb_items_objects(filters=filters)
|
||||||
elif obj_type == 'pgp':
|
elif obj_type == 'pgp':
|
||||||
|
|
|
@ -312,9 +312,8 @@ def ws_dashboard(ws):
|
||||||
# break
|
# break
|
||||||
if int(time.time()) >= next_feeders:
|
if int(time.time()) >= next_feeders:
|
||||||
feeders = ail_stats.get_feeders_dashboard()
|
feeders = ail_stats.get_feeders_dashboard()
|
||||||
# feeders['data']['telegram'] = 600
|
objs = ail_stats.get_nb_objs_today()
|
||||||
# feeders['data']['test'] = 1300
|
ws.send(json.dumps({'feeders': feeders, 'objs': objs}))
|
||||||
ws.send(json.dumps({'feeders': feeders}))
|
|
||||||
next_feeders = next_feeders + 30
|
next_feeders = next_feeders + 30
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except Exception as e: # ConnectionClosed ?
|
except Exception as e: # ConnectionClosed ?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<a class="icon-button btn-outline-dark px-2" href="{{ url }}">
|
<a class="icon-button btn-outline-dark px-2" href="{{ url }}">
|
||||||
<div class="icon-wrapper text-center">
|
<div class="icon-wrapper text-center">
|
||||||
<i class="fas fa-{{ icon }} fa-4x"></i>
|
<i class="fas fa-{{ icon }} fa-4x"></i>
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
<span class="badge badge-pill badge-danger notification-badge" id="obj_btn_{{ type }}">
|
||||||
{{ nb }}
|
{{ nb }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -71,207 +71,14 @@
|
||||||
|
|
||||||
{% for obj_type in nb_objects %}
|
{% for obj_type in nb_objects %}
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
||||||
{% with name=nb_objects[obj_type]['name'], icon=nb_objects[obj_type]['icon']['icon'], nb=nb_objects[obj_type]['nb'], url=nb_objects[obj_type]['link'] %}
|
{% with type=obj_type, name=nb_objects[obj_type]['name'], icon=nb_objects[obj_type]['icon']['icon'], nb=nb_objects[obj_type]['nb'], url=nb_objects[obj_type]['link'] %}
|
||||||
{% include 'objects/block_obj_button.html' %}
|
{% include 'objects/block_obj_button.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<a class="icon-button btn-outline-dark px-2" href="{{url_for('chats_explorer.chats_explorer_protocols')}}">
|
|
||||||
<div class="icon-wrapper text-center">
|
|
||||||
<i class="fas fa-comment fa-4x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
384556
|
|
||||||
<span class="sr-only">Chats by days</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>Chats</b></div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12" id="core_content">
|
|
||||||
|
|
||||||
<div class="container mt-5">
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<a class="icon-button btn-outline-dark px-2" href="{{url_for('chats_explorer.chats_explorer_protocols')}}">
|
|
||||||
<div class="icon-wrapper text-center">
|
|
||||||
<i class="fas fa-comment fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
384556
|
|
||||||
<span class="sr-only">Chats by days</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>Chats</b></div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<a class="btn" style="position:relative;display: inline-block;">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4">
|
|
||||||
<div class="icon-wrapper">
|
|
||||||
<i class="fas fa-bug fa-6x"></i>
|
|
||||||
<span class="badge badge-pill badge-danger notification-badge">
|
|
||||||
5896
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="h4"><b>CVEs</b></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -280,90 +87,18 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<span class="fa-6x">
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-comment"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-bug"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-cookie-bite"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-tag"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-align-left"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-skull-crossbones"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-star-half"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-image"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-expand"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-barcode"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-qrcode"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-heading"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-lock-open"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-key"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-coins"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-user"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
<span class="fa-layers fa-fw">
|
|
||||||
<i class="fa-solid fa-user-circle"></i>
|
|
||||||
<span class="fa-layers-counter" style="background:Tomato">1,419</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var chart = {};
|
var chart = {};
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#page-Decoded").addClass("active");
|
$("#page-Decoded").addClass("active");
|
||||||
$("#nav_dashboard_{{obj_type}}").addClass("active");
|
$("#nav_dashboard_{{obj_type}}").addClass("active");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var btn_selector = {
|
||||||
|
{% for obj_type in nb_objects %}
|
||||||
|
'{{ obj_type }}': $("#obj_btn_{{ obj_type }}"),
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -439,16 +174,16 @@ optionFeeder && feederChart.setOption(optionFeeder);
|
||||||
|
|
||||||
{# TODO UPDATE NEW FEEDER NAME#}
|
{# TODO UPDATE NEW FEEDER NAME#}
|
||||||
function updateFeederChart(data) {
|
function updateFeederChart(data) {
|
||||||
let new_date = data['feeders']['date']
|
let new_date = data['date']
|
||||||
feeders_xaxis.push(new_date)
|
feeders_xaxis.push(new_date)
|
||||||
feeders_xaxis.shift()
|
feeders_xaxis.shift()
|
||||||
|
|
||||||
for (const f_name in data['feeders']['data']) {
|
for (const f_name in data['data']) {
|
||||||
if (f_name in feeders_data) {
|
if (f_name in feeders_data) {
|
||||||
feeders_data[f_name].push(data['feeders']['data'][f_name])
|
feeders_data[f_name].push(data['data'][f_name])
|
||||||
feeders_data[f_name].shift()
|
feeders_data[f_name].shift()
|
||||||
} else {
|
} else {
|
||||||
let fdata = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, data['feeders']['data'][f_name]]
|
let fdata = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, data['data'][f_name]]
|
||||||
feeders_names.push(f_name)
|
feeders_names.push(f_name)
|
||||||
feeders_data[f_name] = fdata
|
feeders_data[f_name] = fdata
|
||||||
// add new feeder
|
// add new feeder
|
||||||
|
@ -460,6 +195,12 @@ function updateFeederChart(data) {
|
||||||
feederChart.setOption(optionFeeder)
|
feederChart.setOption(optionFeeder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateNbObjects(data) {
|
||||||
|
for (const obj_type in data) {
|
||||||
|
btn_selector[obj_type].text(data[obj_type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WebSocket
|
// WebSocket
|
||||||
var socket = new WebSocket("{{ url_for('ws_dashboard') }}");
|
var socket = new WebSocket("{{ url_for('ws_dashboard') }}");
|
||||||
socket.wsocket = function(event) {
|
socket.wsocket = function(event) {
|
||||||
|
@ -467,7 +208,8 @@ socket.wsocket = function(event) {
|
||||||
};
|
};
|
||||||
socket.onmessage = function(event) {
|
socket.onmessage = function(event) {
|
||||||
let data = JSON.parse(event.data);
|
let data = JSON.parse(event.data);
|
||||||
updateFeederChart(data);
|
updateFeederChart(data['feeders']);
|
||||||
|
updateNbObjects(data['objs']);
|
||||||
};
|
};
|
||||||
socket.onerror = function(error) {
|
socket.onerror = function(error) {
|
||||||
console.error('WebSocket error:', error);
|
console.error('WebSocket error:', error);
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{url_for('objects_dom_hash.objects_dom_hashs')}}" id="nav_dom_hash">
|
<a class="nav-link" href="{{url_for('objects_dom_hash.objects_dom_hashs')}}" id="nav_dom_hash">
|
||||||
<i class="fas fa-skull-crossbones"></i>
|
<i class="fas fa-trowel-bricks"></i>
|
||||||
<span>Dom-Hash</span>
|
<span>Dom-Hash</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue