mirror of https://github.com/CIRCL/lookyloo
chg: Do not fail when sanejs is too slow to answer
parent
7880f9c31e
commit
5897f8024d
|
@ -110,7 +110,7 @@ class Context():
|
||||||
known_content_table[h] = {'type': 'sanejs',
|
known_content_table[h] = {'type': 'sanejs',
|
||||||
'details': (libname, version, path, len(entry))}
|
'details': (libname, version, path, len(entry))}
|
||||||
except json.decoder.JSONDecodeError as e:
|
except json.decoder.JSONDecodeError as e:
|
||||||
self.logger.warning(f'Something went wring with sanejs: {e}')
|
self.logger.warning(f'Something went wrong with sanejs: {e}')
|
||||||
|
|
||||||
return known_content_table
|
return known_content_table
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,10 @@ import hashlib
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import time
|
import time
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
from .helpers import get_homedir
|
from .helpers import get_homedir, get_config
|
||||||
from .exceptions import ConfigError
|
from .exceptions import ConfigError
|
||||||
|
|
||||||
import vt # type: ignore
|
import vt # type: ignore
|
||||||
|
@ -20,8 +21,11 @@ from pyeupi import PyEUPI
|
||||||
class SaneJavaScript():
|
class SaneJavaScript():
|
||||||
|
|
||||||
def __init__(self, config: Dict[str, Any]):
|
def __init__(self, config: Dict[str, Any]):
|
||||||
|
self.logger = logging.getLogger(f'{self.__class__.__name__}')
|
||||||
|
self.logger.setLevel(get_config('generic', 'loglevel'))
|
||||||
if not config.get('enabled'):
|
if not config.get('enabled'):
|
||||||
self.available = False
|
self.available = False
|
||||||
|
self.logger('Module not enabled.')
|
||||||
return
|
return
|
||||||
self.client = SaneJS()
|
self.client = SaneJS()
|
||||||
if not self.client.is_up:
|
if not self.client.is_up:
|
||||||
|
@ -54,7 +58,12 @@ class SaneJavaScript():
|
||||||
and not (today_dir / h).exists())]
|
and not (today_dir / h).exists())]
|
||||||
has_new_unknown = False
|
has_new_unknown = False
|
||||||
for h in to_lookup:
|
for h in to_lookup:
|
||||||
response = self.client.sha512(h)
|
try:
|
||||||
|
response = self.client.sha512(h)
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.warning(f'Something went wrong. Query: {h} - {e}')
|
||||||
|
continue
|
||||||
|
|
||||||
if 'error' in response:
|
if 'error' in response:
|
||||||
# Server not ready
|
# Server not ready
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue