-
Notifications
You must be signed in to change notification settings - Fork 35
/
install.sh
60 lines (58 loc) · 2.35 KB
/
install.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
#!/bin/bash
# PhpMyAdmin Honeypot Configuration
# greg.foss[at]owasp.org
# v0.1 - June 2015
#
# This script will customize and configure the phpmyadmin honeypot
echo "===================="
echo "PhpMyAdmin Honeypot Configuration"
echo "===================="
sleep 1
echo ""
echo "Where would you like to install the Honeypot? ( ex: /var/www )"
read directory
echo ""
echo "Installing honeypot to: $directory/phpmyadmin/"
echo ""
echo "What Username would you like to use for PhpMyAdmin? (default: root)"
read phpmyadminUsername
if [ -z "$phpmyadminUsername" ]; then
phpmyadminUsername="root"
fi
echo "What Password would you like to use for PhpMyAdmin? (default: root)"
read phpmyadminPassword
if [ -z "$phpmyadminPassword" ]; then
phpmyadminPassword="root"
fi
echo ""
echo "PhpMyAdmin Username and Password Configured ($phpmyadminUsername/$phpmyadminPassword)"
echo ""
mv ./phpmyadmin-interactive $directory/phpmyadmin
echo "Rename the honeypot log filename (no extension and make this random): "
read phpmyadminLog
if [ -z "$phpmyadminLog" ]; then
phpmyadminLog=$RANDOM
echo "No value supplied, using a random value: $phpmyadminLog.txt"
echo ""
else
echo "Using $phpmyadminLog.txt to capture authentication attempts"
echo ""
fi
echo "Configure LogRhythm to extract data from $directory/phpmyadmin/$phpmyadminLog.txt"
sed -i "/\$File = \"log.txt\";/c\\\$File = \"$phpmyadminLog.txt\";" $directory/phpmyadmin/index.php
sed -i "/\$myFile = \"log.txt\";/c\\\$myFile = \"$phpmyadminLog.txt\";" $directory/phpmyadmin/login.php
sed -i 's/log.txt/'$phpmyadminLog.txt'/g' $directory/phpmyadmin/master-config/index.php
sed -i 's/log.txt/'$phpmyadminLog.txt'/g' $directory/phpmyadmin/master-config/phpinfo.php
mv $directory/phpmyadmin/log.txt $directory/phpmyadmin/$phpmyadminLog.txt
sed -i 's/USERNAME/'$phpmyadminUsername'/g' $directory/phpmyadmin/login.php
sed -i 's/PASSWORD/'$phpmyadminPassword'/g' $directory/phpmyadmin/login.php
if [ -f ../phpmyadmin_honeypot/README.md ]; then
rm -rf ../phpmyadmin_honeypot/
fi
echo ""
echo "Fake PhpMyAdmin has been configured successfully and can be accessed via http://127.0.0.1/phpmyadmin/"
echo "There are also one fake phpinfo page: $directory/phpmyadmin/phpinfo.php"
echo "Logs will write to: $directory/phpmyadmin/$phpmyadminLog.txt"
echo "Username set to => $phpmyadminUsername"
echo "Password set to => $phpmyadminPassword"
echo ""