strings 是 Linux 下用来从二进制文件中提取可打印字符串的命令。要把它的输出保存下来,常见做法有下面几种:
strings 文件名 > output.txt
示例:
strings a.out > strings.txt
strings 文件名 | tee output.txt
如果还想覆盖原文件:
strings 文件名 | tee output.txt
追加而不是覆盖:
strings 文件名 | tee -a output.txt
strings -n 6 文件名 > output.txt
-n 6 表示只输出长度 ≥ 6 的字符串。
strings file1 file2 file3 > output.txt
或批量处理:
strings *.bin > output.txt
strings 文件名 | grep "password" > result.txt
strings 文件名 | sort -u > unique_strings.txt
result=$(strings 文件名)
| 场景 | 推荐命令 |
|---|---|
| 普通保存 | strings file > out.txt |
| 边看边保存 | `strings file |
| 提取特定字符串 | `strings file |
如果你是在 CTF / 逆向 / 取证 / Windows / macOS 环境下用 strings,也可以告诉我,我可以给你更针对性的示例。