打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
strings指令_如何插看so的编译时间
userphoto

2023.07.21 广东

关注

    表示用了很久的linux(其实并没有+_+),strings指令还是最近为了识别动态库版本才发现的,在此做一个汇总。

    首先当然是查看帮助文档了,输入strings --help。

  1. alex@alex:~$ strings --help
  2. Usage: strings [option(s)] [file(s)]
  3. Display printable strings in [file(s)] (stdin by default)
  4. The options are:
  5. -a - --all Scan the entire file, not just the data section [default]
  6. -d --data Only scan the data sections in the file
  7. -f --print-file-name Print the name of the file before each string
  8. -n --bytes=[number] Locate & print any NUL-terminated sequence of at
  9. -<number> least [number] characters (default 4).
  10. -t --radix={o,d,x} Print the location of the string in base 8, 10 or 16
  11. -w --include-all-whitespace Include all whitespace as valid string characters
  12. -o An alias for --radix=o
  13. -T --target=<BFDNAME> Specify the binary file format
  14. -e --encoding={s,S,b,l,B,L} Select character size and endianness:
  15. s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit
  16. -s --output-separator=<string> String used to separate strings in output.
  17. @<file> Read options from <file>
  18. -h --help Display this information
  19. -v -V --version Print the program's version number
  20. strings: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 plugin srec symbolsrec verilog tekhex binary ihex
  21. Report bugs to <http://www.sourceware.org/bugzilla/>
  22. alex@alex:~$

可知该指令功能是将文件中的可打印字符串显示出来,默认会以标准输出显示在控制台上(但我一直对什么是“可打印字符串”不理解)。文档内容并不多,不过很多参数都不理解,这里只对指令用法做个记录。

    前面提到,当初是为了识别动态库的版本才用的这个指令。因为最近动态库迭代次数过多,很容易搞混,因此考虑用日期和编译时间作为版本,方便查看和控制。在编译成库的代码中增加一行:

    其中"lib_version"是为了作为tag,方便用strings时进行筛选。对封装的库进行查看:strings xxx.so|grep "lib_version",就可以显示出版本号了。

很多人会把密码或敏感信息直接写死在程序中,其实很容易被strings指令查询出来。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
汉化不求人,自己动手不用愁
GCC 各工具使用简介
ELF Object File Format | nairobi
第六周:使用对象
XE2下有编译指令令STRING编译为ANSISTRING吗?
eclipse在windows下的arm交叉编译环境搭建
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服