-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.sh
200 lines (170 loc) · 5.54 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/usr/bin/env bash
#
# Script forked from praetorian-inc/epictreasure
# https://github.com/praetorian-inc/epictreasure
## create a user
#getent passwd ctf || useradd -m -s /bin/bash ctf
#chown -R ctf: /home/ctf && chmod 4750 /home/ctf
#mkdir -p /home/ctf/tools && mkdir -p /etc/sudoeres.d/
#echo "ctf ALL=(ALL) NOPASSWD:ALL" > /etc/sudoeres.d/ctf
#echo "kernel.yama.ptrace_scope = 0" > /etc/sysctl.d/10-ptrace.conf
## Updates
# apt-get -yq update
# apt-get -yq upgrade
# apt-get -yq install apt-utils python2.7 python-pip python2.7-dev python3-pip python3-dev python-dbg git \
# sudo p7zip autoconf libssl-dev libpcap-dev libffi-dev clang nasm tmux \
# gdb gdb-multiarch gdbserver foremost ipython stow build-essential virtualenvwrapper \
# ltrace strace socat tcpdump john hydra vim curl wget nmap \
# g++ gcc netcat netcat6 openssh-server openssh-client lsof
## Install 32 bit libs also
# dpkg --add-architecture i386
# apt update
# apt-get -yq install libc6:i386 libncurses5:i386 libstdc++6:i386
# apt-get -yq install libc6-dev-i386
pip install --upgrade pip
## QEMU with MIPS/ARM - http://reverseengineering.stackexchange.com/questions/8829/cross-debugging-for-mips-elf-with-qemu-toolchain
#apt-get -yq install qemu qemu-user qemu-user-static 'binfmt*' libc6-armhf-armel-cross debian-keyring debian-archive-keyring emdebian-archive-keyring
#tee /etc/apt/sources.list.d/emdebian.list << EOF
#deb http://mirrors.mit.edu/debian squeeze main
#deb http://www.emdebian.org/debian squeeze main
#EOF
#apt-get -yq install libc6-mipsel-cross libc6-arm-cross
#mkdir /etc/qemu-binfmt
#ln -s /usr/mipsel-linux-gnu /etc/qemu-binfmt/mipsel
#ln -s /usr/arm-linux-gnueabihf /etc/qemu-binfmt/arm
#rm /etc/apt/sources.list.d/emdebian.list
#apt update
## Install Binjitsu
pip2 install --upgrade git+https://github.com/binjitsu/binjitsu.git
## Install pwnlib-binutil
apt-get install -yq software-properties-common
apt-add-repository --yes ppa:pwntools/binutils
apt-get update
ARCHES="aarch64 alpha arm avr cris hppa ia64 m68k mips mips64 msp430 powerpc powerpc64 s390 sparc vax xscale i386 x86_64"
for arch in $ARCHES; do
apt-get -yq install binutils-$arch-linux-gnu
done
mkdir /home/ctf/tools && \
chown -R ctf: /home/ctf/tools
## Install peda
cd /home/ctf/tools
git clone https://github.com/longld/peda.git
echo -en "define load_peda\n source ~/tools/peda/peda.py\nend" >> ~/.gdbinit
## Install pwndbg
cd /home/ctf/tools
git clone https://github.com/zachriggle/pwndbg
echo -en "define load_pwndbg\n source ~/tools/pwndbg/gdbinit.py\nend" >> ~/.gdbinit
## Capstone for pwndbg
cd /home/ctf/tools
git clone https://github.com/aquynh/capstone
cd capstone
git checkout -t origin/next
./make.sh install
cd bindings/python
python3 setup.py install # Ubuntu 14.04+, GDB uses Python3
## pycparser for pwndbg
pip3 install pycparser # Use pip3 for Python3
## Install radare2
cd /home/ctf/tools
git clone https://github.com/radare/radare2
cd radare2
./sys/install.sh
## Install binwalk
cd /home/ctf/tools
git clone https://github.com/devttys0/binwalk
cd binwalk
python setup.py install
apt-get -yq install squashfs-tools
## Install Firmware-Mod-Kit
#apt-get -yq install zlib1g-dev liblzma-dev python-magic
#cd /home/ctf/tools
#wget https://firmware-mod-kit.googlecode.com/files/fmk_099.tar.gz
#tar xvf fmk_099.tar.gz
#rm fmk_099.tar.gz
#cd fmk_099/src
#./configure
#make
## Uninstall capstone
pip2 uninstall capstone -y
## Install correct capstone
cd ~/tools/capstone/bindings/python
python setup.py install
## Personal config not installed by default
cd /home/ctf
git clone https://github.com/boogy/dotfiles.git
## Install Angr framework
cd /home/ctf/tools
pip2 install angr --upgrade
## Install american-fuzzy-lop
apt-get -yq install clang llvm
cd /home/ctf/tools
wget --quiet http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz
tar -xzvf afl-latest.tgz
rm afl-latest.tgz
(
cd afl-*
make
# build clang-fast
(
cd llvm_mode
make
)
make install
)
## Install Pillow
apt-get build-dep python-imaging
apt-get -yq install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
pip2 install Pillow
## Install angr-dev
cd /home/ctf/tools
git clone https://github.com/angr/angr-dev
cd angr-dev
./setup.sh -i angr
## Replace ROPGadget with rp++
apt-get -yq install cmake libboost-all-dev clang-3.5
export CC=/usr/bin/clang-3.5
export CXX=/usr/bin/clang++-3.5
cd /home/ctf/tools
git clone https://github.com/0vercl0k/rp.git
cd rp
git checkout next
git submodule update --init --recursive
# little hack to make it compile
sed -i 's/find_package(Boost 1.59.0 COMPONENTS flyweight)/find_package(Boost)/g' CMakeLists.txt
mkdir build && cd build && cmake ../ && make && cp ../bin/rp-lin-x64 /usr/local/bin/
## Install ROPGadget
cd /home/ctf/tools
git clone https://github.com/JonathanSalwan/ROPgadget
cd ROPgadget
python setup.py install
## Install Z3 Prover
cd /home/ctf/tools
git clone https://github.com/Z3Prover/z3.git
cd z3
python scripts/mk_make.py
cd build
make install
python ../scripts/mk_make.py --python
## Install keystone engine
cd /home/ctf/tools
git clone https://github.com/keystone-engine/keystone.git
mkdir build
cd build
../make-share.sh
make install
ldconfig
cd /home/ctf/tools/keystone/bindings/python
sudo make install
## Install qira
#cd /home/ctf/tools
#git clone https://github.com/BinaryAnalysisPlatform/qira.git
#cd qira/
#./install.sh
## Python pip cool modules
pip2 install --upgrade r2pipe
pip2 install --upgrade distorm3
pip2 install --upgrade pycrypto
pip2 install --upgrade git+https://github.com/hellman/xortool.git
# enable ssh on the box
systemctl start ssh.service && \
systemctl enable ssh.service