温馨提示×

怎样提取ubuntu strings

小樊
39
2026-09-24 17:35:24
栏目: 智能运维

在 Ubuntu(及其他 Linux 系统)中,提取 strings 通常是指从二进制文件、可执行程序、库文件、内存镜像或磁盘镜像中提取可打印的字符串(如 ASCII / Unicode 文本)。下面按常见场景说明。


一、使用 strings 命令(最常用)

1. 基本用法

strings /path/to/file

示例:

strings /bin/ls

2. 指定最小字符串长度

默认是 4,可改为 6:

strings -n 6 /bin/ls

3. 提取 Unicode 字符串(UTF-8 / UTF-16)

strings -e l /path/to/file   # 16-bit little endian
strings -e b /path/to/file   # 16-bit big endian
strings -e s /path/to/file   # 7-bit

二、从特定节区提取(ELF 文件)

1. 使用 objdump

objdump -s -j .rodata /bin/ls

2. 使用 readelf

readelf -x .rodata /bin/ls

三、从运行中的进程提取字符串

方法 1:strings + /proc

strings /proc/<pid>/maps

方法 2:提取进程内存

cat /proc/<pid>/mem | strings

(需要权限,可能需要 gdbroot


四、从磁盘镜像 / 内存镜像提取

strings disk.img > strings.txt

结合 grep

strings disk.img | grep -i password

五、结合 grep 过滤有用信息

strings /bin/ls | grep -i error

六、常见用途

  • 分析恶意软件
  • 逆向工程
  • 查找硬编码密码 / URL
  • 定位调试信息

如果你有具体场景(比如:ELF、PE、Android so、内存 dump、Docker 镜像),可以告诉我,我可以给你更精确的命令。

0