可以,strings 本身能“查到”中文,但有一些前提和限制。
strings 能不能显示中文?能,但要满足两个条件:
strings 默认会提取可打印字符序列,中文在 UTF-8 下也是可打印字节,所以能看到。
通常是编码问题:
strings file.bin
如果系统是 UTF-8,而文件是 GBK,就会乱码。
✅ 解决方式:
strings file.bin | iconv -f gbk -t utf-8
或反过来:
strings file.bin | iconv -f utf-8 -t gbk
strings 默认只输出 长度 ≥ 4 的字符串。
✅ 降低长度限制:
strings -n 1 file.bin
可以配合 grep:
strings file.bin | grep -P '[\x{4e00}-\x{9fff}]'
(需要 UTF-8 环境)
strings test.bin | grep 用户名
或:
strings -e l test.bin
-e l 表示 16-bit little-endian Unicode(UTF-16LE),常用于 Windows 程序。
✅ strings 能查中文
⚠️ 可能遇到:
如果你愿意,可以告诉我:
我可以给你更精确的命令。