Skip to content

Commit

Permalink
feat: improved file type checking - always process ELF
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo23x0 committed May 16, 2020
1 parent 32d816b commit a77dd08
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fenrir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Simple Bash IOC Checker
# Florian Roth

VERSION="0.6.0"
VERSION="0.7.0"

# Settings ------------------------------------------------------------
SYSTEM_NAME=$(uname -n | tr -d "\n")
Expand Down Expand Up @@ -99,9 +99,12 @@ function scan_dirs
DO_DATE_CHECK=0
DO_FILENAME_CHECK=0
fi

# Check if relevant type
relevant_type=$(file "$file_path" | grep -F "ELF")

# Exclude Extensions
if [ $CHECK_ONLY_RELEVANT_EXTENSIONS -eq 1 ]; then
if [ $CHECK_ONLY_RELEVANT_EXTENSIONS -eq 1 ] && [ "$relevant_type" == "" ]; then
result=$(check_extension "$extension")
if [ "${result}" -ne 1 ]; then
log debug "Deactivating some checks on $file_path due to irrelevant extension ..."
Expand Down Expand Up @@ -150,6 +153,7 @@ function scan_dirs
md5=$(md5sum "$file_path" 2> /dev/null | cut -f1 -d' ')
sha1=$(sha1sum "$file_path" 2> /dev/null | cut -f1 -d' ')
sha256=$(shasum -a 256 "$file_path" 2> /dev/null | cut -f1 -d' ')
log debug "Checking hashes of file $file_path : $md5"
check_hashes "$md5" "$sha1" "$sha256" "$file_path"
fi

Expand Down

0 comments on commit a77dd08

Please sign in to comment.