chg: Improve ressources listing

pull/180/head
Raphaël Vinot 2021-03-04 18:10:54 +01:00
parent 6e7f758d76
commit 3ed7608f16
2 changed files with 19 additions and 4 deletions

View File

@ -571,7 +571,11 @@ def ressources():
domain_freq = i.ressources_number_domains(h)
context = lookyloo.context.find_known_content(h)
capture_uuid, url_uuid, hostnode_uuid = i.get_hash_uuids(h)
ressources.append((h, freq, domain_freq, context.get(h), capture_uuid, url_uuid, hostnode_uuid))
try:
ressource = lookyloo.get_ressource(capture_uuid, url_uuid, h)
except lookyloo.exceptions.MissingUUID:
ressource = ['unknown', '', 'unknown']
ressources.append((h, freq, domain_freq, context.get(h), capture_uuid, url_uuid, hostnode_uuid, ressource[0], ressource[2]))
return render_template('ressources.html', ressources=ressources)

View File

@ -16,6 +16,13 @@
"pageLength": 500
});
</script>
<script>
$(document).ready(() => {
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
});
</script>
{% endblock %}
@ -34,20 +41,24 @@
<th>Frequency</th>
<th>Number unique domains</th>
<th>Context</th>
<th>Mimetype</th>
<th>Filename</th>
</tr>
</thead>
<tbody>
{% for h, freq, number_domains, context, capture_uuid, urlnode_uuid, hostnode_uuid in ressources %}
{% for h, freq, number_domains, context, capture_uuid, urlnode_uuid, hostnode_uuid, filename, mimetype in ressources %}
<tr>
<td>
<a href="{{ url_for('body_hash_details', body_hash=h) }}">{{ shorten_string(h, 20) }}</a></br>
{{ get_ressource_button(capture_uuid, urlnode_uuid, h, 'Download sample') }}
<a href="{{ url_for('body_hash_details', body_hash=h) }}">{{ shorten_string(h, 10) }}</a></br>
{{ get_ressource_button(capture_uuid, urlnode_uuid, h, 'Download sample', mimetype and mimetype.startswith('image')) }}
</td>
<td>{{ freq }}</td>
<td>{{ number_domains }}</td>
<td> {{ context['type'] }} - {{ context['details'] }}</br>
{{ context_form(capture_uuid, urlnode_uuid, hostnode_uuid, h, 'ressources') }}
</td>
<td>{{ mimetype }}</td>
<td>{{ shorten_string(filename, 10) }}</td>
</tr>
{% endfor %}
</tbody>