mirror of https://github.com/CIRCL/lookyloo
fix: Properly initialize pandora, more cleanup
parent
a8b0464afa
commit
7df7ef7d1d
|
@ -19,6 +19,7 @@ class Pandora():
|
||||||
self.logger = logging.getLogger(f'{self.__class__.__name__}')
|
self.logger = logging.getLogger(f'{self.__class__.__name__}')
|
||||||
self.logger.setLevel(get_config('generic', 'loglevel'))
|
self.logger.setLevel(get_config('generic', 'loglevel'))
|
||||||
self.config = get_config('modules', 'Pandora')
|
self.config = get_config('modules', 'Pandora')
|
||||||
|
self.available = True
|
||||||
if not self.config.get('url'):
|
if not self.config.get('url'):
|
||||||
self.logger.info('No URL in config.')
|
self.logger.info('No URL in config.')
|
||||||
self.available = False
|
self.available = False
|
||||||
|
@ -28,8 +29,6 @@ class Pandora():
|
||||||
self.logger.warning('Not up.')
|
self.logger.warning('Not up.')
|
||||||
self.available = False
|
self.available = False
|
||||||
|
|
||||||
self.available = False
|
|
||||||
|
|
||||||
def submit_file(self, file_in_memory: BytesIO, filename: str) -> dict[str, Any]:
|
def submit_file(self, file_in_memory: BytesIO, filename: str) -> dict[str, Any]:
|
||||||
'''Submit a file to Pandora'''
|
'''Submit a file to Pandora'''
|
||||||
if not self.available:
|
if not self.available:
|
||||||
|
|
|
@ -633,7 +633,6 @@ def hostnode_popup(tree_uuid: str, node_uuid: str) -> str | WerkzeugResponse | R
|
||||||
hostnode, urls = get_hostnode_investigator(tree_uuid, node_uuid)
|
hostnode, urls = get_hostnode_investigator(tree_uuid, node_uuid)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return render_template('error.html', error_message='Sorry, this one is on us. The tree was rebuild, please reload the tree and try again.')
|
return render_template('error.html', error_message='Sorry, this one is on us. The tree was rebuild, please reload the tree and try again.')
|
||||||
|
|
||||||
return render_template('hostname_popup.html',
|
return render_template('hostname_popup.html',
|
||||||
tree_uuid=tree_uuid,
|
tree_uuid=tree_uuid,
|
||||||
hostnode_uuid=node_uuid,
|
hostnode_uuid=node_uuid,
|
||||||
|
|
|
@ -244,9 +244,9 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ hash_info(tree_uuid, url['url_object'].uuid, url['url_object'].mimetype,
|
{{ hash_info(tree_uuid, url['url_object'].uuid, url['url_object'].mimetype,
|
||||||
url['url_object'].body_hash, url['url_object'].body.getbuffer().nbytes,
|
url['url_object'].body_hash, url['url_object'].body.getbuffer().nbytes,
|
||||||
url.get('body_hash_freq', 0), has_pandora) }}
|
url.get('body_hash_freq', 0), has_pandora,
|
||||||
{{ ressource_legitimacy_details(url.get('legitimacy')) }}
|
url.get('legitimacy'),
|
||||||
{{ known_content_details(url.get('known_content')) }}
|
url.get('known_content')) }}
|
||||||
|
|
||||||
{% if enable_context_by_users %}
|
{% if enable_context_by_users %}
|
||||||
{{ context_form(tree_uuid, url['url_object'].uuid,
|
{{ context_form(tree_uuid, url['url_object'].uuid,
|
||||||
|
@ -288,9 +288,11 @@
|
||||||
<div class="card card-body">
|
<div class="card card-body">
|
||||||
{% for hash, details in url['embedded_ressources'].items() %}
|
{% for hash, details in url['embedded_ressources'].items() %}
|
||||||
<div>
|
<div>
|
||||||
{{hash_info(tree_uuid, url['url_object'].uuid, details['type'], hash, details['body_size'], details['hash_freq'] ) }}<br>
|
{{hash_info(tree_uuid, url['url_object'].uuid, details['type'], hash,
|
||||||
{{ ressource_legitimacy_details(details.get('legitimacy')) }}
|
details['body_size'], details['hash_freq'],
|
||||||
{{ known_content_details(details.get('known_content')) }}
|
has_pandora,
|
||||||
|
details.get('legitimacy'),
|
||||||
|
details.get('known_content')) }}<br>
|
||||||
{% if enable_context_by_users %}
|
{% if enable_context_by_users %}
|
||||||
{{ context_form(tree_uuid, url['url_object'].uuid, hash, 'hostnode_popup') }}
|
{{ context_form(tree_uuid, url['url_object'].uuid, hash, 'hostnode_popup') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
{% if details %}
|
{% if details %}
|
||||||
<div>
|
<div>
|
||||||
{% if details is string %}
|
{% if details is string %}
|
||||||
<b>{{ details }} </b>
|
This ressource is known as a generic file: <b>{{ details }}</b>
|
||||||
{% else %}
|
{% else %}
|
||||||
This file is known as part of <b>{{ details[0] }}</b>
|
This file is known as part of <b>{{ details[0] }}</b>
|
||||||
version <b>{{ details[1] }}</b>: <b>{{ details[2] }}</b>.
|
version <b>{{ details[1] }}</b>: <b>{{ details[2] }}</b>.
|
||||||
|
@ -230,12 +230,15 @@
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro hash_info(tree_uuid, urlnode_uuid, mimetype, hash, ressource_size,
|
{% macro hash_info(tree_uuid, urlnode_uuid, mimetype, hash, ressource_size,
|
||||||
nb_occurrences, has_pandora)%}
|
nb_occurrences, has_pandora, legitimacy, known_content)%}
|
||||||
|
|
||||||
{{ hash_icon(tree_uuid, urlnode_uuid, mimetype, hash) }}
|
{{ hash_icon(tree_uuid, urlnode_uuid, mimetype, hash) }}
|
||||||
|
|
||||||
<b>Body size</b> (in the HTTP response): {{ sizeof_fmt(ressource_size) }}
|
<b>Body size</b> (in the HTTP response): {{ sizeof_fmt(ressource_size) }}
|
||||||
|
|
||||||
|
{{ ressource_legitimacy_details(legitimacy) }}
|
||||||
|
{{ known_content_details(known_content) }}
|
||||||
|
|
||||||
{% if nb_occurrences > 0 %}
|
{% if nb_occurrences > 0 %}
|
||||||
<div>
|
<div>
|
||||||
This file can be found <b>{{ nb_occurrences }}</b> times across all the captures on this lookyloo instance.
|
This file can be found <b>{{ nb_occurrences }}</b> times across all the captures on this lookyloo instance.
|
||||||
|
@ -249,6 +252,7 @@
|
||||||
|
|
||||||
{% if has_pandora %}
|
{% if has_pandora %}
|
||||||
{{ pandora_submit(tree_uuid, urlnode_uuid, hash) }}
|
{{ pandora_submit(tree_uuid, urlnode_uuid, hash) }}
|
||||||
|
<br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
Loading…
Reference in New Issue