From 73afdfa227b096f611aefa2b24e2fabbcaaa4578 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 19 Nov 2019 14:30:12 +0100 Subject: [PATCH] chg: [Domain UI] add total_nb_correlation --- bin/lib/Domain.py | 9 +++++++++ var/www/blueprints/crawler_splash.py | 1 + var/www/templates/crawler/crawler_splash/showDomain.html | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/lib/Domain.py b/bin/lib/Domain.py index 5b9310be..9c3eb5b0 100755 --- a/bin/lib/Domain.py +++ b/bin/lib/Domain.py @@ -237,6 +237,15 @@ def get_domain_all_correlation(domain, correlation_names=[], get_nb=False): return domain_correl +def get_domain_total_nb_correlation(correlation_dict): + total_correlation = 0 + if 'decoded' in correlation_dict: + total_correlation += len(correlation_dict['decoded']) + if 'cryptocurrency' in correlation_dict: + total_correlation += correlation_dict['cryptocurrency'].get('nb', 0) + if 'pgp' in correlation_dict: + total_correlation += correlation_dict['pgp'].get('nb', 0) + return total_correlation # TODO: handle port def get_domain_history(domain, domain_type, port): # TODO: add date_range: from to + nb_elem diff --git a/var/www/blueprints/crawler_splash.py b/var/www/blueprints/crawler_splash.py index 3b8c68b1..8ef41e42 100644 --- a/var/www/blueprints/crawler_splash.py +++ b/var/www/blueprints/crawler_splash.py @@ -63,6 +63,7 @@ def showDomain(): dict_domain['domain'] = domain_name if domain.is_domain_up(): dict_domain = {**dict_domain, **domain.get_domain_correlation()} + dict_domain['correlation_nb'] = Domain.get_domain_total_nb_correlation(dict_domain) dict_domain['origin_item'] = domain.get_domain_last_origin() dict_domain['tags'] = domain.get_domain_tags() dict_domain['tags_safe'] = Tag.is_tags_safe(dict_domain['tags']) diff --git a/var/www/templates/crawler/crawler_splash/showDomain.html b/var/www/templates/crawler/crawler_splash/showDomain.html index 90e87fee..5784e8e3 100644 --- a/var/www/templates/crawler/crawler_splash/showDomain.html +++ b/var/www/templates/crawler/crawler_splash/showDomain.html @@ -98,11 +98,12 @@ Last Origin: {{ dict_domain['origin_item'] }} {%endif%} - {% if 'decoded' in dict_domain or 'pgp' in dict_domain or 'cryptocurrency' in dict_domain%} + {% if dict_domain['correlation_nb'] > 0 %}
-