strings
テキスト処理
書き方
strings [file]バイナリから文字らしく見える部分を抜き出します。文字に見えれば何でも拾うので、多くは意味ではなく偶然です。
よく使うオプション
| オプション | 意味 |
|---|---|
| -n | Report only runs of at least N characters; the default is 4 |
| -t | Print the offset in the file, as d, o or x |
| -a | Scan the whole file, not only the loaded sections |
| -o | BSD and macOS: prefix each hit with its decimal offset |
| -e | GNU: set the encoding, such as l for 16-bit little-endian |
例
strings app.bin | grep -i versionFinds a version string inside a binary.
strings -n 8 core.dumpOnly sequences of eight characters or more.
パイプでつないで使うのが本来の形です。ひとつで全部やるより、三つつないだ方が短くなります。
読み方
- 角括弧 [ ] は省いてよい部分です。
- 三点 … は複数並べられるという意味です。
- オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。
よくある質問
Q. strings は何をしますか。
バイナリから文字らしく見える部分を抜き出します。文字に見えれば何でも拾うので、多くは意味ではなく偶然です。
Q. どう打ちますか。
strings [file] — 角括弧は省いてよい部分です。
Q. よく使うオプションはいくつですか。
ここにまとめたのは5個です。全部は man strings にあります。このコマンドはテキスト処理の仲間です。
関連するコマンド
man ページ: man strings