strings
命令用于顯示二進制文件中的可打印字符串。以下是一些常用的 strings
命令選項:
-n <number>
: 僅顯示長度至少為 <number>
的字符串。默認值為 4。
示例:strings -n 6 file.bin
-t <format>
: 使用指定的格式輸出字符串??蛇x值有 d
(十進制)、o
(八進制)、x
(十六進制)和 a
(ASCII)。
示例:strings -t x file.bin
-e <encoding>
: 指定字符編碼??蛇x值有 ascii
、ibm
、utf8
、utf16le
、utf16be
和 ucs2
。
示例:strings -e utf8 file.bin
-T <type>
: 指定輸出字符串的類型??蛇x值有 ascii
、wide
、ucs2
和 utf8
。
示例:strings -T utf8 file.bin
-k <number>
: 從偏移量 <number>
開始搜索字符串。
示例:strings -k 100 file.bin
-s <separator>
: 使用指定的分隔符替換默認的分隔符(空格)。
示例:strings -s, file.bin
-f <file>
: 從文件 <file>
中讀取要處理的文件列表。
示例:strings -f filelist.txt
-v
: 顯示版本信息。
示例:strings -v
-h
: 顯示幫助信息。
示例:strings -h
這些選項可以組合使用以滿足特定需求。例如,要顯示長度至少為 6 的字符串,并使用十六進制格式輸出,可以運行以下命令:
strings -n 6 -t x file.bin