-
Notifications
You must be signed in to change notification settings - Fork 0
/
ctf.sh
executable file
·194 lines (162 loc) · 4.77 KB
/
ctf.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
#!/bin/bash
echo "+==============================+"
echo "|Deploying CTF environment.... |"
echo "+==============================+"
#Activate Virtualenvwrapper api
source `which virtualenvwrapper.sh`
#overrite dot files
cp ./.gdbinit ~/
#set /opt's owner
sudo chown -R $(whoami) /opt
#Update & upgrade
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
#Install multi-arch
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib
#Install angr
sudo apt-get -y install python-dev libffi-dev build-essential
mkvirtualenv --python=$(which python3) angr && pip install angr && deactivate
#Install ltrace,strace,nmap
sudo apt-get install -y nmap strace ltrace
#Install exiftool, pngcheck for forensic
sudo apt-get install -y exiftool pngcheck sqlmap
#Install ipython2/3
sudo pip3 install ipython
sudo pip install ipython
#Install gdb, angelboy's Pwngdb & gdb-peda
sudo apt-get install -y gdb
cd ~/
git clone https://github.com/scwuaptx/peda.git ~/.peda/
git clone https://github.com/scwuaptx/Pwngdb.git ~/.pwngdb/
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
cp ~/.peda/.inputrc ~/
#Install pwntools
sudo apt-get install -y python2.7 python-pip python-dev git libssl-dev libffi-dev build-essential
sudo pip install --upgrade pwntools
#Install xortool
sudo pip install xortool
#Install docker
curl -sSL https://get.docker.com/ | sudo sh
sudo usermod -aG docker $(whoami)
#Install Hashpump
sudo apt-get install -y g++ libssl-dev
cd /opt
git clone https://github.com/bwall/HashPump.git
cd HashPump/
sudo make
sudo make install
cd ~/
sudo rm -rf /opt/HashPump
## z3
cd /opt
git clone https://github.com/Z3Prover/z3
cd z3/
sudo python scripts/mk_make.py --python
cd build
sudo make
sudo make install
cd ~/
sudo rm -rf /opt/z3
#Install msfconsole
curl -sSL https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb | sudo sh
#Install searchsploit
git clone https://github.com/offensive-security/exploitdb.git /opt/exploitdb
sed 's|path_array+=(.*)|path_array+=("/opt/exploitdb")|g' /opt/exploitdb/.searchsploit_rc > ~/.searchsploit_rc
sudo ln -sf /opt/exploitdb/searchsploit /usr/local/bin/searchsploit
#Install dirsearch
cd /opt
curl https://sourceforge.net/projects/dirb/files/dirb/2.22/dirb222.tar.gz/download -L -o dirb.tar.gz
tar zxvf dirb.tar.gz
chmod 775 dirb222/
cd dirb222/
for i in `ls`;do
if [[ -d $i ]];then
chmod 755 $i;
fi
done
sudo apt-get install -y libcurl4-openssl-dev
./configure
make
sudo make
#Install jtr
cd /opt
git clone https://github.com/magnumripper/JohnTheRipper
sudo apt-get -y install build-essential libssl-dev git zlib1g-dev yasm libgmp-dev libpcap-dev pkg-config libbz2-dev
cd JohnTheRipper/src
sudo ./configure && sudo make -s clean && sudo make -sj4
#Install qira
cd /opt
wget -qO- https://github.com/BinaryAnalysisPlatform/qira/archive/v1.3.tar.gz | tar zx && mv qira* qira
cd qira/
sudo pip install -r requirements.txt
sudo ./install.sh
sudo ./fetchlibs.sh
sudo ./bdistrib.sh
sudo ./run_tests_static.sh
#Install binwalk
cd /opt
sudo apt-get install python-lzma
git clone https://github.com/ReFirmLabs/binwalk.git
cd binwalk/
sudo python3 setup.py install
sudo ./deps.sh
cd ~/
sudo rm -rf /opt/binwalk
#TODO: yafu
#Install gmpy2 & deps
root="/opt"
mkdir -p $root/src
mkdir -p $root/static
#Install m4
cd $root/src
wget https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
tar zxvf m4-1.4.18.tar.gz
cd m4-1.4.18
sudo ./configure --prefix=/usr/local
sudo make
sudo make check
sudo make install
#Install gmp
cd $root/src
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
tar Jxvf gmp-6.1.2.tar.xz
cd gmp-6.1.2
sudo ./configure --prefix=$root/static --enable-static --disable-shared --with-pic
sudo make
sudo make check
sudo make install
#Install mpfr
cd $root/src
wget https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.xz
tar Jxvf mpfr-4.0.2.tar.xz
cd mpfr-4.0.2
sudo ./configure --prefix=$root/static --enable-static --disable-shared --with-pic --with-gmp=$root/static
sudo make
sudo make check
sudo make install
#Install mpc
cd $root/src
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
tar zxvf mpc-1.1.0.tar.gz
cd mpc-1.1.0
sudo ./configure --prefix=$root/static --enable-static --disable-shared --with-pic --with-gmp=$root/static --with-mpfr=$root/static
sudo make
sudo make check
sudo make install
#Install gmpy2
cd $root/src
wget https://github.com/aleaxit/gmpy/releases/download/gmpy2-2.1.0a1/gmpy2-2.1.0a1.tar.gz
tar zxvf gmpy2-2.1.0a1.tar.gz
cd gmpy2-2.1.0a1
sudo python setup.py build_ext --static=$root/static install
cd ~/
sudo rm -rf /opt/src
sudo rm -rf /opt/static
echo "===================================="
echo "| CTF Environment Deployed |"
echo "===================================="
echo " - Racterub"