可以,Debian 下批量处理 strings 是完全可行的,而且常用做法有好几种,取决于你“批量”的对象是什么(一批文件 / 整个目录 / 一批 deb 包)。
下面按场景给你几个实用方案。
for f in /path/to/files/*; do
echo "=== $f ==="
strings "$f"
done
find /path/to/dir -type f -exec strings {} \;
或只输出文件路径+内容:
find /path/to/dir -type f -exec sh -c 'echo "== $1 =="; strings "$1"' _ {} \;
.deb 包中的 stringsmkdir -p /tmp/debs
cd /tmp/debs
for deb in *.deb; do
dpkg-deb -x "$deb" "ext_$deb"
find "ext_$deb" -type f -exec sh -c 'echo "== $1 =="; strings "$1"' _ {} \;
done
很多 deb 里只有:
/usr/bin/*/usr/lib/*dpkg-deb -x package.deb /tmp/pkg
strings /tmp/pkg/usr/bin/*
比如只关心:
strings file | grep -E 'https?://|/usr/|error|failed'
批量版:
find . -type f -exec sh -c 'strings "$1" | grep -E "url|error"' _ {} \;
xargs 并行find . -type f | xargs -P 4 -I{} strings {}
binutils 的 strings 参数strings -n 6 file # 只显示长度≥6的字符串
你可以告诉我:
我可以直接给你一条可复制的命令或脚本。