makan find_bytes fuckin works

This commit is contained in:
2025-08-02 13:41:28 -06:00
parent 7752edfb2e
commit 2b9a2201b6
+8 -11
View File
@@ -1,15 +1,12 @@
#!/bin/bash
if [ -z "$1" -o -z "$2" ]; then
echo -e "usage:\n\tbash find_bytes.sh <path> <bytes string>\n\t\tex. bash find_bytes.sh /path/to/dir \"\\\x20\\\x20\""
echo -e "usage:\n\tfind_bytes <bytes regex> <path> \n\t\tex. find_bytes '[\x{20}]' /path/to/dir"
exit
else
# ugrep
# -W hexdump binary matches, while keeping text matches as text
# -z decompress files if need be to scan them
# -R recursive
# ug -W -z -R <bytes regex> <path>
ug -W -z -R $1 "$2"
fi
# took a fuckton of experimentation to figure out da escapes lmfao
double_bytes="$2" # rename it
path=$1 # rename it
# format ddmmyyyy-HHMM-SS
log="./recursive-binwalk-$(date +"%d%m%Y-%H%M-%S").txt" # make da log name
# watch your escapes here. some needs escape, redundant escape, or no escape
find "$path" -type f -exec /bin/bash -c "cmd=\"binwalk --log=$log --raw=$double_bytes {}\"; echo -e \"\n\n==\nfile: {}\nlog: $log\ncommand: \$(printf \\\"%q\\\" \$cmd)\" | tee -a $log; exec \$cmd" \;