From be2e1ddc33c297c00bd0b5a3842315c0b9606637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 10 Aug 2022 18:45:40 +0200 Subject: [PATCH] fix: properly handle listing configuration, clear None from queries before pasing to redis --- bin/async_capture.py | 4 ++-- lookyloo/lookyloo.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/async_capture.py b/bin/async_capture.py index edc290e..ebf6aa5 100755 --- a/bin/async_capture.py +++ b/bin/async_capture.py @@ -64,10 +64,10 @@ class AsyncCapture(AbstractManager): if get_config('generic', 'default_public'): # By default, the captures are on the index, unless the user mark them as un-listed - listing = False if ('listing' in to_capture and to_capture[b'listing'].lower() in [b'false', b'0', b'']) else True + listing = False if (b'listing' in to_capture and to_capture[b'listing'].lower() in [b'false', b'0', b'']) else True else: # By default, the captures are not on the index, unless the user mark them as listed - listing = True if ('listing' in to_capture and to_capture[b'listing'].lower() in [b'true', b'1']) else False + listing = True if (b'listing' in to_capture and to_capture[b'listing'].lower() in [b'true', b'1']) else False # Turn the freetext for the headers into a dict headers: Dict[str, str] = {} diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 56e6236..728c02d 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -399,11 +399,12 @@ class Lookyloo(): if isinstance(value, bool): query[key] = 1 if value else 0 elif isinstance(value, (list, dict)): - query[key] = json.dumps(value) + query[key] = json.dumps(value) if value else None if 'document_name' in query: query['document_name'] = secure_filename(query['document_name']) + query = {k: v for k, v in query.items() if v is not None} # Remove the none, it makes redis unhappy # dirty deduplicate hash_query = hashlib.sha512(pickle.dumps(query)).hexdigest() # FIXME The line below should work, but it doesn't