firmware-mod-kit工具安装和使用说明

2023-11-19

一、firmware-mod-kit工具的安装


firmware-mod-kit工具的功能和binwalk工具的类似,其实firmware-mod-kit工具在功能上有调用binwalk工具提供的功能以及其他的固件解包工具的整合。下载firmware-mod-kit工具的源码进入到src目录下就能够看到firmware-mod-kit工具整合了那些固件提取和文件系统解压的工具。firmware-mod-kit工具的功能有固件文件的解包和打包、固件提取文件系统的解压和压缩、DD-WRT Web Pages的修改等,在每个整合的固件分析工具的源码文件夹里都有相关的使用说明。




1.在ubuntu系统上安装firmware-mod-kit工具之前需要先安装需要的依赖库文件。

具体可以参考firmware-mod-kit工具的官方说明文档:https://code.google.com/archive/p/firmware-mod-kit/wikis/Documentation.wiki



[cpp]  view plain  copy
  1. # For Ubuntu 需要安装的依赖库文件  
  2. $ sudo apt-get install git build-essential zlib1g-dev liblzma-dev python-magic  

2.firmware-mod-kit工具的下载和安装.

firmware-mod-kit工具的github源码下载地址:https://github.com/mirror/firmware-mod-kit

[cpp]  view plain  copy
  1. git clone https://github.com/mirror/firmware-mod-kit.git  
  2.   
  3. # 进入源码目录  
  4. cd firmware-mod-kit/src  
  5.   
  6. # 执行configure文件生成Makefile文件然后make编译生成可执行文件  
  7. ./configure && make  

3.firmware-mod-kit工具官方的详细说明教程

firmware-mod-kit工具官方详细说明教程的参考网址为:https://bitsum.com//firmware_mod_kit.htm,该网页中详细的说明了firmware-mod-kit工具运行支持的平台,整合的固件解包和分析的工具、支持分析的路由器的固件型号以及使用的命令行参数的说明。


4.设备固件分析的讨论

有关路由器等设备固件分析讨论的论坛:https://forum.bitsum.com/forum/index.php/board,12.html,该论坛里有很多的有关固件提取、解压、修改、工具交流的信息。



二、firmware-mod-kit工具的使用说明


1.firmware-mod-kit工具的官方功能描述(有些功能去掉了)





2.firmware-mod-kit工具提供的功能对应的脚本.



3.firmware-mod-kit工具的功能简单介绍

3.1.解包固件提取内核和文件系统


The Firmware Working Directory

The Firmware Mod Kit uses a 'hard coded' working directory of 'fmk'. The extraction script extracts to this folder, and the rebuild script rebuilds from this folder. Allowance of alternate working directories is supported for some operations, but not all. We'll be expanding that in the future. For now, if you have multiple working directories, we suggest you rename the ones you're not currently operating on.

Extracting Firmware

Automated firmware extraction typically works with most firmware images that employ uImage/TRX firmware headers and use SquashFS or CramFS file systems. Currently, extract-firmware.sh is the preferred method of extraction as it supports more firmware types than the older old-extract.sh script. However, old-extract.sh is still included and works with many firmware formats.

Usage for both extract-firmware.sh and extract_firmware.sh is straight forward:

$ ./extract-firmware.sh firmware.bin

By default, output from extract-firmware.sh will be located in the 'fmk' directory, while old-extract.sh will place extracted data into the specified working directory.


3.2.重打包解包的内核和文件系统重建固件文件


Re-Building Firmware

Which build script to use is dependant on which extraction script was used. If you extracted a firmware image with extract-firmware.sh, then you must use build-firmware.sh to re-build it. Likewise, if old-extract.sh was used, then old-build.sh must be invoked when re-building an image:

$ ./build-firmware.sh [-nopad] [-min]

The new firmware generated by build-firmware.sh will be located at 'fmk/new-firmware.bin', while old-build.sh will generate firmware images in several different formats and save them in the specified output directory.

