打印文件中的可打印字符串(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 ).
-t --radix={o,d,x} Print the location of the string in base , or
-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 = -bit, S = -bit, {b,l} = -bit, {B,L} = -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- elf32-i386 elf32-iamcu elf32-x86- a.out-i386-linux pei-i386 pei-x86- elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86- pe-bigobj-x86- 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. | grep GLIBC
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.
GLIBC_2.
GLIBC_2.
GLIBC_2.
GLIBC_2.
GLIBC_2.
GLIBC_2.
GLIBC_2.
GLIBC_2.
GLIBC_PRIVATE

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

技巧性极强的strings命令的更多相关文章

  1. 抗干扰性极强非接触式读卡13.56mhz芯片:SI522

    由于智能门锁产品不断地火爆,市场上的不断出现破解的方法.对此中科微联合深圳市动能世纪科技有限公司不断满足市场需求,推出一款抗干扰性极强的13.56mhz芯片. 该芯片出了抗干扰性强以外还直接PIN2P ...

  2. linux中的strings命令简介2

    摘自:http://blog.csdn.net/stpeace/article/details/46641069 linux中的strings命令简介 之前我们聊过linux strings的用法和用 ...

  3. linux中的strings命令简介

    摘自:http://blog.csdn.net/stpeace/article/details/46641069 linux中的strings命令简介 在linux下搞软件开发的朋友, 几乎没有不知道 ...

  4. linux中的strings命令

     strings - print the strings of printable characters in files.            意思是, 打印文件中可打印的字符.  我来补充一下吧 ...

  5. Sort功能极强!

    Sort功能极强! 可以排string:  sort(a.begin(),a.end()); 普通数组 结合结构体 逆序 而且贼快

  6. 用strings命令查看kafka-log内容

    kafka的log内容格式还不没怎么了解,想快速浏览消息内容的话,除了使用它自带的kafka-console-consumer.sh脚本,还可以直接去看log文件本身,不过内容里有部分二进制字符,通过 ...

  7. 用strings命令查看kafka-log内容 过滤二进制编码

    kafka的log内容格式还不没怎么了解,想快速浏览消息内容的话,除了使用它自带的kafka-console-consumer.sh脚本,还可以直接去看log文件本身,不过内容里有部分二进制字符,通过 ...

  8. centos Linux系统日常管理2 tcpdump,tshark,selinux,strings命令, iptables ,crontab,TCP,UDP,ICMP,FTP网络知识 第十五节课

    centos  Linux系统日常管理2  tcpdump,tshark,selinux,strings命令, iptables ,crontab,TCP,UDP,ICMP,FTP网络知识 第十五节课 ...

  9. strings命令的实现 2014-06-02 00:17 355人阅读 评论(0) 收藏

    本程序实现从文件中提取连续4个以上的可打印字符.模仿linux中string命令 #include <stdio.h> #include<stdlib.h> #include ...

随机推荐

  1. 项目管理干货——项目管理入门级书籍(附赠5G项目管理书籍电子版)

    各位项目经理我们都是在不断的学习和自我学习中不断成长的,所以我们需要多看书,才能做好一个项目经理,但是很多人,在挑选书籍的时候犯了难,今天我就把自己学习的时候看的那些书单整理出来,大家有需要的可以留言 ...

  2. R语言实现两文件对应行列字符替换(解决正负链统一的问题)

    假设存在文件file1.xlsx,其内容如下: 存在文件file2.xlsx,其内容如下: 现在我想从第七列开始,将file2所有的字符替换成file1一样的,即第七.八.九.十列不需要改变,因为fi ...

  3. JS事件(三)部分常用事件

    1.滚动条事件scroll EventUtil.addHandler(window,"scroll",function(event){ if(document.compatMode ...

  4. JavaBean+Servlet 开发时,JavaBean 编写问题

    在开发 JavaBean 时,遇见一个问题: *****  表单字段为空,提交时出现 nullPointerException 异常:  表单字段不为空,提交正常. 使用 JavaBean ,JSP页 ...

  5. Qt ------ QDir 路径

    QDir::currentPath() 获取当前路径 QDir::toNativeSeparators 把windows下的路径转换为Qt可以识别的路径,如"C:/Users/Adminis ...

  6. Linux中sed的用法实践

    Linux中sed的用法实践 参考资料:https://www.cnblogs.com/emanlee/archive/2013/09/07/3307642.html http://www.fn139 ...

  7. Java实现单词树(trie)

    package com.shundong.utils; import java.util.ArrayList; import java.util.Iterator; import java.util. ...

  8. Hadoop序列化-流量汇总案例

    Hadoop序列化案例-流量汇总需求 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Hadoop序列化 1>.为什么要序列化 一般来说,“活的”对象只生存在内存里,关机断 ...

  9. Nginx简单手册

    Nginx 变量 变量名 注解 $arg_name 请求中的的参数名,即“?”后面的arg_name=arg_value形式的arg_name $args  请求中的参数值 $binary_remot ...

  10. SSH框架新线程下执行数据库持久化时 No Session found for current thread

    架构:SSH框架 问题:多线程下的持久化操作 异常No Session found for current thread出现环境: SSH框架,采用声明式事务, 通过sessionFactory.ge ...