Skip to content

Commit

Permalink
fix: init errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo23x0 committed Apr 24, 2023
1 parent fc3d4f3 commit 4ebea60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion loki-upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4ebea60

Please sign in to comment.