diff --git a/bin/async_capture.py b/bin/async_capture.py index 7050b77b..a93355e3 100755 --- a/bin/async_capture.py +++ b/bin/async_capture.py @@ -62,10 +62,10 @@ class AsyncCapture(AbstractManager): cookies_pseudofile=to_capture.get('cookies', None), depth=int(to_capture.get('depth', 1)), # 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['listing'] in ['False', '0']) else True, + listing=False if ('listing' in to_capture and to_capture['listing'].lower() in ['false', '0', '']) else True, user_agent=to_capture.get('user_agent', None), - referer=to_capture.get('referer', ''), - proxy=to_capture.get('proxy', ''), + referer=to_capture.get('referer', None), + proxy=to_capture.get('proxy', None), os=to_capture.get('os', None), browser=to_capture.get('browser', None), parent=to_capture.get('parent', None) @@ -83,7 +83,7 @@ class AsyncCapture(AbstractManager): def _capture(self, url: str, *, perma_uuid: str, cookies_pseudofile: Optional[Union[BufferedIOBase, str]]=None, depth: int=1, listing: bool=True, user_agent: Optional[str]=None, - referer: str='', proxy: str='', os: Optional[str]=None, + referer: Optional[str]=None, proxy: Optional[str]=None, os: Optional[str]=None, browser: Optional[str]=None, parent: Optional[str]=None) -> Tuple[bool, str]: '''Launch a capture''' url = url.strip() diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index 7390d71c..00120adc 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -630,8 +630,7 @@ class Lookyloo(): p = self.redis.pipeline() for key, value in query.items(): if isinstance(value, bool): - # Yes, empty string because that's False. - query[key] = 1 if value else '' + query[key] = 1 if value else 0 if isinstance(value, list): query[key] = json.dumps(value) if priority < -10: diff --git a/website/web/genericapi.py b/website/web/genericapi.py index 6ee13ff9..cf34d209 100644 --- a/website/web/genericapi.py +++ b/website/web/genericapi.py @@ -345,12 +345,8 @@ class SubmitCapture(Resource): if 'url' not in request.args or not request.args.get('url'): return 'No "url" in the URL params, nothting to capture.', 400 - try: - listing = int(request.args['listing']) - except Exception: - listing = 1 - - to_query = {'url': request.args['url'], 'listing': listing} + to_query = {'url': request.args['url'], + 'listing': False if 'listing' in request.args and request.args['listing'] in [0, '0'] else True} if request.args.get('user_agent'): to_query['user_agent'] = request.args['user_agent'] if request.args.get('referer'):