forked from firmadyne/firmadyne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·44 lines (35 loc) · 1.33 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
set -x
# Install dependencies
sudo apt-get install -y busybox-static fakeroot git dmsetup kpartx netcat-openbsd nmap python3-psycopg2 snmp uml-utilities util-linux vlan postgresql wget qemu-system-arm qemu-system-mips qemu-system-x86 qemu-utils vim unzip
# Move to firmadyne dir
FIRMADYNE_INSTALL_DIR=/firmadyne
mkdir $FIRMADYNE_INSTALL_DIR
pushd $FIRMADYNE_INSTALL_DIR
# Clone repos
git clone https://github.com/ReFirmLabs/binwalk
git clone --recursive https://github.com/firmadyne/firmadyne.git
# Set up binwalk
pushd binwalk
sudo ./deps.sh --yes
sudo python3 ./setup.py install
popd
# Install additional deps
sudo pip3 install git+https://github.com/ahupp/python-magic
sudo pip install git+https://github.com/sviehb/jefferson
# Set up database
sudo service postgresql start
sudo -u postgres createuser firmadyne
sudo -u postgres createdb -O firmadyne firmware
sudo -u postgres psql -d firmware < ./firmadyne/database/schema
echo "ALTER USER firmadyne PASSWORD 'firmadyne'" | sudo -u postgres psql
# Set up firmadyne
pushd firmadyne
./download.sh
# Set FIRMWARE_DIR in firmadyne.config
mv firmadyne.config firmadyne.config.orig
echo -e '#!/bin/sh' "\nFIRMWARE_DIR=$(pwd)/" > firmadyne.config
cat firmadyne.config.orig >> firmadyne.config
# Make sure firmadyne user owns this dir
sudo chown -R firmadyne:firmadyne $FIRMADYNE_INSTALL_DIR