Skip to content

Commit

Permalink
Merge pull request #239 from security-companion/notice_filesize_skip
Browse files Browse the repository at this point in the history
add warning if file is skipped because of file size
  • Loading branch information
Neo23x0 authored Oct 29, 2023
2 parents 1410292 + d1cca57 commit a9790d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,20 @@ def scan_path(self, path):
# Set fileData to an empty value
fileData = ""

print_filesize_info = False

# Evaluations -------------------------------------------------------
# Evaluate size
if fileSize > (int(args.s) * 1024):
fileSizeLimit = int(args.s) * 1024
if fileSize > fileSizeLimit:
# Print files
do_intense_check = False
print_filesize_info = True

# Some file types will force intense check
if fileType == "MDMP":
do_intense_check = True
print_filesize_info = False

# Intense Check switch
if do_intense_check:
Expand All @@ -363,6 +368,9 @@ def scan_path(self, path):
if args.printall:
logger.log("INFO", "FileScan", "Checking %s TYPE: %s SIZE: %s" % (fileNameCleaned, fileType, fileSize))

if print_filesize_info and args.printall:
logger.log("INFO", "FileScan", "Skipping file due to file size: %s TYPE: %s SIZE: %s CURRENT SIZE LIMIT(kilobytes): %d" % (fileNameCleaned, fileType, fileSize, fileSizeLimit))

# Hash Check -------------------------------------------------------
# Do the check
if do_intense_check:
Expand Down

0 comments on commit a9790d1

Please sign in to comment.