forked from panda-re/panda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
panda_install.bash
executable file
·108 lines (97 loc) · 2.73 KB
/
panda_install.bash
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
# This is just everything in compile.md
# turned into a script
# you should be able to run it, type in
# sudo passwd and have it install all of panda.
# Verified that this script works
# from a clean install of deb7.
#
#
# This script installs all of PANDA after first taking care of current dependencies.
# Known to work on debian 7 install.
progress() {
echo
echo -e "\e[32m[panda_install]\e[0m \e[1m$1\e[0m"
}
# Exit on error.
set -e
progress "Installing qemu dependencies..."
sudo apt-get update -qq
sudo apt-get -y install build-essential
progress "Installing PANDA dependencies..."
sudo apt-get -y install nasm libssl-dev libpcap-dev subversion curl autoconf libtool \
python-pip git protobuf-compiler protobuf-c-compiler libprotobuf-c0-dev libprotoc-dev \
libglib2.0-dev libelf-dev libwiretap-dev libwsutil-dev
cwd=$(pwd)
cd /tmp
progress "Trying to install LLVM 3.3..."
if ! sudo apt-get -y install libc++-dev llvm-3.3-dev clang-3.3
then
progress "Couldn't find OS package for LLVM 3.3. Proceeding without..."
fi
if [ ! -e "/usr/local/lib/libdistorm3.so" ]
then
sudo apt-get -y install unzip
curl -O http://ragestorm.net/distorm/distorm3.3-package.zip
unzip distorm3.3-package.zip
cd distorm3/make/linux
make -j$(nproc)
progress "Installing distorm..."
sudo make install
cd ../../..
cd distorm3/include
sudo cp * /usr/local/include
else
progress "Skipping distorm..."
fi
if [ ! -e "/usr/local/lib/libdwarf.so" ]
then
wget http://www.prevanders.net/libdwarf-20160507.tar.gz --no-check-certificate
tar -xzvf libdwarf-20160507.tar.gz
cd dwarf-20160507
progress "Installing libdwarf..."
./configure --enable-shared
make
sudo cp libdwarf/libdwarf.h /usr/local/include
sudo cp libdwarf/dwarf.h /usr/local/include
sudo cp libdwarf/libdwarf.so /usr/local/lib/
cd ../
else
progress "Skipping libdwarf..."
fi
if python -c 'import pycparser' 2>/dev/null
then
if python <<EOF
import sys
import pycparser
version = [int(x) for x in pycparser.__version__.split(".")]
if version[0] < 2 or (version[0] == 2 and version[1] < 10):
print "pycparser too old. Please upgrade it!"
sys.exit(1)
else:
print "pycparser version good."
sys.exit(0)
EOF
then
progress "Skipping pycparser..."
else
progress "Your pycparser is too old. Please upgrade using your method of choice."
exit 1
fi
else
progress "Installing pycparser..."
sudo -H pip install pycparser
fi
cd "$cwd"
if [ ! -e "qemu/build.sh" ]
then
progress "Cloning PANDA into $cwd ..."
git clone https://github.com/moyix/panda.git
cd panda/qemu
else
progress "Already in PANDA directory."
cd qemu
fi
progress "Building PANDA..."
./build.sh
progress "PANDA is built and ready to use in panda/qemu/[arch]-softmmu/qemu-system-[arch]."