From e92bf72f64d4037285e629db9454ec341196a049 Mon Sep 17 00:00:00 2001 From: terrtia Date: Mon, 18 Mar 2024 12:00:41 +0100 Subject: [PATCH] chg: [image object] add default + basic card --- bin/lib/objects/UsersAccount.py | 11 +- var/www/blueprints/correlation.py | 5 +- .../chats_explorer/basic_card_image.html | 57 ++++++++++ .../templates/chats_explorer/card_image.html | 104 ++++++++++++++++++ .../correlation/show_correlation.html | 2 + .../templates/domains/card_img_domain.html | 2 +- .../objects/block_object_footer_small.html | 12 ++ 7 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 var/www/templates/chats_explorer/basic_card_image.html create mode 100644 var/www/templates/chats_explorer/card_image.html create mode 100644 var/www/templates/objects/block_object_footer_small.html diff --git a/bin/lib/objects/UsersAccount.py b/bin/lib/objects/UsersAccount.py index 5777bd17..73ae7525 100755 --- a/bin/lib/objects/UsersAccount.py +++ b/bin/lib/objects/UsersAccount.py @@ -49,9 +49,9 @@ class UserAccount(AbstractSubtypeObject): def get_link(self, flask_context=False): if flask_context: - url = url_for('correlation.show_correlation', type=self.type, subtype=self.subtype, id=self.id) + url = url_for('chats_explorer.objects_user_account', type=self.type, subtype=self.subtype, id=self.id) else: - url = f'{baseurl}/correlation/show?type={self.type}&subtype={self.subtype}&id={self.id}' + url = f'{baseurl}/objects/user-account?&subtype={self.subtype}&id={self.id}' return url def get_svg_icon(self): # TODO change icon/color @@ -127,6 +127,13 @@ class UserAccount(AbstractSubtypeObject): def update_username_timeline(self, username_global_id, timestamp): self._get_timeline_username().add_timestamp(timestamp, username_global_id) + def get_messages(self): + messages = [] + for mess in self.get_correlation('message'): + messages.append(f'message:{mess}') + return messages + + def get_messages_by_chat_obj(self, chat_obj): messages = [] for mess in self.get_correlation_iter_obj(chat_obj, 'message'): diff --git a/var/www/blueprints/correlation.py b/var/www/blueprints/correlation.py index a5edf49e..1222755d 100644 --- a/var/www/blueprints/correlation.py +++ b/var/www/blueprints/correlation.py @@ -190,8 +190,11 @@ def show_correlation(): else: dict_object["subtype"] = '' dict_object["metadata_card"] = ail_objects.get_object_card_meta(obj_type, subtype, obj_id, related_btc=related_btc) + dict_object["metadata_card"]['tags_safe'] = True return render_template("show_correlation.html", dict_object=dict_object, bootstrap_label=bootstrap_label, - tags_selector_data=Tag.get_tags_selector_data()) + tags_selector_data=Tag.get_tags_selector_data(), + meta=dict_object["metadata_card"], + ail_tags=dict_object["metadata_card"]["add_tags_modal"]) @correlation.route('/correlation/get/description') @login_required diff --git a/var/www/templates/chats_explorer/basic_card_image.html b/var/www/templates/chats_explorer/basic_card_image.html new file mode 100644 index 00000000..307dbddb --- /dev/null +++ b/var/www/templates/chats_explorer/basic_card_image.html @@ -0,0 +1,57 @@ + + +
+
+

+ + + + {{ meta["icon"]["icon"] }} + + + {{ meta["id"] }} : +

+
+
+
+ {% if meta["tags_safe"] %} + + {% else %} + + + + + {% endif %} +
+ +
+ + + + + + {{meta["first_seen"]}} + + + + + {{meta["last_seen"]}} + + + + +
+ +
+ {% for tag in meta['tags'] %} + {{ tag }} + {% endfor %} +
+ +
+ {% include 'objects/block_object_footer_small.html' %} +
\ No newline at end of file diff --git a/var/www/templates/chats_explorer/card_image.html b/var/www/templates/chats_explorer/card_image.html new file mode 100644 index 00000000..058e3c0d --- /dev/null +++ b/var/www/templates/chats_explorer/card_image.html @@ -0,0 +1,104 @@ + + + +{% with modal_add_tags=ail_tags %} + {% include 'modals/add_tags.html' %} +{% endwith %} + +{% include 'modals/edit_tag.html' %} + + + +
+
+

{{ meta["id"] }} :

+
    +
  • + + + + + + + + + + + + + + + + + +
    First SeenLast SeenNB
    + + + + {{ meta["icon"]["icon"] }} + + + {{ meta['type'] }} + + {{ meta['first_seen'][0:4] }}-{{ meta['first_seen'][4:6] }}-{{ meta['first_seen'][6:8] }} + + {{ meta['last_seen'][0:4] }}-{{ meta['last_seen'][4:6] }}-{{ meta['last_seen'][6:8] }} + {{ meta['nb_seen'] }}
    +
  • +
  • +
    +
    +
    + +
    +
    +
    + {% include 'objects/image/block_blur_img_slider.html' %} + +
    +
    +
    +
    +
  • + +
  • +
    + Tags: + {% for tag in meta['tags'] %} + + {% endfor %} + +
    +
  • +
+ + {% with obj_type='image', obj_id=meta['id'], obj_subtype='' %} + {% include 'modals/investigations_register_obj.html' %} + {% endwith %} + + +
+
\ No newline at end of file diff --git a/var/www/templates/correlation/show_correlation.html b/var/www/templates/correlation/show_correlation.html index a3fae335..a4286471 100644 --- a/var/www/templates/correlation/show_correlation.html +++ b/var/www/templates/correlation/show_correlation.html @@ -121,6 +121,8 @@ {% include 'correlation/metadata_card_etag.html' %} {% elif dict_object["object_type"] == "hhhash" %} {% include 'correlation/metadata_card_hhhash.html' %} + {% elif dict_object["object_type"] == "image" %} + {% include 'chats_explorer/card_image.html' %} {% elif dict_object["object_type"] == "item" %} {% include 'correlation/metadata_card_item.html' %} {% elif dict_object["object_type"] == "favicon" %} diff --git a/var/www/templates/domains/card_img_domain.html b/var/www/templates/domains/card_img_domain.html index 66447a72..b9eecfd3 100644 --- a/var/www/templates/domains/card_img_domain.html +++ b/var/www/templates/domains/card_img_domain.html @@ -55,7 +55,7 @@ - {{dict_domain["first_seen"]}} + {{dict_domain["last_seen"]}} diff --git a/var/www/templates/objects/block_object_footer_small.html b/var/www/templates/objects/block_object_footer_small.html new file mode 100644 index 00000000..670c38ca --- /dev/null +++ b/var/www/templates/objects/block_object_footer_small.html @@ -0,0 +1,12 @@ +
+{#
#} +{# #} +{# #} +{# #} +{#
#} +
+ + + +
+