-
Notifications
You must be signed in to change notification settings - Fork 6
/
kali-linux-install-dvwa.sh
65 lines (42 loc) · 1.42 KB
/
kali-linux-install-dvwa.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
#!/bin/sh
echo "Installing packages..."
apt-get install -y apache2 curl libapache2-mod-php mariadb-server php-gd php-mysql wget
cd /var/www/html
rm -f index.html
echo "Downloading dvwa..."
rm -f master.zip
rm -rf DVWA-master
wget "https://github.com/ethicalhack3r/DVWA/archive/master.zip"
unzip -q master.zip
rm -f master.zip
mv DVWA-master dvwa
echo "Changing permissions for dvwa directory..."
chown -R www-data:www-data dvwa
cd dvwa
echo "Copying dvwa config..."
cp config/config.inc.php.dist config/config.inc.php
echo "Configuring dvwa..."
sed -i s/\'root\'/\'dvwa\'/g config/config.inc.php
echo "Configuring PHP..."
PHPVER=$(ls -1 /etc/php | tail -1)
echo "allow_url_include = On" > /etc/php/$PHPVER/apache2/conf.d/99-dvwa.ini
echo "Configuring apache2..."
a2dismod mpm_event
a2enmod mpm_prefork
a2enmod php$PHPVER
echo "Enabling and starting apache2..."
systemctl enable apache2.service
systemctl restart apache2.service
echo "Enabling and starting mariadb..."
systemctl enable mariadb.service
systemctl restart mariadb.service
echo "Configuring mariadb..."
cat << EOF | mariadb
CREATE DATABASE IF NOT EXISTS dvwa;
GRANT ALL ON dvwa.* to dvwa@localhost IDENTIFIED BY 'p@ssw0rd';
FLUSH PRIVILEGES;
EOF
echo "Setting up dvwa database..."
curl 'http://127.0.0.1/dvwa/setup.php' -H 'Host: 127.0.0.1' --data 'create_db=Create+%2F+Reset+Database'
echo "Done. Opening dvwa in your browser..."
x-www-browser "http://127.0.0.1/dvwa"