From 48514369998791e27056af9b45bbf687c91fa6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 24 Jun 2020 11:37:54 +0200 Subject: [PATCH] chg: More improvements in body hash display --- lookyloo/lookyloo.py | 11 +++++++---- website/web/templates/hostname_popup.html | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 3b78200..b38c90d 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -756,13 +756,16 @@ class Lookyloo(): to_append['body_hash_details'] = freq captures_list: Dict[str, List[Tuple[str, str, str, str]]] = {'same_url': [], 'different_url': []} - for capture_uuid, url_uuid, url_hostname, same_url in self.indexing.get_body_hash_captures(url.body_hash, url.name): - cache = self.capture_cache(capture_uuid) + for h_capture_uuid, url_uuid, url_hostname, same_url in self.indexing.get_body_hash_captures(url.body_hash, url.name): + if h_capture_uuid == capture_uuid: + # Skip self. + continue + cache = self.capture_cache(h_capture_uuid) if cache: if same_url: - captures_list['same_url'].append((capture_uuid, url_uuid, cache['title'], url_hostname)) + captures_list['same_url'].append((h_capture_uuid, url_uuid, cache['title'], url_hostname)) else: - captures_list['different_url'].append((capture_uuid, url_uuid, cache['title'], url_hostname)) + captures_list['different_url'].append((h_capture_uuid, url_uuid, cache['title'], url_hostname)) to_append['body_hash_details']['other_captures'] = captures_list diff --git a/website/web/templates/hostname_popup.html b/website/web/templates/hostname_popup.html index fc4a907..0368488 100644 --- a/website/web/templates/hostname_popup.html +++ b/website/web/templates/hostname_popup.html @@ -122,9 +122,12 @@ This file can be found {{ url['body_hash_details']['hash_freq'] }} times across all the captures on this lookyloo instance, in {{ url['body_hash_details']['hash_domains_freq'] }} unique domains.
- {% if url['body_hash_details']['other_captures'] %} + + {% set total_captures = url['body_hash_details']['other_captures']['different_url']|length + url['body_hash_details']['other_captures']['same_url']|length %} + + {% if total_captures > 0 %}

- The same file was seen in {{ url['body_hash_details']['other_captures']|length }} other captures. + The same file was seen in {{ total_captures }} other captures.