-
Notifications
You must be signed in to change notification settings - Fork 5
/
uninstall.sh
executable file
·69 lines (59 loc) · 2.1 KB
/
uninstall.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
#!/bin/bash
# This file is part of the Kojoney2 honeypot
#
# Main Developer - Justin C. Klein Keane <[email protected]>
# Original Developer - Jose Antonio Coret <[email protected]>
# Last updated 28 January 2013
#
# Kojoney2 install script
echo "******************************************"
echo " Kojoney2 Honeypot Uninstaller "
echo "******************************************"
echo "by Justin C. Klein Keane <[email protected]>"
echo based on Kojoney, by Jose Antonio Coret
echo
echo -e "Do you want to uninstall Kojoney2 (yes/no)? "
read res
if [ $res = 'yes' ]; then
echo " [-] Uninstalling ..."
daemon_alive=`ps aux | grep /usr/bin/kojoneyd | grep -v grep | wc -l `
if [ $daemon_alive -gt 0 ]; then
echo " [-] Stopping kojoney daemon ..."
if [ -f /etc/init.d/kojoney ]; then
/etc/init.d/kojoney stop
else
echo " [-] Can't find a method to kill the daemon. Kill it manually."
exit -1
fi
echo " [-] Waiting for a while"
sleep 3
fi
echo " [-] Backing up downloads (you can manually delete them)"
if [ -d /opt/kojoney_dls_bak/ ]; then
mv /opt/kojoney/download/* /opt/kojoney_dls_bak/
elif [ -d /opt/kojoney/download ]; then
mv /opt/kojoney/download /opt/kojoney_dls_bak/
fi
if [ -d /opt/kojoney/kojoney.sqlite ]; then
mv /opt/kojoney/kojoney.sqlite /opt/kojoney_dls_bak/
fi
echo " [-] Removing main directory"
rm -fr /opt/kojoney
echo " [-] Removing startup script"
rm -f /etc/init.d/kojoney
echo " [-] Removing symlinks"
rm -f /usr/bin/kojoneyd /usr/bin/kojreport /usr/bin/kojreport-filter /usr/bin/kip2country \
/usr/bin/kojhumans /usr/bin/kojsession /usr/bin/sessions_with_commands /usr/bin/commands_by_session_and_ip
echo " [-] Removing man pages"
rm -f /usr/share/man/man1/kip2country.1
rm -f /usr/share/man/man1/kojhumans.1
rm -f /usr/share/man/man1/kojreport-filter.1
rm -f /usr/share/man/man1/kojreport.1
echo " [-] Removing cron jobs"
sed -i '/\/opt\/kojoney/ d' /etc/crontab
echo " [-] Removing logrotate.d file"
rm -f /etc/logrotate.d/kojoney
echo " [-] Kojoney2 uninstall finished."
echo
echo " NB: Any Kojoney2 databases are unaffected by this script."
fi