路由器逆向分析------binwalk工具的安装
本文博客链接:http://blog.csdn.net/qq1084283172/article/details/65441110
一、binwalk工具运行支持的平台
binwalk工具安装支持的平台的官方参考地址:https://github.com/devttys0/binwalk/wiki/Supported-Platforms
Operating System | Core Support | Optional Feature Support | Ease of Installation |
---|---|---|---|
Linux | Excellent | Excellent | Very easy |
OSX | Excellent | Good | Very easy |
FreeBSD | Experimental | Unknown | Very easy |
Windows | Experimental | Poor | Very easy |
在Linux下使用binwalk工具效果最佳,坑最少;推荐在ubuntu系统下安装和使用binwalk工具。
二、binwalk工具的简单安装
binwalk工具简单安装的官方参考地址:https://github.com/devttys0/binwalk
Installation
Binwalk follows the standard Python installation procedure:
$ sudo python setup.py install
If you're running Python 2.x, you'll also want to install the Python lzma module:
$ sudo apt-get install python-lzma
在binwalk工具的简单安装之前,需要在ubuntu系统上安装好python,binwalk工具简单安装的命令过程如下:
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf git$ git clone https://github.com/devttys0/binwalk
$ cd binwalk
$ sudo python setup.py install# 如果安装的是 python 2.x,还需要安装python-lzma模块
$ sudo apt-get install python-lzma
binwalk工具的详细使用帮助说明:
Binwalk v2.1.2b
Craig Heffner, http://www.binwalk.orgUsage: binwalk [OPTIONS] [FILE1] [FILE2] [FILE3] ...Disassembly Scan Options:-Y, --disasm Identify the CPU architecture of a file using the capstone disassembler-T, --minsn=<int> Minimum number of consecutive instructions to be considered valid (default: 500)-k, --continue Don't stop at the first matchSignature Scan Options:-B, --signature Scan target file(s) for common file signatures-R, --raw=<str> Scan target file(s) for the specified sequence of bytes-A, --opcodes Scan target file(s) for common executable opcode signatures-m, --magic=<file> Specify a custom magic file to use-b, --dumb Disable smart signature keywords-I, --invalid Show results marked as invalid-x, --exclude=<str> Exclude results that match <str>-y, --include=<str> Only show results that match <str>Extraction Options:-e, --extract Automatically extract known file types-D, --dd=<type:ext:cmd> Extract <type> signatures, give the files an extension of <ext>, and execute <cmd>-M, --matryoshka Recursively scan extracted files-d, --depth=<int> Limit matryoshka recursion depth (default: 8 levels deep)-C, --directory=<str> Extract files/folders to a custom directory (default: current working directory)-j, --size=<int> Limit the size of each extracted file-n, --count=<int> Limit the number of extracted files-r, --rm Delete carved files after extraction-z, --carve Carve data from files, but don't execute extraction utilitiesEntropy Analysis Options:-E, --entropy Calculate file entropy-F, --fast Use faster, but less detailed, entropy analysis-J, --save Save plot as a PNG-Q, --nlegend Omit the legend from the entropy plot graph-N, --nplot Do not generate an entropy plot graph-H, --high=<float> Set the rising edge entropy trigger threshold (default: 0.95)-L, --low=<float> Set the falling edge entropy trigger threshold (default: 0.85)Raw Compression Options:-X, --deflate Scan for raw deflate compression streams-Z, --lzma Scan for raw LZMA compression streams-P, --partial Perform a superficial, but faster, scan-S, --stop Stop after the first resultBinary Diffing Options:-W, --hexdump Perform a hexdump / diff of a file or files-G, --green Only show lines containing bytes that are the same among all files-i, --red Only show lines containing bytes that are different among all files-U, --blue Only show lines containing bytes that are different among some files-w, --terse Diff all files, but only display a hex dump of the first fileGeneral Options:-l, --length=<int> Number of bytes to scan-o, --offset=<int> Start scan at this file offset-O, --base=<int> Add a base address to all printed offsets-K, --block=<int> Set file block size-g, --swap=<int> Reverse every n bytes before scanning-f, --log=<file> Log results to file-c, --csv Log results to file in CSV format-t, --term Format output to fit the terminal window-q, --quiet Suppress output to stdout-v, --verbose Enable verbose output-h, --help Show help output-a, --finclude=<str> Only scan files whose names match this regex-p, --fexclude=<str> Do not scan files whose names match this regex-s, --status=<int> Enable the status server on the specified port
binwalk的简单安装功能有限,只能将对设备的固件进行文件组成格式的分析和设备的文件系统进行提取,不能对提取后的设备文件系统进行解压处理。要binwalk工具能对提取后的设备文件系统进行解压还需要安装binwalk工具需要的依赖库和组件工具。
使用binwalk工具对设备的固件进行文件组成格式的分析(以路由器固件的分析为例):
$ binwalk firmware.bin | head
使用binwalk工具对设备的固件文件系统进行提取(以路由器固件的分析为例):
$ binwalk -e firmware.bin
# 或者
$ binwalk -Me firmware.bin
文件系统的提取结果如图:
从上面的提取结果来看,binwalk虽然对路由器固件的文件系统squashfs提取成功,但是文件系统squashfs解压却失败,主要的原因是因为binwalk工具的安装不完整,后面会提到binwalk工具的完整安装。
当然了,binwalk还有一种更简单的直接安装方式:
$ sudo apt-get update
$ sudo apt-get install binwalk
参考网址:https://www.howtoinstall.co/en/ubuntu/trusty/binwalk
三、binwalk工具的完整安装
binwalk工具的完整安装可以参考官方的网址:https://github.com/devttys0/binwalk/blob/master/INSTALL.md
Before You Start
Binwalk supports Python 2.7 - 3.x. Although most systems have Python2.7 set as their default Python interpreter, binwalk does run faster in Python3. Installation procedures for both are provided below.
Installation
Installation follows the typical Python installation procedure:
# Python2.7
$ sudo python setup.py install
# Python3.x
$ sudo python3 setup.py install
NOTE: Older versions of binwalk (e.g., v1.0) are not compatible with the latest version of binwalk. It is strongly recommended that you uninstall any existing binwalk installations before installing the latest version in order to avoid API conflicts.
Dependencies
Besides a Python interpreter, there are no installation dependencies for binwalk. All dependencies are optional run-time dependencies, and unless otherwise specified, are available from most Linux package managers.
Although all binwalk run-time dependencies are optional, the python-lzma
module is highly recommended for improving the reliability of signature scans. This module is included by default in Python3, but must be installed separately for Python2.7:
$ sudo apt-get install python-lzma
Binwalk uses the pycrypto
library to decrypt some known encrypted firmware images:
# Python2.7
$ sudo apt-get install python-crypto
# Python3.x
$ sudo apt-get install python3-crypto
Binwalk uses pyqtgraph to generate graphs and visualizations, which requires the following:
# Python2.7
$ sudo apt-get install libqt4-opengl python-opengl python-qt4 python-qt4-gl python-numpy python-scipy python-pip
$ sudo pip install pyqtgraph
# Python3.x
$ sudo apt-get install libqt4-opengl python3-opengl python3-pyqt4 python3-pyqt4.qtopengl python3-numpy python3-scipy python3-pip
$ sudo pip3 install pyqtgraph
Binwalk's --disasm
option requires the Capstone disassembly framework and its corresponding Python bindings:
# Python2.7
$ sudo apt-get install python-pip
$ sudo pip install capstone
# Python3.x
$ sudo apt-get install python3-pip
$ sudo pip3 install capstone
Binwalk relies on multiple external utilties in order to automatically extract/decompress files and data:
# Install standard extraction utilities
$ sudo apt-get install mtd-utils gzip bzip2 tar arj lhasa p7zip p7zip-full cabextract cramfsprogs cramfsswap squashfs-tools
# Install sasquatch to extract non-standard SquashFS images
$ sudo apt-get install zlib1g-dev liblzma-dev liblzo2-dev
$ git clone https://github.com/devttys0/sasquatch
$ (cd sasquatch && ./build.sh)
# Install jefferson to extract JFFS2 file systems
$ sudo pip install cstruct
$ git clone https://github.com/sviehb/jefferson
$ (cd jefferson && sudo python setup.py install)
# Install ubi_reader to extract UBIFS file systems
$ sudo apt-get install liblzo2-dev python-lzo
$ git clone https://github.com/jrspruitt/ubi_reader
$ (cd ubi_reader && sudo python setup.py install)
# Install yaffshiv to extract YAFFS file systems
$ git clone https://github.com/devttys0/yaffshiv
$ (cd yaffshiv && sudo python setup.py install)
# Install unstuff (closed source) to extract StuffIt archive files
$ wget -O - http://my.smithmicro.com/downloads/files/stuffit520.611linux-i386.tar.gz | tar -zxv
$ sudo cp bin/unstuff /usr/local/bin/
Note that for Debian/Ubuntu users, all of the above dependencies can be installed automatically using the included deps.sh
script:
$ sudo ./deps.sh
binwalk工具的快速安装和使用方式,参考官方的链接:https://github.com/devttys0/binwalk/wiki/Quick-Start-Guide
Quick Start Guide
binwalk工具完整安装方式的整理,以python 2.7的安装为例,python 3.x的安装类似。
1.最懒的方式,自动安装依赖库和组件工具。
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf git$ git clone https://github.com/devttys0/binwalk.git
$ cd binwalk# python2.7安装
$ sudo python setup.py install# 自动安装依赖库文件
$ sudo ./deps.sh
2.快速安装方式,自动安装依赖库和组件工具。
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf git# https://github.com/devttys0/binwalk/wiki/Quick-Start-Guide
$ wget https://github.com/devttys0/binwalk/archive/master.zip
$ unzip master.zip$ (cd binwalk-master && sudo python setup.py uninstall && sudo python setup.py install)# 自动安装依赖库文件和工具组件
$ sudo ./binwalk-master/deps.sh
3.有选择性的安装binwalk的依赖库文件和组件工具。
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf git# https://github.com/devttys0/binwalk/blob/master/INSTALL.md
$ git clone https://github.com/devttys0/binwalk.git
$ cd binwalk# python2.7安装
$ sudo python setup.py install# python2.7手动安装依赖库
$ sudo apt-get install python-lzma$ sudo apt-get install python-crypto$ sudo apt-get install libqt4-opengl python-opengl python-qt4 python-qt4-gl python-numpy python-scipy python-pip
$ sudo pip install pyqtgraph$ sudo apt-get install python-pip
$ sudo pip install capstone# Install standard extraction utilities(必选)
$ sudo apt-get install mtd-utils gzip bzip2 tar arj lhasa p7zip p7zip-full cabextract cramfsprogs cramfsswap squashfs-tools# Install sasquatch to extract non-standard SquashFS images(必选)
$ sudo apt-get install zlib1g-dev liblzma-dev liblzo2-dev
$ git clone https://github.com/devttys0/sasquatch
$ (cd sasquatch && ./build.sh)# Install jefferson to extract JFFS2 file systems(可选)
$ sudo pip install cstruct
$ git clone https://github.com/sviehb/jefferson
$ (cd jefferson && sudo python setup.py install)# Install ubi_reader to extract UBIFS file systems(可选)
$ sudo apt-get install liblzo2-dev python-lzo
$ git clone https://github.com/jrspruitt/ubi_reader
$ (cd ubi_reader && sudo python setup.py install)# Install yaffshiv to extract YAFFS file systems(可选)
$ git clone https://github.com/devttys0/yaffshiv
$ (cd yaffshiv && sudo python setup.py install)# Install unstuff (closed source) to extract StuffIt archive files(可选)
$ wget -O - http://my.smithmicro.com/downloads/files/stuffit520.611linux-i386.tar.gz | tar -zxv
$ sudo cp bin/unstuff /usr/local/bin/
四、binwalk IDA plugin插件工具的安装
binwalk IDA plugin插件工具的安装说明可以参考官方网址:https://github.com/devttys0/binwalk/blob/master/INSTALL.md
Installing the IDA Plugin
If IDA is installed on your system, you may optionally install the binwalk IDA plugin:
$ python setup.py idainstall --idadir=/home/user/ida
Likewise, the binwalk IDA plugin can be uninstalled:
$ python setup.py idauninstall --idadir=/home/user/ida
Usage
Once installed, there will be two new menu options in IDA's Search
drop-down menu list:
- binwalk signatures - Scans the loaded IDB for file signatures
- binwalk opcodes - Scans the loaded IDB for common opcode signatures
Results are printed to IDA's output window:
五、binwalk工具的卸载
Uninstalling Binwalk
If binwalk has been installed to a standard system location (e.g., via setup.py install
), it can be removed by running:
# Python2.7
$ sudo python setup.py uninstall
# Python3
$ sudo python3 setup.py uninstall
Note that this does not remove any of the manually installed dependencies.
路由器逆向分析------binwalk工具的安装相关推荐
- 路由器逆向分析------binwalk工具的详细使用说明
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/66971242 一.binwalk工具的基本用法介绍 1.获取帮助信息 $ binw ...
- 路由器逆向分析------在Linux上安装IDA Pro
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/69665905 01.在Linux系统上安装Linux版本的IDA Pro Linu ...
- Binwalk工具的安装
https://blog.csdn.net/QQ1084283172/article/details/65441110 一.binwalk工具运行支持的平台 binwalk工具安装支持的平台的官方参考 ...
- 路由器逆向分析------Running Debian MIPS Linux in QEMU
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/70176583 下面的文章内容主要参考英文博客<Running Debian ...
- 路由器逆向分析------在QEMU MIPS虚拟机上运行MIPS程序(ssh方式)
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/69652258 在QEMU MIPS虚拟机上运行MIPS程序--SSH方式 有关在u ...
- 路由器逆向分析------MIPS系统网络的配置(QEMU)
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/69378333 MIPS系统网络的配置 使用QEMU 模拟正在运行的MIPS系统并 ...
- Sat-Hacking(4):Starlink路由器逆向分析-上篇
在本篇文章中,我们将探讨 SpaceX Starlink 路由器的逆向分析过程.Starlink 是 SpaceX 推出的一项革命性的卫星互联网服务,旨在为全球偏远地区提供高速.低延迟的互联网连接.为 ...
- 路由器逆向分析------路由器固件分析和动态调试环境搭建简述
本文博客地址:http://blog.csdn.net/qq1084283172/article/details/70140865 01.路由器固件分析和动态调试环境搭建简述的原文 <Emula ...
- 微信逆向分析(四)——逆向分析的工具
前言 老话,工欲善其事,必先利其器.这篇聊聊逆向分析用到的工具.不聊工具细节,自行百度学习.重要的是理清:使用工具,是为了解决什么问题. 工具 1.CE 找偏移的方法中聊到,最直接就是在内存里面搜索. ...
最新文章
- 我心中的核心组件(可插拔的AOP)~第十三回 实现AOP的拦截组件Unity.Interception...
- 记一次OutOfMemory定位过程
- Uptime Tier Ⅳ标准数据中心的柴发油路设计关键点
- window powershell 替换文本的字符
- 那些年,我们追过的java8
- android最新版本 note8,三星Note8官方国行版安卓9固件rom升级包:CHC-N9500ZCS4DSF5
- 关于SQL Tuning的知识体系
- 边缘计算框架_【北大成果】一种集成多组网协议多边缘计算框架的边缘计算处理平台...
- isc dhcp_ISC的完整形式是什么?
- 前端学习(590):调试javascript的流程
- [ASP.NET]NTKO插件使用常见问题
- idea类生成序列号
- SQL Server 加密案例解析
- 可重定位的ELF文件
- bugku 杂项 部分
- 什么是量子加密(二)
- 图像纹理特征总体简述
- Flutter实现app自动升级
- Badboy 录制脚本提示“当前页面的脚本发生错误”解决
- kibana异常 License information from the X-Pack plugin could not be obtained from Elasticsearch
热门文章
- [无线网络]为什么WiMAX没有普及
- 自媒体未来的发展趋势将走向哪里?
- 喝普洱熟茶时的八大禁忌您知道吗?
- jwt解析token报错:Signed Claims JWSs are not supported.
- 【汇正财经】有色金属,小金属价格新高
- U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization
- WPF绑定与RelativeSource结合使用
- Android屏幕旋转设置
- 可怕!数据库竟然打破安迪-比尔定律
- 四种常见排序算法的对比和总结 插入排序、归并排序、快速排序、堆排序