mirror of https://github.com/CIRCL/lookyloo
fix: Avoid None in urlscan.io result.
parent
404f9a3112
commit
275b4aee93
|
@ -59,15 +59,15 @@ class UrlScan():
|
||||||
m.update(to_hash.encode())
|
m.update(to_hash.encode())
|
||||||
return self.storage_dir_urlscan / m.hexdigest()
|
return self.storage_dir_urlscan / m.hexdigest()
|
||||||
|
|
||||||
def get_url_submission(self, capture_info: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
def get_url_submission(self, capture_info: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
url_storage_dir = self.__get_cache_directory(capture_info['url'],
|
url_storage_dir = self.__get_cache_directory(capture_info['url'],
|
||||||
capture_info['user_agent'],
|
capture_info['user_agent'],
|
||||||
capture_info['referer']) / 'submit'
|
capture_info['referer']) / 'submit'
|
||||||
if not url_storage_dir.exists():
|
if not url_storage_dir.exists():
|
||||||
return None
|
return {}
|
||||||
cached_entries = sorted(url_storage_dir.glob('*'), reverse=True)
|
cached_entries = sorted(url_storage_dir.glob('*'), reverse=True)
|
||||||
if not cached_entries:
|
if not cached_entries:
|
||||||
return None
|
return {}
|
||||||
|
|
||||||
with cached_entries[0].open() as f:
|
with cached_entries[0].open() as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
|
Loading…
Reference in New Issue