new: Add stats on hits on hashlookup

pull/298/head
Raphaël Vinot 2021-11-30 15:43:42 +01:00
parent 5e33ad6d0b
commit fc4c342316
3 changed files with 5 additions and 3 deletions

View File

@ -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.

View File

@ -515,8 +515,8 @@ def urls_rendered_page(tree_uuid: str):
@app.route('/tree/<string:tree_uuid>/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/<string:base_tree_uuid>', methods=['POST'])

View File

@ -1,4 +1,6 @@
<div>
<b>Total Hits</b>: {{ merged|length }}</br>
<b>Total ressources</b>: {{total_ressources}}</br></br>
{% for sha1, entries in merged.items() %}
<dl class="row">
<dt class="col-sm-2">URLs in tree</dt>