mirror of https://github.com/CIRCL/lookyloo
fix: Exception in phishtank module when there are no IPs file
parent
828887cae1
commit
f4490f5ff8
|
@ -52,7 +52,10 @@ class Phishtank(AbstractModule):
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
|
||||||
def lookup_ips_capture(self, cache: CaptureCache) -> dict[str, list[dict[str, Any]]]:
|
def lookup_ips_capture(self, cache: CaptureCache) -> dict[str, list[dict[str, Any]]]:
|
||||||
with (cache.capture_dir / 'ips.json').open() as f:
|
ips_file = cache.capture_dir / 'ips.json'
|
||||||
|
if not ips_file.exists():
|
||||||
|
return {}
|
||||||
|
with ips_file.open() as f:
|
||||||
ips_dump = json.load(f)
|
ips_dump = json.load(f)
|
||||||
to_return: dict[str, list[dict[str, Any]]] = {}
|
to_return: dict[str, list[dict[str, Any]]] = {}
|
||||||
for ip in {ip for ips_list in ips_dump.values() for ip in ips_list}:
|
for ip in {ip for ips_list in ips_dump.values() for ip in ips_list}:
|
||||||
|
@ -96,7 +99,10 @@ class Phishtank(AbstractModule):
|
||||||
self.url_lookup(cache.url)
|
self.url_lookup(cache.url)
|
||||||
|
|
||||||
# Check all the IPs in the ips file of the capture
|
# Check all the IPs in the ips file of the capture
|
||||||
with (cache.capture_dir / 'ips.json').open() as f:
|
ips_file = cache.capture_dir / 'ips.json'
|
||||||
|
if not ips_file.exists():
|
||||||
|
return {'error': 'No IP file found in the capture'}
|
||||||
|
with ips_file.open() as f:
|
||||||
ips_dump = json.load(f)
|
ips_dump = json.load(f)
|
||||||
for ip in {ip for ips_list in ips_dump.values() for ip in ips_list}:
|
for ip in {ip for ips_list in ips_dump.values() for ip in ips_list}:
|
||||||
self.ip_lookup(ip)
|
self.ip_lookup(ip)
|
||||||
|
|
Loading…
Reference in New Issue