mirror of https://github.com/CIRCL/lookyloo
fix: no decoding in archiver, catch exception when requesting hashes on broken capture
parent
d970c924f8
commit
e410b7631e
|
@ -25,7 +25,7 @@ class Archiver(AbstractManager):
|
|||
def __init__(self, loglevel: int=logging.INFO):
|
||||
super().__init__(loglevel)
|
||||
self.script_name = 'archiver'
|
||||
self.redis = Redis(unix_socket_path=get_socket_path('cache'), decode_responses=True)
|
||||
self.redis = Redis(unix_socket_path=get_socket_path('cache'))
|
||||
|
||||
# make sure archived captures dir exists
|
||||
self.archived_captures_dir = get_homedir() / 'archived_captures'
|
||||
|
|
|
@ -225,9 +225,13 @@ def after_request(response):
|
|||
|
||||
@app.route('/tree/<string:tree_uuid>/host/<string:node_uuid>/hashes', methods=['GET'])
|
||||
def hashes_hostnode(tree_uuid: str, node_uuid: str):
|
||||
hashes = lookyloo.get_hashes(tree_uuid, hostnode_uuid=node_uuid)
|
||||
return send_file(BytesIO('\n'.join(hashes).encode()),
|
||||
mimetype='test/plain', as_attachment=True, download_name=f'hashes.{node_uuid}.txt')
|
||||
try:
|
||||
hashes = lookyloo.get_hashes(tree_uuid, hostnode_uuid=node_uuid)
|
||||
return send_file(BytesIO('\n'.join(hashes).encode()),
|
||||
mimetype='test/plain', as_attachment=True, download_name=f'hashes.{node_uuid}.txt')
|
||||
except NoValidHarFile:
|
||||
return send_file(BytesIO(b'The capture is broken and does not contain any HAR files.'),
|
||||
mimetype='test/plain', as_attachment=True, download_name=f'hashes.{node_uuid}.txt')
|
||||
|
||||
|
||||
@app.route('/tree/<string:tree_uuid>/host/<string:node_uuid>/text', methods=['GET'])
|
||||
|
|
Loading…
Reference in New Issue