chg: [dashboard] nb objects per days + websocket update

dashboard
terrtia 2024-11-20 14:41:36 +01:00
parent 73543ae5ad
commit edfd48b8e6
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
17 changed files with 303 additions and 318 deletions

View File

@ -158,7 +158,23 @@ class ChatSubChannel(AbstractChatObject):
class ChatSubChannels(AbstractChatObjects):
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__':
# chat = Chat('test', 'telegram')

View File

@ -112,7 +112,23 @@ def create(thread_id, chat_instance, chat_id, subchannel_id, message_id, contain
class ChatThreads(AbstractChatObjects):
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__':
# chat = Chat('test', 'telegram')

View File

@ -60,6 +60,14 @@ class Chat(AbstractChatObject):
username = username.split(':', 2)[2]
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
# if self.subtype == 'telegram':
# style = 'fab'
@ -164,6 +172,21 @@ class Chat(AbstractChatObject):
def update_username_timeline(self, username_global_id, timestamp):
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 ####
@ -203,7 +226,23 @@ class Chat(AbstractChatObject):
class Chats(AbstractChatObjects):
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):
return r_object.smembers(f'{self.type}_w_mess:{subtype}')

View File

@ -15,7 +15,7 @@ sys.path.append(os.environ['AIL_BIN'])
# Import Project packages
##################################
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()
baseurl = config_loader.get_config_str("Notifications", "ail_domain")
@ -166,6 +166,31 @@ class CryptoCurrency(AbstractSubtypeObject):
meta['tags'] = self.get_tags(r_list=True)
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
############################################################################
############################################################################

View File

@ -18,7 +18,7 @@ sys.path.append(os.environ['AIL_BIN'])
# Import Project packages
##################################
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
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():
return VT_ENABLED

View File

@ -57,7 +57,7 @@ class DomHash(AbstractDaterangeObject):
return url
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):
obj_attrs = []
@ -118,7 +118,7 @@ class DomHashs(AbstractDaterangeObjects):
return 'DomHashs'
def get_icon(self):
return {'fa': 'fas', 'icon': 'align-left'}
return {'fa': 'fa-solid', 'icon': 'trowel-bricks'}
def get_link(self, flask_context=False):
if flask_context:

View File

@ -727,6 +727,32 @@ def cluster_onion_domain_vanity(len_vanity=4):
res = dict(sorted(occurrences.items(), key=lambda item: item[1], reverse=True))
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__':
_rebuild_vanity_clusters()

View File

@ -13,7 +13,7 @@ sys.path.append(os.environ['AIL_BIN'])
# Import Project packages
##################################
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()
baseurl = config_loader.get_config_str("Notifications", "ail_domain")
@ -93,6 +93,30 @@ class Pgp(AbstractSubtypeObject):
obj_attr.add_tag(tag)
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
############################################################################
############################################################################

View File

@ -143,6 +143,19 @@ class Usernames(AbstractSubtypeObjects):
def __init__(self):
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):
return name_to_search

View File

@ -15,7 +15,7 @@ sys.path.append(os.environ['AIL_BIN'])
##################################
from lib import ail_core
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.objects import Usernames
@ -220,8 +220,6 @@ class UserAccount(AbstractSubtypeObject):
obj_attr.add_tag(tag)
return obj
def get_user_by_username():
pass
def get_all_subtypes():
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)
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__':
from lib.objects import Chats
chat = Chats.Chat('', '00098785-7e70-5d12-a120-c5cdc1252b2b')

View File

@ -18,7 +18,7 @@ sys.path.append(os.environ['AIL_BIN'])
##################################
# 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.ConfigLoader import ConfigLoader
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')
# TODO move me to abstract subtype
class AbstractChatObjects(ABC):
def __init__(self, type):
self.type = type
class AbstractChatObjects(AbstractSubtypeObjects, ABC):
def __init__(self, obj_type, obj_class):
super().__init__(obj_type, obj_class)
def add_subtype(self, subtype):
r_object.sadd(f'all_{self.type}:subtypes', subtype)

View File

@ -18,7 +18,7 @@ sys.path.append(os.environ['AIL_BIN'])
# Import Project packages
##################################
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.item_basic import is_crawled, get_item_domain
from lib.data_retention_engine import update_obj_date
@ -198,10 +198,46 @@ class AbstractSubtypeObjects(ABC):
"""
Abstract Subtype Objects
"""
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.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
ids = []
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):
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)
return objs_range

View File

