zoukankan      html  css  js  c++  java
  • 技巧性极强的strings命令

    打印文件中的可打印字符串(print the strings of printable characters in files)。常用来在二进制文件中查找字符串,与grep配合使用。strings命令输出的字符串长度为4个或4个以上的,长度小于4的字符串将不予打印,我们可以通过-n参数调整,strings -n 2 filename

    strings命令是在对象文件或者二进制文件中查找可打印的字符串,有很多的用途,例如一个用法就是在编译的so中定义字符串常量作为动态库的版本号,然后就可以使用strings+grep 组合命令查看当前编译的so的版本号了。输入strings -h查看strings命令的用法:

    用法:strings [选项] [文件]
     打印 [文件] (默认为标准输入) 中可打印的字符串
     选项为:
      -a - --all                Scan the entire file, not just the data section [default]
      -d --data                 Only scan the data sections in the file
      -f --print-file-name      Print the name of the file before each string
      -n --bytes=[number]       Locate & print any NUL-terminated sequence of at
      -<number>                   least [number] characters (default 4).
      -t --radix={o,d,x}        Print the location of the string in base 8, 10 or 16
      -w --include-all-whitespace Include all whitespace as valid string characters
      -o                        An alias for --radix=o
      -T --target=<BFDNAME>     Specify the binary file format
      -e --encoding={s,S,b,l,B,L} Select character size and endianness:
                                s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit
      -s --output-separator=<string> String used to separate strings in output.
      @<file>                   Read options from <file>
      -h --help                 Display this information
      -v -V --version           Print the program's version number
    strings:支持的目标: 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
    将 bug 报告到 <http://www.sourceware.org/bugzilla/>

    在libc.so.6是c标准库,而这个标准库的制作者为了让库的使用者知道该库兼容哪些版本的标准库,就在这个库中定义了一些字符串常量,比如我的系统是centos6.8-x64,我的c标准库在/lib64/libc.so.6,可以直接运行该标准库文件,或者使用ldd --version查看当前版本,以下显示当前版本为2.12

    而使用strings /lib64/libc.so.6 | grep GLIBC,可查看向下兼容的版本:

    [root@localhost ~]# strings /lib64/libc.so.6 | grep GLIBC
    GLIBC_2.2.5
    GLIBC_2.2.6
    GLIBC_2.3
    GLIBC_2.3.2
    GLIBC_2.3.3
    GLIBC_2.3.4
    GLIBC_2.4
    GLIBC_2.5
    GLIBC_2.6
    GLIBC_2.7
    GLIBC_2.8
    GLIBC_2.9
    GLIBC_2.10
    GLIBC_2.11
    GLIBC_2.12
    GLIBC_PRIVATE

    https://blog.csdn.net/stpeace/article/details/46641069 

  • 相关阅读:
    原!!如何将多个复杂查询整合成一个查询,并作为一个对象的各个字段输出
    转!!mysql order by 中文排序
    mybatis 模糊查询 like
    转!!log4j基础
    CI框架下的PHP增删改查总结
    tp5中url使用js变量传参方法
    一个用户管理的ci框架的小demo--转载
    CI框架入门教程
    PHP的CI框架流程基本熟悉
    CI
  • 原文地址:https://www.cnblogs.com/saolv/p/9684066.html
Copyright © 2011-2022 走看看