Chinaunix首页 | 论坛 | 博客
  • 博客访问: 762579
  • 博文数量: 274
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 862
  • 用 户 组: 普通用户
  • 注册时间: 2015-10-24 15:31
个人简介

不合格的程序猿

文章分类

全部博文(274)

文章存档

2019年(3)

2018年(1)

2017年(4)

2016年(160)

2015年(106)

我的朋友

分类: LINUX

2015-10-24 17:57:38

strings 命令
用途
在对象文件或二进制文件中查找可打印的字符串。 

语法
strings [ -a ] [ - ] [ -o ] [ -t Format ] [ -n Number ] [ -Number ] [ File ... ]

描述

strings 命令在
 对象文件或二进制文件 中查找可打印的字符串。字符串是 4 个或更多可打印字符的任意序列,以换行符或空字符结束。 strings 命令对识别随机对象文件很有用。

标志
-a 或 - 搜索整个文件,而不仅仅是数据段,以寻找可打印的字符串。如果省略这个标志,则 strings 命令只在对象文件的初始化数据空间内寻找。

-n Number 指定最小的字符串长度(除了缺省的 4 个字符以外)。字符串长度的最大值是 4096。这个标志与 -Number 标志相同。
-o 列出文件中每个跟随在其八进制偏移量之后的字符串。这个标志与 -t o 标志相同。
-t Format 列出从文件最开始起,每个跟随在其偏移量之后的字符串。该格式取决于用作 Format 变量的字符。 
d
以十进制写下偏移量。 
o
以八进制写下偏移量。 
x
以十六进制写下偏移量。 
注:当 -o 和 -t Format 标志在一个命令行上多次定义,则最后指定的标志控制 strings 命令的行为。
-Number 指定最小的字符串长度(除了缺省的 4 个字符以外)。字符串长度的最大值是 4096。这个标志与 -n Number 标志相同。
File 要搜索的二进制文件或对象文件。

退出状态
该命令返回以下退出值:
0 表示命令成功运行。
>0 表示出错。

strings 命令显示:

以十六进制写下偏移量,打印文本文件中最小字符串长度大于40的

[czmmiao@czmmiao ~]$ strings -t x -40 /etc/profile 
       10   # System wide environment and startup programs, for login setup 
       50   # Functions and aliases go in /etc/bashrc  
       7b   # It's NOT good idea to change this file unless you know what you 
       bd   # are doing. Much better way is to create custom.sh shell script in
      101  # /etc/profile.d/ to make custom changes to environment. This will 
 
      144  # prevent need for merging in future updates.  

      1c6                if [ "$2" = "after" ] ; then 
      436  if [ "$HISTCONTROL" = "ignorespace" ] ;  
      4b0  then export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL  

以八进制写下偏移量,打印二进制文件2010_12_02.JPG中不少于10个的字符串 

[czmmiao@czmmiao ~]$ strings -t o -n 10 2010_12_02.JPG
   26324 pd2N`G09d3
   43705 KSQEy<)Iu4'
   47750 @(SX9!lF7z
   53461 @(SX9!lF7z


参考至:http://blog.csdn.net/lvhongya/archive/2010/10/27/5970364.aspx

出处:http://czmmiao.iteye.com/blog/911108
作者:czmmiao

阅读(707) | 评论(0) | 转发(0) |
0

上一篇:Ldap ldapsearch

下一篇:cut命令

给主人留下些什么吧!~~