The optional -nopad switch will instruct build-firmware.sh to NOT pad the firmware up to its original size.

The optional -minswitch will use the maximum squashfs block size of 1MB. This will decrease the firmware image size at the cost of additional CPU and RAM resources utilized on the target device. Do not use this switch unless you must. This is a very large block size for embedded systems. The original firmware squashfs block size is preserved on rebuild, and the original block size should be the one used unless you are sure you know what you're doing. Too large a block size may appear to work fine, but runtime performance of the firmware may suffer in all or some loads.


3.3.修改 DD-WRT Web Pages 面


Modifying DD-WRT Web Pages

One very unique feature of the Firmware Mod Kit is its ability to extract and rebuild files from the DD-WRT Web GUI. This is automated by the ddwrt-gui-extract.sh and ddwrt-gui-restore.sh scripts.

Once you have extracted a DD-WRT firmware image using extract-firmwware.sh, you can extract the Web files by running:

$ ./ddwrt-gui-extract.sh

This will create a directory named 'www' and extract the Web files there. You may modify the files any way you like, but you cannot add or delete files.

When you are finished editing, you can rebuild the Web files by running:

$ ./ddwrt-gui-rebuild.sh


3.4.解压cpio、cramfs、squashfs格式的文件系统

当然了,在firmware-mod-kit工具的源码文件夹里仔细看看,能发现cpio、cramfs、squashfs格式的文件系统的压缩工具。



3.5.使用firmware-mod-kit工具修改设备固件然后重打包

Reverting to a vendor firmware

Sometimes you'll enthusiastically flash a third-party firmware like Gargoyle or DD-WRT only to discover it lacks features you need, doesn't perform as well as the vendor firmware, or has functional problems. In this situation, you might find yourself wanting to go back to the vendor firmware, but have no way to do so!

Here's how the Firmware Mod Kit can help you revert to a vendor firmware. The process is this:

  1. Extract vendor firmware. Then rename the 'fmk' directory.
  2. Extract third-party 'upgrade' firmware (e.g. Gargoyle-sysupgrade)
  3. Replace extracted third-party firmware's rootfs and image_parts with those from the vendor firmware.
  4. Rebuild firmware image
  5. Flash vendor firmware image (now packaged as your third-party firmware expects).
  6. If all succeeded, you're now using the vendor firmware again.

Once you are back to the vendor firmware, then it accepts vendor firmware images again.

Examples

This example demonstrates how to extract a firmware image, replace its existing telnet daemon with a custom built one, and then build a new firmware image:

$ ./extract-firmware.sh firmware.bin 

$ cp new-telnetd fmk/rootfs/usr/sbin/telnetd 

$ ./build-firmware.sh

Below is an example of the commands to run in order to extract a DD-WRT firmware image, modify the Web index page, and build a new firmware image:

$ ./extract-firmware.sh firmware.bin 

$ ./ddwrt-gui-extract.sh 

$ echo "HELLO WORLD" > www/index.asp 

$ ./ddwrt-gui-rebuild.sh 

$ ./build-firmware.sh


3.6.firmware-mod-kit工具的其它功能

