diff --git a/bin/archiver.py b/bin/archiver.py index 6f0fe57..1a733c4 100755 --- a/bin/archiver.py +++ b/bin/archiver.py @@ -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' diff --git a/website/web/__init__.py b/website/web/__init__.py index 92f4f27..18688eb 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -225,9 +225,13 @@ def after_request(response): @app.route('/tree//host//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//host//text', methods=['GET'])