在 Debian(或一般 Linux)环境下,批量对一批文件跑 strings 通常有几种常见做法,取决于你的使用场景(目录、递归、文件类型等)。
strings *
或递归整个目录:
find . -type f -exec strings {} \;
mkdir strings_out
for f in *; do
[ -f "$f" ] && strings "$f" > "strings_out/$f.txt"
done
find . -type f -exec strings {} \; > all_strings.txt
find . -type f -exec sh -c '
file "$1" | grep -q ELF && strings "$1"
' _ {} \; > elf_strings.txt
xargs 并行find . -type f -print0 | xargs -0 -P 4 -I {} sh -c 'strings "{}" > "{}.str"'
-P 4:4 个并行进程.str 文件find . -type f -exec strings {} \; | grep -i "password\|token\|key"
如果系统没有:
sudo apt update
sudo apt install binutils
strings -n 6 file # 最小长度 6
strings -e l file # 16-bit little endian
strings -a file # 扫描整个文件
如果你能说明:
我可以给你更精确的批量脚本。