mirror of https://github.com/CIRCL/lookyloo
new: Download embedded resource
parent
e5e4e4972e
commit
89725b8ed0
|
@ -781,10 +781,10 @@ class Lookyloo():
|
||||||
if h in to_append['embedded_ressources']:
|
if h in to_append['embedded_ressources']:
|
||||||
# Skip duplicates
|
# Skip duplicates
|
||||||
continue
|
continue
|
||||||
freq = self.indexing.body_hash_fequency(h)
|
freq_embedded = self.indexing.body_hash_fequency(h)
|
||||||
to_append['embedded_ressources'][h] = freq
|
to_append['embedded_ressources'][h] = freq_embedded
|
||||||
to_append['embedded_ressources'][h]['type'] = mimetype
|
to_append['embedded_ressources'][h]['type'] = mimetype
|
||||||
if freq['hash_freq'] > 1:
|
if freq_embedded['hash_freq'] > 1:
|
||||||
to_append['embedded_ressources'][h]['other_captures'] = self.hash_lookup(h, url.name, capture_uuid)
|
to_append['embedded_ressources'][h]['other_captures'] = self.hash_lookup(h, url.name, capture_uuid)
|
||||||
if hasattr(self, 'sanejs') and self.sanejs.available:
|
if hasattr(self, 'sanejs') and self.sanejs.available:
|
||||||
to_lookup = list(to_append['embedded_ressources'].keys())
|
to_lookup = list(to_append['embedded_ressources'].keys())
|
||||||
|
|
|
@ -227,6 +227,21 @@ def urlnode_post_request(tree_uuid: str, node_uuid: str):
|
||||||
as_attachment=True, attachment_filename='posted_data.txt')
|
as_attachment=True, attachment_filename='posted_data.txt')
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/tree/<string:tree_uuid>/url/<string:node_uuid>/embedded_ressource', methods=['POST'])
|
||||||
|
def get_embedded_ressource(tree_uuid: str, node_uuid: str):
|
||||||
|
url = lookyloo.get_urlnode_from_tree(tree_uuid, node_uuid)
|
||||||
|
h_request = request.form.get('ressource_hash')
|
||||||
|
for mimetype, blobs in url.embedded_ressources.items():
|
||||||
|
for h, blob in blobs:
|
||||||
|
if h == h_request:
|
||||||
|
to_return = BytesIO()
|
||||||
|
with ZipFile(to_return, 'w', ZIP_DEFLATED) as zfile:
|
||||||
|
zfile.writestr('file.bin', blob.getvalue())
|
||||||
|
to_return.seek(0)
|
||||||
|
return send_file(to_return, mimetype='application/zip',
|
||||||
|
as_attachment=True, attachment_filename='file.zip')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/tree/<string:tree_uuid>/url/<string:node_uuid>', methods=['GET'])
|
@app.route('/tree/<string:tree_uuid>/url/<string:node_uuid>', methods=['GET'])
|
||||||
def urlnode_details(tree_uuid: str, node_uuid: str):
|
def urlnode_details(tree_uuid: str, node_uuid: str):
|
||||||
urlnode = lookyloo.get_urlnode_from_tree(tree_uuid, node_uuid)
|
urlnode = lookyloo.get_urlnode_from_tree(tree_uuid, node_uuid)
|
||||||
|
|
|
@ -124,6 +124,7 @@
|
||||||
across all the captures on this lookyloo instance, in <b>{{ url['body_hash_details']['hash_domains_freq'] }}</b> unique domains.
|
across all the captures on this lookyloo instance, in <b>{{ url['body_hash_details']['hash_domains_freq'] }}</b> unique domains.
|
||||||
</br>
|
</br>
|
||||||
|
|
||||||
|
{% if 'other_captures' in url['body_hash_details'] %}
|
||||||
{% set total_captures = url['body_hash_details']['other_captures']['different_url']|length + url['body_hash_details']['other_captures']['same_url']|length %}
|
{% 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 %}
|
{% if total_captures > 0 %}
|
||||||
|
@ -169,6 +170,7 @@
|
||||||
<p><a href="{{ url_for('body_hash_details', body_hash=url['url_object'].body_hash) }}">
|
<p><a href="{{ url_for('body_hash_details', body_hash=url['url_object'].body_hash) }}">
|
||||||
Show more information about this response body.
|
Show more information about this response body.
|
||||||
</a></p>
|
</a></p>
|
||||||
|
{% endif %}
|
||||||
<div>
|
<div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -196,8 +198,12 @@
|
||||||
<div>
|
<div>
|
||||||
This file (<b>{{ details['type'] }}</b>) can be found <b>{{ details['hash_freq'] }}</b> times
|
This file (<b>{{ details['type'] }}</b>) can be found <b>{{ details['hash_freq'] }}</b> times
|
||||||
across all the captures on this lookyloo instance, in <b>{{ details['hash_domains_freq'] }}</b> unique domains.
|
across all the captures on this lookyloo instance, in <b>{{ details['hash_domains_freq'] }}</b> unique domains.
|
||||||
|
<form method="post" action="{{ url_for('get_embedded_ressource', tree_uuid=tree_uuid, node_uuid=url['url_object'].uuid) }}">
|
||||||
|
<button class="btn btn-primary" name="ressource_hash" value="{{ hash }}">Download the embedded ressource</button>
|
||||||
|
</form>
|
||||||
</br>
|
</br>
|
||||||
|
|
||||||
|
{% if 'other_captures' in details %}
|
||||||
{% set total_captures = details['other_captures']['different_url']|length + details['other_captures']['same_url']|length %}
|
{% set total_captures = details['other_captures']['different_url']|length + details['other_captures']['same_url']|length %}
|
||||||
|
|
||||||
{% if total_captures > 0 %}
|
{% if total_captures > 0 %}
|
||||||
|
@ -243,6 +249,7 @@
|
||||||
<p><a href="{{ url_for('body_hash_details', body_hash=url['url_object'].body_hash) }}">
|
<p><a href="{{ url_for('body_hash_details', body_hash=url['url_object'].body_hash) }}">
|
||||||
Show more information about this embedded content.
|
Show more information about this embedded content.
|
||||||
</a></p>
|
</a></p>
|
||||||
|
{% endif %}
|
||||||
<div>
|
<div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue