forked from probonopd/phantom-licensecheck
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlicensecheck
42 lines (33 loc) · 1.34 KB
/
licensecheck
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
#/!bin/bash
# Install dependencies
sudo apt-get update
sudo apt-get -y install python-requests unrar unrar-free lha mtd-utils zlib1g-dev liblzma-dev ncompress gzip bzip2 tar arj p7zip p7zip-full
# cramfsprogs cramfsswap
# Install binwalk
wget https://github.com/devttys0/binwalk/archive/master.zip
unzip master.zip
# In order not to get killed due to RAM usage
sed -i -e 's|7z e|7z -mx -mmt2 e|g' ./binwalk-master/src/binwalk/config/extract.conf
(cd binwalk-master && sudo python setup.py uninstall && sudo python setup.py install)
# Get and extract firmware
wget "http://download.dji-innovations.com/downloads/phantom_3/en/Phantom_3_Advanced_Firmware_v1.2.8_en.zip"
unzip Phantom*.zip
# Examine firmware with binwalk
binwalk -Mre ./P3*.bin
# Check what we got
ls -lh *extracted
file *extracted/*
# Print strings inside all ELF files
FILES=$(find *extracted -name *.elf -or -name *.key)
for f in $FILES ; do
echo "" >> findings.txt
echo "##########################################" >> findings.txt
echo "" >> findings.txt
echo "Strings of file $f" >> findings.txt
echo "" >> findings.txt
strings "$f" >> findings.txt
done
# Upload the findings
wget https://raw.githubusercontent.com/probonopd/travis2github/master/travis2github.py
wget https://raw.githubusercontent.com/probonopd/travis2github/master/magic.py
python travis2github.py ./findings.txt