物联网设备固件分析:firmware-analysis-toolkit固件模拟环境搭建

1、搭建准备:

ubuntu 18.04:Index of /ubuntu-releases/

firmware-analysis-toolkit、firmadyne、binwalk、qeum;

链接:https://pan.baidu.com/s/1fxuGfXULsq-BEbzfkUBdeA 
提取码:dbfl

python3 python3-pip

2、环境配置:

vmware16.0搭建ubuntu18.04,安装python3、python-pip,此处不赘述;

2.1 安装依赖:

sudo apt-get install busybox-static fakeroot git dmsetup kpartx netcat-openbsd nmap python-psycopg2 python3-psycopg2 snmp uml-utilities util-linux vlan

2.2 拷贝firmware-analysis-toolkit文件夹

拷贝到 home/tools 目录下

2.2 安装binwalk

# 1. 安装依赖和binwalk
cd firmware-analysis-toolkit/binwalk
sudo ./deps.sh
sudo python setup.py install

# 2. 对于 python2.x,还需要安装以下的库
sudo -H pip install git+https://github.com/ahupp/python-magic
sudo -H pip install git+https://github.com/sviehb/jefferson

 测试是否安装成功:

firmadyne@ubuntu:~$ binwalk

Binwalk v2.2.0-a58b3ae
Craig Heffner, ReFirmLabs
https://github.com/ReFirmLabs/binwalk

Usage: 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)

2.3 安装firmadyne

  1. 进入Firmadyne目录,然后打开firmadyne.config,修改 FIRMWARE_DIR的路径为当前Firmadyne目录的绝对路径

    cd firmware-analysis-toolkit/firmadyne

    vim firmadyne.config

    # 以下为firmadyne.config中的内容
    #!/bin/sh

    # uncomment and specify full path to FIRMADYNE repository
    FIRMWARE_DIR=/home/firmadyne/firmware-analysis-toolkit/firmadyne/

  2. 安装Firmadyne
    sh ./download.sh

2.4 安装postgresql数据库

sudo apt-get install postgresql

# 用户的密码设置为:firmadyne
sudo -u postgres createuser -P firmadyne, with password firmadyne

sudo -u postgres createdb -O firmadyne firmware

# 注意这里的数据库文件是在firmadyne/目录下,也就是该命令要在根目录firmware-analysis-toolkit/目录下执行
sudo -u postgres psql -d firmware < ./firmadyne/database/schema

验证是否安装成功:

sudo service postgresql start

sudo service postgresql status

2.5 安装qemu

apt-get安装:

sudo apt-get install qemu-system-arm qemu-system-mips qemu-system-x86 qemu-utils

2.6 修改执行权限

由于windows拷贝过来的文件会丢失执行权限,所以要给py文件以及sh文件都加上执行权限。否则仿真运行起来会报错,例如/usr/bin/env: \xe2\x80\x98python33\xe2\x80\x99: No such file or directory\

chmod +x fat.py

cd firmadyne

chmod -R +x scripts/

chmod +x /source/extractor/extract.sh

chmod +x /source/extractor/extractor.py

2.7 修改配置文件

vim fat.config

填写安装目录和登录密码

2.8 仿真运行

./fat.py 固件名称

猜你喜欢

转载自blog.csdn.net/redwolf6888/article/details/127284951
今日推荐