diff --git a/loki-upgrader.py b/loki-upgrader.py index 004f3e92..d46724c2 100755 --- a/loki-upgrader.py +++ b/loki-upgrader.py @@ -89,7 +89,7 @@ def __init__(self, debug, logger, application_path): def update_signatures(self, clean=False): try: for sig_url in self.UPDATE_URL_SIGS: - if needs_update(sig_url) == True: + if needs_update(sig_url): # Downloading current repository try: self.logger.log("INFO", "Upgrader", "Downloading %s ..." % sig_url) diff --git a/loki.py b/loki.py index 23bea0a5..563393fa 100644 --- a/loki.py +++ b/loki.py @@ -1208,13 +1208,14 @@ def initialize_hash_iocs(self, ioc_directory, false_positive=False): continue row = line.split(';') # Handle 2 and 3 column IOCs - if len(row) == 2: - hash = row[0].lower() - comment = row[1].rstrip(" ").rstrip("\n") - elif len(low) == 3: + if len(row) == 3 and row[1].isdigit(): hash = row[0].lower() score = int(row[1]) comment = row[2].rstrip(" ").rstrip("\n") + else: + hash = row[0].lower() + comment = row[1].rstrip(" ").rstrip("\n") + score = 100 # Empty File Hash if hash in HASH_WHITELIST: continue @@ -1229,6 +1230,8 @@ def initialize_hash_iocs(self, ioc_directory, false_positive=False): if false_positive: self.false_hashes[int(hash, 16)] = comment except Exception as e: + if logger.debug: + traceback.print_exc() logger.log("ERROR", "Init", "Cannot read line: %s" % line) # Debug