diff --git a/bin/lib/correlations_engine.py b/bin/lib/correlations_engine.py index f1a2f3b7..c0e8d370 100755 --- a/bin/lib/correlations_engine.py +++ b/bin/lib/correlations_engine.py @@ -74,16 +74,24 @@ def get_nb_correlations(obj_type, subtype, obj_id, filter_types=[]): obj_correlations[correl_type] = get_nb_correlation_by_correl_type(obj_type, subtype, obj_id, correl_type) return obj_correlations -def get_correlation_by_correl_type(obj_type, subtype, obj_id, correl_type): - return r_metadata.smembers(f'correlation:obj:{obj_type}:{subtype}:{correl_type}:{obj_id}') +def get_correlation_by_correl_type(obj_type, subtype, obj_id, correl_type, unpack=False): + correl = r_metadata.smembers(f'correlation:obj:{obj_type}:{subtype}:{correl_type}:{obj_id}') + if unpack: + unpacked = [] + for str_correl in correl: + unpacked.append(str_correl.split(':', 1)) + return unpacked + else: + return correl -def get_correlations(obj_type, subtype, obj_id, filter_types=[]): +def get_correlations(obj_type, subtype, obj_id, filter_types=[], unpack=False): if subtype is None: subtype = '' obj_correlations = {} filter_types = sanityze_obj_correl_types(obj_type, filter_types) for correl_type in filter_types: - obj_correlations[correl_type] = get_correlation_by_correl_type(obj_type, subtype, obj_id, correl_type) + obj_correlations[correl_type] = get_correlation_by_correl_type(obj_type, subtype, obj_id, correl_type, + unpack=unpack) return obj_correlations def exists_obj_correlation(obj_type, subtype, obj_id, obj2_type): diff --git a/bin/lib/objects/abstract_object.py b/bin/lib/objects/abstract_object.py index 0a52618f..c10f0acd 100755 --- a/bin/lib/objects/abstract_object.py +++ b/bin/lib/objects/abstract_object.py @@ -213,11 +213,11 @@ class AbstractObject(ABC): """ return get_correlations(self.type, self.subtype, self.id, filter_types=[obj_type]) - def get_correlations(self, filter_types=[]): + def get_correlations(self, filter_types=[], unpack=False): """ Get object correlations """ - return get_correlations(self.type, self.subtype, self.id, filter_types=filter_types) + return get_correlations(self.type, self.subtype, self.id, filter_types=filter_types, unpack=unpack) def get_nb_correlation(self, correl_type): return get_nb_correlation_by_correl_type(self.type, self.get_subtype(r_str=True), self.id, correl_type) diff --git a/var/www/blueprints/crawler_splash.py b/var/www/blueprints/crawler_splash.py index aca2515b..6972a4f1 100644 --- a/var/www/blueprints/crawler_splash.py +++ b/var/www/blueprints/crawler_splash.py @@ -61,8 +61,8 @@ def create_json_response(data, status_code): def crawlers_dashboard(): is_manager_connected = crawlers.get_lacus_connection_metadata() crawlers_status = crawlers.get_captures_status() - # print(crawlers_status) crawlers_latest_stats = crawlers.get_crawlers_stats() + # print(crawlers_status) # print(crawlers_latest_stats) date = crawlers.get_current_date() return render_template("dashboard_crawler.html", date=date, @@ -290,7 +290,7 @@ def showDomain(): dict_domain = domain.get_meta(options=['last_origin', 'languages']) dict_domain['domain'] = domain.id if domain.was_up(): - dict_domain = {**dict_domain, **domain.get_correlations()} + dict_domain = {**dict_domain, **domain.get_correlations(unpack=True)} dict_domain['correlation_nb'] = len(dict_domain['decoded']) + len(dict_domain['username']) + len( dict_domain['pgp']) + len(dict_domain['cryptocurrency']) + len(dict_domain['screenshot']) dict_domain['tags_safe'] = Tag.is_tags_safe(dict_domain['tags']) diff --git a/var/www/modules/search/templates/search.html b/var/www/modules/search/templates/search.html index e01d66ce..7d599692 100644 --- a/var/www/modules/search/templates/search.html +++ b/var/www/modules/search/templates/search.html @@ -284,7 +284,7 @@ // On click, get html content from url and update the corresponding modal $("[data-toggle='modal']").off('click.openmodal').on("click.openmodal", function (event) { var modal=$(this); - var url = " {{ url_for('showsavedpastes.showpreviewpaste') }}?paste=" + $(this).attr('data-path') + "&num=" + $(this).attr('data-num'); + var url = " {{ url_for('objects_item.item_preview') }}?id=" + $(this).attr('data-path'); last_clicked_paste = $(this).attr('data-num'); $.get(url, function (data) { diff --git a/var/www/templates/crawler/crawler_splash/showDomain.html b/var/www/templates/crawler/crawler_splash/showDomain.html index 9bf057d5..43f00d4b 100644 --- a/var/www/templates/crawler/crawler_splash/showDomain.html +++ b/var/www/templates/crawler/crawler_splash/showDomain.html @@ -191,7 +191,7 @@ {% for decoded in dict_domain['decoded']%} - {{ decoded }} + {{ decoded[1] }} {% endfor %} @@ -230,26 +230,21 @@ - {% for dict_key in dict_domain['pgp']%} - {% if dict_key != "nb" %} - {% if dict_key=="mail" %} + {% for row in dict_domain['pgp']%} + {% if row[0] != "mail" %} {% set var_icon = "fas fa-at" %} - {% elif dict_key=="name" %} + {% elif row[0]=="name" %} {% set var_icon = "fas fa-user-tag" %} - {% else %} + {% else %} {% set var_icon = "fas fa-key" %} - {% endif %} - {% for key_id in dict_domain['pgp'][dict_key]%} - - - -   {{ dict_key }} - - {{ key_id }} - - {% endfor %} {% endif %} - {% endfor %} + + +   {{ row[0] }} + + {{ row[1] }} + + {% endfor %} @@ -258,8 +253,6 @@ {% endif %} - {{dict_domain['cryptocurrency']}} - {% if dict_domain['cryptocurrency']%}
@@ -288,27 +281,23 @@ - {% for dict_key in dict_domain['cryptocurrency']%} - - {% if dict_key != "nb" %} - {% if dict_key=="bitcoin" %} + {% for row in dict_domain['cryptocurrency']%} + {% if dict_key=="bitcoin" %} {% set var_icon = "fab fa-bitcoin" %} - {% elif dict_key=="monero" %} + {% elif dict_key=="monero" %} {% set var_icon = "fab fa-monero" %} - {% else %} + {% else %} {% set var_icon = "fas fa-coins" %} - {% endif %} - {% for key_id in dict_domain['cryptocurrency'][dict_key]%} - - - -   {{ dict_key }} - - {{ key_id }} - - {% endfor %} {% endif %} - {% endfor %} + + +   {{ row[0] }} + + + {{ row[1] }} + + + {% endfor %}
@@ -345,9 +334,9 @@ - {% for screenshot in dict_domain['screenshot']%} + {% for row in dict_domain['screenshot']%} - {{ screenshot }} + {{ row[1] }} {% endfor %} diff --git a/var/www/templates/domains/domains_filter_languages.html b/var/www/templates/domains/domains_filter_languages.html index b45236c6..8f8ba747 100644 --- a/var/www/templates/domains/domains_filter_languages.html +++ b/var/www/templates/domains/domains_filter_languages.html @@ -179,7 +179,7 @@ blocks.addEventListener('change', pixelate_all, false); {% for dict_domain in l_dict_domains['list_elem'] %} {% if 'screenshot' in dict_domain %} {% if dict_domain['is_tags_safe'] %} - var screenshot_url = "{{ url_for('showsavedpastes.screenshot', filename="") }}{{dict_domain['screenshot']}}"; + var screenshot_url = "{{ url_for('objects_item.screenshot', filename="") }}{{dict_domain['screenshot']}}"; {% else %} var screenshot_url = "{{ url_for('static', filename='image/AIL.png') }}"; {% endif %}