[cpp]  view plain  copy
  1. Making changes to the firmware's file system  
  2.   
  3. Modifying the firmware is simple. The file system is stored in the working directory you supplied to extract_firmware.sh. Here are the subfolders of this directory:  
  4.   
  5.     rootfs/   
  6.         This is where the file system is. Make modifications here.  
  7.     image_parts/   
  8.         This is where intermediate files are stored. If you need to replace the kernel (not at all recommended), you can do so by replacing the appropriate file here (usually segment2).  
  9.     installed_packages/  
  10.         If you use the ipkg_install.sh tool, this is where packages you've installed after firmware extraction will reside.  
  11.   
  12. One can manually change the files in rootfs and/or use the automated package scripts.  
  13.   
  14.    
  15.   
  16. Installing packages (.IPK)  
  17.   
  18. In compliment to manually making changes, one can use pre-built IPKG format package files with the ipkg_install/remove scripts. Although not all will work and a repository for packages verified to work has not yet been produced, many packages work just fine.  
  19.   
  20. Packages are pre-built collections of files pertaining to a set of software. OpenWrt and DD-WRT both use packages, and most are cross-compatible. These packages are stored in a tar/gzip archive of a pre-defined structure that includes some control files. You can extract and copy the files manually, or use the ipkg_install.sh script included with this kit. For a list of some of the available packages (not all may work), see http://downloads.openwrt.org/whiterussian/packages/ and http://ftp.selfnet.de/pub/openwrt/backports/rc5/ . We are currently in the process of compiling a set of packages known to be good for DD-WRT ... to help in this matter please visit here.  
  21.   
  22. For information on how to create IPKs, see the IPK Creation Kit.  
  23.   
  24. Example use:  
  25.   
  26.   
  27. $ ./ipkg_install.sh some_package-1.2.5.ipk working_directory/  
  28.    
  29. some_package-1.2.5.ipkg would be the filename of the package.  
  30. working_directory is the same working directory you supplied to the extract_firmware.sh script.  
  31.   
  32. Notes:  
  33.   
  34. A script, ipkg_install_all.sh is also available to install an entire folder of packages.  
  35.   
  36. The collection of installed packages will be stored in working_directory/installed_packages .  
  37.    
  38. Removing packages (.IPK)  
  39.   
  40. To remove packages there is the ipkg_remove.sh script.  
  41.   
  42. Example use:  
  43.   
  44.   
  45. $ ./ipkg_remove.sh some_package-1.2.5.ipk working_directory/  
  46.    
  47. some_package-1.2.5.ipkg would be the filename of the package.  
  48. working_directory is the same working directory you supplied to the extract_firmware.sh script.  
  49.   
  50. Notes:  
  51.   
  52. A script, ipkg_remove_all.sh is also available to install an entire folder of packages.  

三、firmware-mod-kit包含的工具的说明

Tools / Utilities

The Firmware Mod Kit consists of a collection of tools useful when working with embedded firmware images. These include those listed below, though there are MANY MORE that are not listed here.

| |Tool | Description 

| |:---------|:----------------

| | AsusTRX | An extended version of ASUSTRX that can build both 'normal' TRX files and, optionally, those with an ASUS addver style header appended. It can also, uniquely, force segment offsets in the TRX (with -b switch) for compatibility with Marvell ASUS devices like the WL-530g. This tool replaces both 'normal' trx tool and addver. Current versions included are: 0.90 beta. 

| | AddPattern | Utility to pre-pend Linksys style HDR0 header to a TRX. 

| | AddVer | ASUS utility to append a header to a TRX image that contains version information. ASUSTRX includes this capability. Current version: unversioned. 

| | Binwalk | Scans firmware images for known file types (firmware headers, compressed kernels, file systems, etc.) 

| | CramFSCK | CRAMFS file system image checker and extractor. Current versions included are: 2.4x.

 | | CramFSSwap | Utility to swap the endianess of a CramFS image 

| | CRCalc | Utility to patch all uImage and TRX headers inside a given firmware image.

| | MkSquashFS | Builds a squashfs file system image. Current versions included are: 2.1-r2, 3.0. 

| | MkCramFS | Builds a cramfs file system image. Coming in next version. Current versions included are: 2.4x. 

| | MotorolaBin | Utility that prepends 8 byte headers to TRX images for Motorola devices WR850G, WA840G, WE800G. Current version: unversioned. 

| | Splitter3 | Utility to scan and extract a firmware image's component parts. 

| | Tpl-tool | Utility to manipulate TP-Link vendor format images. 

| | UnCramFS | Alternate tool to extract a cramfs file system image. Use cramfsck instead whenever possible as it seems to be more reliable. Current versions included are: 0.7 (for cramfs v2.x). 

