forked from jgmdev/ddos-deflate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
uninstall.sh
executable file
·106 lines (93 loc) · 2.54 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
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
#!/bin/sh
# Check if the script is executed as root
if [ "$(id -u)" -ne 0 ]; then
echo "Please execute this script as root."
exit 1
fi
clear
echo "Uninstalling DOS-Deflate"
if [ -e '/etc/init.d/ddos' ]; then
echo; echo -n "Deleting init service..."
UPDATERC_PATH=`whereis update-rc.d`
if [ "$UPDATERC_PATH" != "update-rc.d:" ]; then
service ddos stop > /dev/null 2>&1
update-rc.d ddos remove > /dev/null 2>&1
fi
rm -f /etc/init.d/ddos
echo -n ".."
echo " (done)"
fi
if [ -e '/etc/rc.d/ddos' ]; then
echo; echo -n "Deleting rc service..."
service ddos stop > /dev/null 2>&1
rm -f /etc/rc.d/ddos
sed -i '' '/ddos_enable/d' /etc/rc.conf
echo -n ".."
echo " (done)"
fi
if [ -e '/usr/lib/systemd/system/ddos.service' ]; then
echo; echo -n "Deleting legacy systemd service..."
SYSTEMCTL_PATH=`whereis update-rc.d`
if [ "$SYSTEMCTL_PATH" != "systemctl:" ]; then
systemctl stop ddos > /dev/null 2>&1
systemctl disable ddos > /dev/null 2>&1
fi
rm -f /usr/lib/systemd/system/ddos.service
echo -n ".."
echo " (done)"
fi
if [ -e '/lib/systemd/system/ddos.service' ]; then
echo; echo -n "Deleting systemd service..."
SYSTEMCTL_PATH=`whereis update-rc.d`
if [ "$SYSTEMCTL_PATH" != "systemctl:" ]; then
systemctl stop ddos > /dev/null 2>&1
systemctl disable ddos > /dev/null 2>&1
fi
rm -f /lib/systemd/system/ddos.service
echo -n ".."
echo " (done)"
fi
echo -n "Deleting script files..."
if [ -e '/usr/local/sbin/ddos' ]; then
rm -f /usr/local/sbin/ddos
echo -n "."
fi
if [ -d '/usr/local/ddos' ]; then
rm -rf /usr/local/ddos
echo -n "."
fi
echo " (done)"
echo -n "Removing man page..."
if [ -e '/usr/share/man/man1/ddos.1' ]; then
rm -f /usr/share/man/man1/ddos.1
echo -n "."
fi
if [ -e '/usr/share/man/man1/ddos.1.gz' ]; then
rm -f /usr/share/man/man1/ddos.1.gz
echo -n "."
fi
echo " (done)"
if [ -e '/etc/logrotate.d/ddos' ]; then
echo -n "Deleting logrotate configuration..."
rm -f /etc/logrotate.d/ddos
echo -n ".."
echo " (done)"
fi
if [ -e '/etc/cron.d/ddos' ]; then
echo -n "Deleting cron job..."
rm -f /etc/cron.d/ddos
echo -n ".."
fi
if [ -e '/etc/crontab' ]; then
echo -n "Deleting cron job..."
sed -i '' '/ddos/d' /etc/crontab 2>/dev/null
echo -n ".."
fi
echo " (done)"
if [ -e '/etc/newsyslog.d/ddos' ]; then
echo -n "Deleting newsyslog job..."
rm -f /etc/newsyslog.d/ddos
echo -n ".."
echo " (done)"
fi
echo; echo "Uninstall Complete!"; echo