mirror of https://github.com/CIRCL/lookyloo
chg: Cleanup passing listing key to and from bool in redis
parent
b59e73258d
commit
d1f673f3a7
|
@ -62,10 +62,10 @@ class AsyncCapture(AbstractManager):
|
||||||
cookies_pseudofile=to_capture.get('cookies', None),
|
cookies_pseudofile=to_capture.get('cookies', None),
|
||||||
depth=int(to_capture.get('depth', 1)),
|
depth=int(to_capture.get('depth', 1)),
|
||||||
# By default, the captures are on the index, unless the user mark them as un-listed
|
# 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),
|
user_agent=to_capture.get('user_agent', None),
|
||||||
referer=to_capture.get('referer', ''),
|
referer=to_capture.get('referer', None),
|
||||||
proxy=to_capture.get('proxy', ''),
|
proxy=to_capture.get('proxy', None),
|
||||||
os=to_capture.get('os', None),
|
os=to_capture.get('os', None),
|
||||||
browser=to_capture.get('browser', None),
|
browser=to_capture.get('browser', None),
|
||||||
parent=to_capture.get('parent', 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,
|
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,
|
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]:
|
browser: Optional[str]=None, parent: Optional[str]=None) -> Tuple[bool, str]:
|
||||||
'''Launch a capture'''
|
'''Launch a capture'''
|
||||||
url = url.strip()
|
url = url.strip()
|
||||||
|
|
|
@ -630,8 +630,7 @@ class Lookyloo():
|
||||||
p = self.redis.pipeline()
|
p = self.redis.pipeline()
|
||||||
for key, value in query.items():
|
for key, value in query.items():
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
# Yes, empty string because that's False.
|
query[key] = 1 if value else 0
|
||||||
query[key] = 1 if value else ''
|
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
query[key] = json.dumps(value)
|
query[key] = json.dumps(value)
|
||||||
if priority < -10:
|
if priority < -10:
|
||||||
|
|
|
@ -345,12 +345,8 @@ class SubmitCapture(Resource):
|
||||||
if 'url' not in request.args or not request.args.get('url'):
|
if 'url' not in request.args or not request.args.get('url'):
|
||||||
return 'No "url" in the URL params, nothting to capture.', 400
|
return 'No "url" in the URL params, nothting to capture.', 400
|
||||||
|
|
||||||
try:
|
to_query = {'url': request.args['url'],
|
||||||
listing = int(request.args['listing'])
|
'listing': False if 'listing' in request.args and request.args['listing'] in [0, '0'] else True}
|
||||||
except Exception:
|
|
||||||
listing = 1
|
|
||||||
|
|
||||||
to_query = {'url': request.args['url'], 'listing': listing}
|
|
||||||
if request.args.get('user_agent'):
|
if request.args.get('user_agent'):
|
||||||
to_query['user_agent'] = request.args['user_agent']
|
to_query['user_agent'] = request.args['user_agent']
|
||||||
if request.args.get('referer'):
|
if request.args.get('referer'):
|
||||||
|
|
Loading…
Reference in New Issue