From fc4c342316077f40b0296a783c010879d4d8b2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 30 Nov 2021 15:43:42 +0100 Subject: [PATCH] new: Add stats on hits on hashlookup --- lookyloo/lookyloo.py | 2 +- website/web/__init__.py | 4 ++-- website/web/templates/hashlookup.html | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 016c338d..c73c6241 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -758,7 +758,7 @@ class Lookyloo(): for sha1 in hashlookup_entries.keys(): to_return[sha1]['nodes'] = hashes_tree[sha1] to_return[sha1]['hashlookup'] = hashlookup_entries[sha1] - return to_return + return to_return, len(hashes_tree) def get_hashes(self, tree_uuid: str, /, hostnode_uuid: Optional[str]=None, urlnode_uuid: Optional[str]=None) -> Set[str]: """Return hashes (sha512) of resources. diff --git a/website/web/__init__.py b/website/web/__init__.py index 6ef20b10..6f407f0c 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -515,8 +515,8 @@ def urls_rendered_page(tree_uuid: str): @app.route('/tree//hashlookup', methods=['GET']) def hashlookup(tree_uuid: str): - merged = lookyloo.merge_hashlookup_tree(tree_uuid) - return render_template('hashlookup.html', base_tree_uuid=tree_uuid, merged=merged) + merged, total_ressources = lookyloo.merge_hashlookup_tree(tree_uuid) + return render_template('hashlookup.html', base_tree_uuid=tree_uuid, merged=merged, total_ressources=total_ressources) @app.route('/bulk_captures/', methods=['POST']) diff --git a/website/web/templates/hashlookup.html b/website/web/templates/hashlookup.html index 4c56043f..a2c6397f 100644 --- a/website/web/templates/hashlookup.html +++ b/website/web/templates/hashlookup.html @@ -1,4 +1,6 @@
+ Total Hits: {{ merged|length }}
+ Total ressources: {{total_ressources}}

{% for sha1, entries in merged.items() %}
URLs in tree