Binwalk v1.3.0 beta



Usage: binwalk [OPTIONS] [FILE1] [FILE2] [FILE3] ...

Signature Analysis:
    -B, --binwalk                 Perform a file signature scan (default)
    -R, --raw-bytes=<string>      Search for a custom signature
    -A, --opcodes                 Scan for executable code signatures
    -C, --cast                    Cast file contents as various data types
    -m, --magic=<file>            Specify an alternate magic file to use
    -x, --exclude=<filter>        Exclude matches that have <filter> in their description
    -y, --include=<filter>        Only search for matches that have <filter> in their description
    -I, --show-invalid            Show results marked as invalid
    -T, --ignore-time-skew        Do not show results that have timestamps more than 1 year in the future
    -k, --keep-going              Show all matching results at a given offset, not just the first one
    -b, --dumb                    Disable smart signature keywords

Strings Analysis:
    -S, --strings                 Scan for ASCII strings (may be combined with -B, -R, -A, or -E)
    -s, --strlen=<n>              Set the minimum string length to search for (default: 3)

Entropy Analysis:
    -E, --entropy                 Plot file entropy (may be combined with -B, -R, -A, or -S)
    -H, --heuristic               Identify unknown compression/encryption based on entropy heuristics (implies -E)
    -K, --block=<int>             Set the block size for entropy analysis (default: 1024)
    -a, --gzip                    Use gzip compression ratios to measure entropy
    -N, --no-plot                 Do not generate an entropy plot graph
    -F, --marker=<offset:name>    Add a marker to the entropy plot graph
    -Q, --no-legend               Omit the legend from the entropy plot graph
    -J, --save-plot               Save plot as a PNG (implied if multiple files are specified)

Binary Visualization:
    -3, --3D                      Generate a 3D binary visualization
    -2, --2D                      Project data points onto 3D cube walls only
    -Z, --max-points              Set the maximum number of plotted data points (defulat: 25000)
    -V, --show-grids              Display the x-y-z grids in the resulting plot

Binary Diffing:
    -W, --diff                    Hexdump / diff the specified files
    -K, --block=<int>             Number of bytes to display per line (default: 16)
    -G, --green                   Only show hex dump lines that contain bytes which were the same in all files
    -i, --red                     Only show hex dump lines that contain bytes which were different in all files
    -U, --blue                    Only show hex dump lines that contain bytes which were different in some files
    -w, --terse                   Diff all files, but only display a hex dump of the first file

Extraction Options:
    -D, --dd=<type:ext:cmd>       Extract <type> signatures, give the files an extension of <ext>, and execute <cmd>
    -e, --extract=[file]          Automatically extract known file types; load rules from file, if specified
    -M, --matryoshka=[n]          Recursively scan extracted files, up to n levels deep (8 levels of recursion is the default)
    -j, --max-size=<int>          Limit extracted file sizes (default: no limit)
    -r, --rm                      Cleanup extracted files and zero-size files
    -d, --honor-footers           Only extract files up to their corresponding footer signatures
    -z, --carve                   Carve data from files, but don't execute extraction utilities (implies -d)
    -P, --rehash                  Recursively diff data extracted from FILE1 with the data extracted from all other files.

Plugin Options:
    -X, --disable-plugin=<name>   Disable a plugin by name
    -Y, --enable-plugin=<name>    Enable a plugin by name
    -p, --disable-plugins         Do not load any binwalk plugins
    -L, --list-plugins            List all user and system plugins by name

General Options:
    -o, --offset=<int>            Start scan at this file offset
    -l, --length=<int>            Number of bytes to scan
    -g, --grep=<text>             Grep results for the specified text
    -f, --file=<file>             Log results to file
    -c, --csv                     Log results to file in csv format
    -O, --skip-unopened           Ignore file open errors and process only the files that can be opened
    -t, --term                    Format output to fit the terminal window
    -q, --quiet                   Suppress output to stdout
    -v, --verbose                 Be verbose (specify twice for very verbose)
    -u, --update                  Update magic signature files
    -?, --examples                Show example usage
    -h, --help                    Show help output

Binwalk是一个固件的分析工具,旨在协助研究人员对固件非分析,提取及逆向工程用处。简单易用,完全自动化脚本,并通过自定义签名,提取规则和插件模块,还重要一点的是可以轻松地扩展。

最简单使用方法很直接; 提供固件文件路径和文件名即可:

$ binwalk firmware . bin

如果单单基于签名匹配的话有些文件类型是无法准确的识别到.

所以检测这些类型签名的文件需要特定插件的配合(通过插件来实现),如果不启用将大大增加扫描时间和占用大量内存

例如,扫描zlib压缩包的时候,得需使用zlib的插件:

$ binwalk -- enable - plugin = zlib firmware . bin

过滤功能

包含过滤器

-y选项仅包括指定的搜索文本匹配的结果。搜索字符串(文本)应当使用小写,包括正则表达式,并且可以指定多个-Y选项。 下列搜索结果只包含文本“文件系统”中搜索出来的结果。(也就说使用了 filesystem的Y选项的话结果中只包含文本字符结果)

$ binwalk - y filesystem firmware . bin

排除过滤器

-x选项是排除搜索结果中的指定符合规则的文本(或者字符串)。 搜索字符串(文本)应当使用小写,包括正则表达式,并且可以指定多个-X选项。 下列例子中搜索时将排除“jffs2”字符串:

$ binwalk - x jffs2 firmware . bin

高级过滤器

可以将包含和排除过滤两功能结合使用:

