strings 命令用于從二進(jìn)制文件中提取可打印的字符串
-
使用 -n 選項(xiàng)指定最小字符串長度:
strings -n <length> <file>
例如,要提取長度至少為 6 的字符串,可以使用:
strings -n 6 <file>
-
使用 -e 選項(xiàng)指定字符編碼:
strings -e <encoding> <file>
其中
可以是 ASCII, ibm, utf8, ucs2, utf16le, utf16be, utf32le, utf32be 等。 例如,要使用 UTF-8 編碼提取字符串,可以使用:
strings -e utf8 <file>
-
使用 -t 選項(xiàng)以十六進(jìn)制格式顯示字符串:
strings -t <format> <file>
其中
可以是 x(默認(rèn)值,顯示為十六進(jìn)制),d(顯示為十進(jìn)制)或 o(顯示為八進(jìn)制)。 例如,要以十進(jìn)制格式顯示字符串,可以使用:
strings -t d <file>
-
使用 -T 選項(xiàng)指定輸出格式:
strings -T <type> <file>
其中
可以是 s(顯示字符串),a(顯示地址),i(顯示整數(shù))或 b(顯示字節(jié))。 例如,要同時(shí)顯示字符串及其地址,可以使用:
strings -T sa <file>
你可以根據(jù)需要組合這些選項(xiàng)來定制 strings 命令的輸出格式。例如,要提取長度至少為 6 的 UTF-8 編碼字符串,并以十六進(jìn)制和十進(jìn)制格式顯示它們及其地址,可以使用:
strings -n 6 -e utf8 -T sxd <file>