| | UnCramFS-LZMA | Alternate tool to extract LZMA-compressed cramfs file system images, such as those used by OpenRG. 

| | UnSquashFS | Extracts a zlib squashfs file system image. Current versions included are 1.0 for 3.0 images and 1.0 for 2.x images (my own blend). 

| | UnSquashFS-LZMA | Extracts an lzma squashfs file system image. Current versions included are 1.0 for 3.0 images and 1.0 for 2.x images (my own blend). Note: Not all squashfs-lzma patches are compatible with one another. I'm working on adding support for all common squashfs-lzma variations. 

| | UnTRX | Splits TRX style firmwares into their component parts. Also supports pre-pended addpattern HDR0 style headers. This was developed exclusively for this kit. Current versions included are: 0.45. 

| | WebDecomp | Extracts and restores Web GUI files from DD-WRT firmware images, allowing modifications to the Web pages. 

| | WRTVxImgTool | Utility to generate VxWorks compatible firmware images for the WRT54G(S) v5 series. 


参考网址:https://code.google.com/archive/p/firmware-mod-kit/wikis/Documentation.wiki

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

firmware-mod-kit工具安装和使用说明 的相关文章

  • SpringBoot打包docker镜像发布

    1 首先构建一个SpringBoot项目 只需要添加web依赖 2 编写一个controller用于测试 3 本机启动观察是否能够成功访问 4 打包 5 找到生成的jar包位置 6 jar包的启动运行测试 7 编写Dockerfile文件