例子:下列搜索结果即包含文本“文件系统”中搜索出来的结果又排除jffs2字符串结果。

$ binwalk - y filesystem - x jffs2 firmware . bin

提取文件

手动提取文件

Binwalk可以提取数据,发现在目标文件中指定提取规则使用 – dd选项。用于提取指定规则的格式是:

<type> : <extension> [: <command> ]

从哪里提取:

  • type 是签名中描述的小写字符串(支持正则表达式)
  • extension 是将数据保存到磁盘时使用的文件扩展名
  • command 是当数据已保存到磁盘后可选的命令执行语句

 默认情况下,除非备用文件名中指定签名情况意外,文件名是十六进制偏移签名被发现。

下面的例子演示如何使用 – dd选项,将提取任何包含字符串’zip归档文件扩展名的’zip’的签名,并随后执行“解压缩”命令指定提取规则。可指定多个–dd选项:

$ binwalk -- dd = 'zip archive:zip:unzip %e' firmware . bin

要注意占位符的使用 如:“%e’”: 此占位符将被替换为所提取的文件的相对路径时,将执行命令。

自动化(自动)提取

-e选项可以用来执行自动数据提取的基础上提取规则中指定的默认的extract.conf文件:

$ binwalk - e firmware . bin

- 提取选项的工作原理相同,除了你必须指定一个自定义提取规则文件的路径:

$ binwalk - e firmware . bin$ binwalk -- extract =./ my_extract . conf firmware . bin

递归提取

很多次,提取的数据可能需要进一步binwalk的分析。为了帮助自动化,binwalk可以递归扫描提取的数据和由外部减压或提取工具创建的文件指定-M选项和-e选项一起使用:

$ binwalk - Me firmware . bin

请注意,-M选项将提取的文件8层递归,且忽略外部提取工具可以创建任何目录。

操作码

Binwalk中使用A选项时可以扫描通常与功能相关联的各种框架操作码
$ binwalk - A firmware . bin

转换功能

binwalk使用 -C 选项来完成多个不用文件类型转换; 通常最好是使用-l选项来限制这种扫描:

$ binwalk - l 32 - C firmware . bin

比较功能

Binwalk可以生成一个或多个文件的十六进制转储和差别。在文件当中相同字节的是绿色显示,不同的是红色显示,蓝色表示只是有些文件当中的不同部分。

$ binwalk - W firmware1 . bin firmware2 . bin firmware3 . bin

字符串

除了上述基于签名的扫描,binwalk可以对目标文件进行一个智能的字符串分析,虽然不是完全替代的Unix strings一样强大功能,但是binwalk通过应用一些非常简单的验证规则筛选出最“垃圾”的字符串,和忽略一些无顺序的数据块

$ binwalk - S firmware . bin

熵分析

Binwalk 对目标文件可以进行熵分析目标文件,生成原始的熵数据和/或积表示的曲线图的数据:

$ binwalk - E firmware . bin

签名或字符串的分析,以及可以结合熵分析。例如,下面的命令将扫描目标文件,可执行代码和熵图上叠加的扫描结果:

$ binwalk - AE firmware . bin

启发(或者引导式)

Binwalk的启发式扫描作为加密或压缩的高熵的数据块进行分类的尝试。虽然这种类型的扫描是不是100%准确。

在一般情况下,压缩的数据或已使用弱加密算法将有一个整体的高熵的加密,但小有出现断块低熵的数据。已具有较强的熵算法加密的数据不会有这些小块的低熵的数据:

$ binwalk -- heuristic firmware . binDECIMAL HEX HEURISTIC ANALYSIS ------------------------------------------------------------------------------------------------------------------- 0 0x0 Compressed / moderate entropy data , 245 low entropy blocks 283648 0x45400 Compressed / moderate entropy data , 219 low entropy blocks 360448 0x58000 Compressed / moderate entropy data , 160 low entropy blocks 371712 0x5AC00 Compressed / moderate entropy data , 139 low entropy blocks 381952 0x5D400 Compressed / moderate entropy data , 57 low entropy blocks 384000 0x5DC00 Compressed / moderate entropy data , 40 low entropy blocks

请注意,此扫描需要两个周期(一个用于初始熵分析,以及第二更紧密的启发式分析),这需要一定时间来完成的,尤其是目标文件特别打的话花费更多的时间。

插件功能

插件列表

使用 –list-plugins选项能获得可使用的binwalk插件的名称和属性列表:

$ binwalk -- list - plugins

启用插件功能

一些插件在默认情况下是禁用的。这些插件可以启用时用该选项 –enable-plugin选项

$ binwalk -- enable - plugin = foo firmware . bin

禁用插件功能

一些插件在默认情况下是启用的。这些插件可以禁用时用该选项 –diable-plugin选项

$ binwalk -- disable - plugin = foo firmware . bin

或者,所有的插件可以禁用 ,使用该选项:–disable-plugins 选项:

$ binwalk -- disable - plugins firmware . bin

日志记录功能

Binwalk日志输出通常是很大,所以它往往是文件保存方式记录

-f选项允许你指定一个日志文件。需要注意的是,如果没有指定-Q选项的话结果会打印到stdout以及日志文件。

$ binwalk - f binwalk . log firmware . bin

日志文件可以CSV格式保存

$ binwalk - f binwalk . log -- csv firmware . bin

升级功能

通过 magic files和配置文件,加上使用 -u选项binwalk依靠svn check-in功能轻松升级到最新版本(需要root权限来更新)

$ sudo binwalk - u 如果使用http代理功能,在环境变量中设置http_proxy。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值