This commit is contained in:
2025-08-02 14:11:21 -06:00
parent f69e4bbbfd
commit b98cc940ed
+11
View File
@@ -14,6 +14,7 @@ file_dir="$analysis_dir/file"
strings_dir="$analysis_dir/strings"
sha256sum_dir="$analysis_dir/sha256sum"
binwalk_dir="$analysis_dir/binwalk"
md5_dir="$analysis_dir/md5sum"
# make the directory structure if absent or fail without error
mkdir -p "$file_dir" "$strings_dir" "$sha256sum_dir" "$binwalk_dir"
@@ -25,6 +26,7 @@ log_binwalk="$binwalk_dir/recursive-binwalk-$timestamp.txt"
log_file="$file_dir/recursive-file-$timestamp.txt"
log_strings="$strings_dir/recursive-strings-hex-offsets-$timestamp.txt"
log_sha256sum="$sha256sum_dir/recursive-sha256sum-$timestamp.txt"
log_md5sum="$md5_dir/recursive-shamd5sum-$timestamp.txt"
# full command except filename
pre_cmd_binwalk="binwalk"
@@ -32,6 +34,7 @@ pre_cmd_file="file"
strings_len=8
pre_cmd_strings="strings --bytes=$strings_len --print-file-name --radix=x"
pre_cmd_sha256sum="sha256sum"
pre_cmd_md5sum="md5sum"
echo -e "\nRunning Princess Pi's Recursive Analysis on $scan_path at $timestamp\n\tMaster log: $log_main\n"
@@ -68,6 +71,14 @@ find "$scan_path" -type f \
-not -path "*/recursive-analysis/*" \
-exec $pre_cmd_sha256sum "{}" >> $log_sha256sum \;
## md5sum
echo "Recursive md5sum! Saving to $log_sha256sum . . ."
find "$scan_path" -type f \
-not -path "*/.git/*" \
-not -path "*/__pycache__/*" \
-not -path "*/recursive-analysis/*" \
-exec $pre_cmd_md5sum "{}" >> $log_md5sum \;
# log to master log
echo -e "$timestamp:\n\tscan path: $scan_path\n\tbinwalk:\n\t\tlog: $log_binwalk\n\t\tcmd: $pre_cmd_sha256sum {}\n\tfile:\n\t\tlog: $log_file\n\t\tcmd: $pre_cmd_file {}\n\tstrings:\n\t\tlog: $log_strings\n\t\tcmd: $pre_cmd_strings {}\n\tsha256sum:\n\t\tlog: $log_sha256sum\n\t\tcmd: $pre_cmd_sha256sum {}\n" >> $log_main