strings 是 Linux 下非常常用的一个命令,用来从二进制文件、数据文件等中提取可打印的字符串。下面是常用参数和说明(以 GNU strings 为准,不同版本略有差异)。
strings [选项] 文件...
| 参数 | 说明 |
|---|---|
-n <num> |
指定最小字符串长度(默认一般是 4) |
--bytes=<num> |
同 -n |
strings -n 6 a.out
| 参数 | 说明 |
|---|---|
-t <format> |
显示字符串在文件中的偏移 |
--radix=<format> |
同 -t |
支持的格式:
o:八进制d:十进制x:十六进制strings -t x a.out
| 参数 | 说明 |
|---|---|
-a / --all |
扫描整个文件(默认行为) |
-d / --data |
只扫描 ELF 的数据段(不扫描代码段) |
-o |
等同于 -t o(八进制偏移) |
strings -d a.out
| 参数 | 说明 |
|---|---|
-e <encoding> |
指定字符编码 |
常用编码:
s:7-bit ASCII(默认)S:8-bitb:16-bit big-endianl:16-bit little-endianB:32-bit big-endianL:32-bit little-endianstrings -e l a.out
| 参数 | 说明 |
|---|---|
-f / --print-file-name |
在输出前显示文件名 |
-T <bfdname> |
指定目标文件格式(ELF、PE 等) |
--help |
显示帮助 |
--version |
显示版本 |
strings -f *.so
strings a.out
strings -n 6 a.out
strings -t x a.out
strings -f file1 file2
strings -d a.out
✅ 查找程序中的硬编码路径、URL、密码
✅ 分析恶意程序
✅ 辅助逆向工程
✅ 查看 ELF / PE 文件信息
如果你有具体场景(例如:逆向分析 / 查勒索病毒 / 分析 so 文件 / 排查二进制),我可以给你更针对性的用法示例。