@ -26,8 +26,8 @@ from lib.objects import ChatThreads
from lib.objects import CryptoCurrencies
from lib.objects import CookiesNames
from lib.objects import Cves
from lib.objects.Decodeds import Decoded, get_all_decodeds_objects, get_nb_decodeds_objects
from lib.objects.Domains import Domain
from lib.objects import Decodeds
from lib.objects import Domains
from lib.objects import Etags
from lib.objects import Favicons
from lib.objects import FilesNames
@ -50,29 +50,29 @@ from lib.objects import Usernames
# TODO INIT objs classes ????
OBJECTS_CLASS = {
'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-thread': {'obj': ChatThreads.ChatThread, 'objs': None}, ###### ######
'cookie-name': {'obj': CookiesNames.CookieName, 'objs': CookiesNames.CookiesNames},
'cve': {'obj': Cves.Cve, 'objs': Cves.Cves},
'cryptocurrency': {'obj': CryptoCurrencies.CryptoCurrency, 'objs': None}, ## SUBTYPE #########################################
'decoded': {'obj': Decoded, 'objs': None}, ###############################################################################################
'domain': {'obj': Domain, 'objs': None}, ####################################################################################################
'cryptocurrency': {'obj': CryptoCurrencies.CryptoCurrency, 'objs': CryptoCurrencies.CryptoCurrencies},
'decoded': {'obj': Decodeds.Decoded, 'objs': Decodeds.Decodeds},
'domain': {'obj': Domains.Domain, 'objs': Domains.Domains},
'dom-hash': {'obj': DomHashs.DomHash, 'objs': DomHashs.DomHashs},
'etag': {'obj': Etags.Etag, 'objs': Etags.Etags},
'favicon': {'obj': Favicons.Favicon, 'objs': Favicons.Favicons},
'file-name': {'obj': FilesNames.FileName, 'objs': FilesNames.FilesNames},
'hhhash': {'obj': HHHashs.HHHash, 'objs': HHHashs.HHHashs},
'item': {'obj': Item, 'objs': None}, ######
'item': {'obj': Item, 'objs': None}, ####################################################################################################
'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},
'pgp': {'obj': Pgps.Pgp, 'objs': None}, ## SUBTYPE ###########################################################################
'pgp': {'obj': Pgps.Pgp, 'objs': Pgps.Pgps},
'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},
'user-account': {'obj': UsersAccount.UserAccount, 'objs': None}, ## SUBTYPE ###########################################################################
'username': {'obj': Usernames.Username, 'objs': None}, ## SUBTYPE ###########################################################################
'user-account': {'obj': UsersAccount.UserAccount, 'objs': UsersAccount.UserAccounts},
'username': {'obj': Usernames.Username, 'objs': Usernames.Usernames},
}
@ -119,7 +119,7 @@ def get_object(obj_type, subtype, obj_id):
return obj_class(obj_id)
# SUBTYPES
else:
obj_class(obj_id, subtype)
return obj_class(obj_id, subtype)
def exists_obj(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):
if obj_type == 'decoded':
return get_all_decodeds_objects(filters=filters)
return Decodeds.get_all_decodeds_objects(filters=filters)
elif obj_type == 'image':
return Images.get_all_images_objects(filters=filters)
elif obj_type == 'screenshot':
@ -377,7 +377,7 @@ def card_objs_iterators(filters):
def card_obj_iterator(obj_type, filters):
if obj_type == 'decoded':
return get_nb_decodeds_objects(filters=filters)
return Decodeds.get_nb_decodeds_objects(filters=filters)
elif obj_type == 'item':
return get_nb_items_objects(filters=filters)
elif obj_type == 'pgp':

View File

@ -312,9 +312,8 @@ def ws_dashboard(ws):
# break
if int(time.time()) >= next_feeders:
feeders = ail_stats.get_feeders_dashboard()
# feeders['data']['telegram'] = 600
# feeders['data']['test'] = 1300
ws.send(json.dumps({'feeders': feeders}))
objs = ail_stats.get_nb_objs_today()
ws.send(json.dumps({'feeders': feeders, 'objs': objs}))
next_feeders = next_feeders + 30
time.sleep(1)
except Exception as e: # ConnectionClosed ?

View File

@ -1,7 +1,7 @@
<a class="icon-button btn-outline-dark px-2" href="{{ url }}">
<div class="icon-wrapper text-center">
<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 }}
</span>
</div>

View File

@ -71,291 +71,20 @@
{% for obj_type in nb_objects %}
<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' %}
{% endwith %}
</div>
{% 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 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>
<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>
@ -364,6 +93,12 @@
$("#page-Decoded").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>
@ -439,16 +174,16 @@ optionFeeder && feederChart.setOption(optionFeeder);
{# TODO UPDATE NEW FEEDER NAME#}
function updateFeederChart(data) {
let new_date = data['feeders']['date']
let new_date = data['date']
feeders_xaxis.push(new_date)
feeders_xaxis.shift()
for (const f_name in data['feeders']['data']) {
for (const f_name in data['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()
} 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_data[f_name] = fdata
// add new feeder
@ -460,6 +195,12 @@ function updateFeederChart(data) {
feederChart.setOption(optionFeeder)
}
function updateNbObjects(data) {
for (const obj_type in data) {
btn_selector[obj_type].text(data[obj_type]);
}
}
// WebSocket
var socket = new WebSocket("{{ url_for('ws_dashboard') }}");
socket.wsocket = function(event) {
@ -467,7 +208,8 @@ socket.wsocket = function(event) {
};
socket.onmessage = function(event) {
let data = JSON.parse(event.data);
updateFeederChart(data);
updateFeederChart(data['feeders']);
updateNbObjects(data['objs']);
};
socket.onerror = function(error) {
console.error('WebSocket error:', error);

View File

@ -72,7 +72,7 @@
</li>
<li class="nav-item">
<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>
</a>
</li>