随机推荐

  • 游戏服务器内存修改,修改游戏服务器内存

    修改游戏服务器内存 内容精选 换一换 实例支持自动化发放裸金属服务器 远程Console登录 支持租户自主管理裸金属服务器生命周期 查询 启动 关机 重启 删除 导出服务器列表 将租户名下的所有裸金属服务器信息 以CSV文件的形式导出至本地
  • 【SQL】6 SQL WHERE 子句

    WHERE 子句用于过滤记录 SQL WHERE 子句 WHERE 子句用于提取那些满足指定标准的记录 SQL WHERE 语法 SELECT column name column name FROM table name WHERE co
  • Docker Compass

    Docker Compose介绍 使用微服务架构的应用系统一般包含若干个微服务 每个微服务一般都会部署多个实例 如果每个微服务都要手动启停 那么效率之低 维护量之大可想而知 本节课将讨论如何使用 Docker Compose来轻松 高效地管
  • ICCV 2023

    点击下方卡片 关注 CVer 公众号 AI CV重磅干货 第一时间送达 点击进入 gt 目标跟踪 微信交流群 作者 Jaraxxus 已授权转载 源 知乎 编辑 CVer https zhuanlan zhihu com p 6438354
  • 2018年区块链人才趋势:降温、调节、蓄势待发

    2018年 戊戌年 是一个不平静的年份 自960年前的戊戌年王安石变法 到最近两百年的四个戊戌年 其间发生的大事无不与 变革 息息相关 年初 从科技圈 金融圈里 引爆出一个叫 区块链 的公众热点 从技术角度而言 这并非新生事物 但因其巨大的
  • Linux网络服务管理&防火墙详解&端口问题

    每次配置访问服务器都会一团迷雾 今天来尝试弄清楚同时借鉴一下大佬的博文当做笔记 文章目录 防火墙简介 一 防火墙基础 二 iptables 防火墙策略 iptables 命令格式 iptables案例 1 查看开放的端口 2 开放端口 此处
  • 七、PXE高效批量网络装机

    七 PXE高效批量网络装机 PXE概述 PXE严格来说并不是一种安装方式 而是一种引导方式 进行 PXE 安装的必要条件是要安装的计算机中包含一个 PXE 支持的网卡 NIC 即网卡中必须要有 PXE Client PXE Pre boot
  • 如何在Linux系统上监测系统温度?(亲测可用)

    转载自 http os 51cto com art 201311 417208 htm 按理说 在大多数情况下 你用不着为电脑的运行温度而操心 除了制造瑕疵外 电脑硬件在设计时确保温度不会超过最高工作温度 但即使没有任何的硬件故障 也会由于
  • QT6源码编译全过程

    QT6源码编译全过程 windows环境下使用VS2019 QT6源码编译全过程 windows环境下使用VS2019 qt6 编译 刘亿辰的博客 CSDN博客 一 随记 QT作为一个跨平台的界面开发平台 经过了历史长河的洗礼以及一代代Qt
  • 【Windows系统】资源管理器右键卡顿案例

    问题 最近在使用办公电脑过程中 发现在Windows系统资源管理器中使用右键会出现卡顿现象 这是一台经常使用 工作日上班都会使用 以前没有这个问题 出现问题的环境 windows版本 win10 x64 22H2 解决方法 1 关闭映射到本
  • VUE之Echarts地图引入及配置项详解

    步骤 建立dom用于渲染地图组件 div style width 100 height 100 class map charts div 引入所需js文件 import echarts from echarts require echart
  • Unity中在场景中添加水资源效果的方法

    首先 导入系统自带的水资源包 鼠标右击Project视图中的Assets文件夹 在弹出来的列表中选择 Import Package gt Water Basic 然后 弹出一个 Importing package 窗口 自由选择其中的包 全
  • Python操作数据库

    pymysql模块简单实用 1 安装pymysql模块 pip3 install PyMySQL 2 建立连接 与MySQL服务端建立连接 conn pymysql connect host 127 0 0 1 ip port 3306 端
  • 因果模型五:用因果的思想优化风控模型——因果正则化评分卡模型

    因果模型五 用因果的思想优化风控模型 因果正则化评分卡模型 一 模型中的因果和相关 二 不可知样本选择偏差 三 因果推断 四 因果与评分卡的融合 五 模型效果评估 5 1 人工合成数据效果测试 5 2 YFCC100M图像数据测试 5 3
  • 高德地图打点获取点的坐标和名称

    一 首先引入地图 代码在最后 二 然后是打点获取坐标和名称的方法 代码在最后 重点 如果不加上密钥的话可能会得不到数据名称 你想要的代码来了 密钥 window AMapSecurityConfig securityJsCode 你申请ke
  • GraphPad Prism 9.2 Mac 2021最新安装使用教程

    GraphPad Prism集生物统计 化学统计 以及科技绘图于一身 其中医学所能用到的绘图需要它几乎都能满足 Prism 现在被各种生物学家以及社会和物理科学家广泛使用 超过110个国家的超过20万名科学家依靠 Prism 来分析 绘制和
  • SpringBoot学习遇到的问题(1) - 配置文件有日志的debug模式等配置项,为什么不起作用...

    这个问题困扰我近乎两天 通过查找N多资料后终于解决 写下来共享给大家 logging level root DEBUG 一系列的日志配置项 都不起作用的原因是springboot启动加载不到src main resources下的配置文件a
  • 那些踩过的declared implicitly的坑

    缺少头文件 我的本意是想做串口打印进行调试 于是我在usart c中重写了这两个函数 这里顺便记录下如何串口打印 usart c中 int fputc int ch FILE f HAL UART Transmit huart1 uint8
  • 2023计算机四非保研(复试:东北大学,成电,西电,浙软,中海洋,天大)

    文章目录 个人情况 夏令营情况 预推免情况 进入复试 中国海洋大学 学硕 浙大软院 专硕 天津大学智算 专硕 中科院网络中心 专硕 西电网安院 学硕 东北大学计算机 学硕 成电计算机 专硕 最终offer 感想 个人情况 本科学校 西北某四
  • firmware-mod-kit工具安装和使用说明

    一 firmware mod kit工具的安装 firmware mod kit工具的功能和binwalk工具的类似 其实firmware mod kit工具在功能上有调用binwalk工具提供的功能以及其他的固件解包工具的整合 下载fir