-
Notifications
You must be signed in to change notification settings - Fork 9
/
antiadmin.sh
242 lines (235 loc) · 8.97 KB
/
antiadmin.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#!/bin/bash
again='y'
while [ $again == 'Y' ] || [ $again == 'y' ];
do
clear
echo "================================================";
echo " X-code Anti Admin (Root access only) ";
echo " Version v0.1 ";
echo " Oleh Kurniawan ";
echo " [email protected] ";
echo " xcode.or.id ";
echo "------------------------------------------------";
echo "1. Cek keberadaan log user ";
echo "2. Edit isi log user ";
echo "3. Ubah kepemilikan user ke user.user ";
echo "4. Kosongkan log user (user.user) ";
echo "------------------------------------------------";
echo "5. Cek keberadaan log akses root ";
echo "6. Edit isi log akses root ";
echo "7. Ubah kepemilikan menjadi root.root ";
echo "8. Hapus log akses root (root.root) ";
echo "------------------------------------------------";
echo "9. Cek keberadaan log akses apache2 ";
echo "10. Edit isi log akses apache2 ";
echo "11. Ubah kepemilikan menjadi root.adm ";
echo "12. Hapus log akses apache2 (root.adm) ";
echo "------------------------------------------------";
echo "13. Cek keberadaan log akses SSH ";
echo "14. Edit isi log SSH ";
echo "15. Ubah kepemilikan menjadi syslog.adm ";
echo "16. Hapus log SSH (syslog.adm) ";
echo "------------------------------------------------";
echo "17. Lihat user linux ";
echo "18. Lihat isi group linux ";
echo "19. Lihat password user linux (encrypt) ";
echo "------------------------------------------------";
echo "20. Pasang penghapus log di rc.local ";
echo "21. Edit rc.local ";
echo "22. Exit ";
echo "================================================";
read -p "Masukkan Pilihan Anda antara 1 hingga 22: " choice;
echo "";
case $choice in
1) echo -n "Masukkan nama user: "
read namauser
if [ -z "$(sudo ls -la /home/$namauser/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di folder /home/$namauser/"
else
echo "Terdeteksi ada file .bash_history di folder /home/$namauser/"
sudo ls -la /home/$namauser/.bash_history
fi
;;
2) echo -n "Masukkan nama user: "
read namauser
if [ -z "$(sudo ls -la /home/$namauser/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di folder /home/$namauser/"
else
echo "File .bash_history di folder /home/$namauser/ dihapus"
sudo nano /home/$namauser/.bash_history
fi
;;
3) echo -n "Masukkan nama user: "
read namauser
if [ -z "$(sudo ls -la /home/$namauser/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di folder /home/$namauser/"
else
echo "File .bash_history di folder /home/$namauser/ diubah menjadi $namauser.$namauser"
sudo chown $namauser.$namauser /home/$namauser/.bash_history
fi
;;
4) echo -n "Masukkan nama user: "
read namauser
if [ -z "$(sudo ls -la /home/$namauser/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di folder /home/$namauser/"
else
echo "File .bash_history di folder /home/$namauser/ dihapus"
echo "Log baru akan tampil setelah linux direstart"
sudo rm /home/$namauser/.bash_history
sudo touch /home/$namauser/.bash_history
sudo chown $namauser.$namauser /home/$namauser/.bash_history
fi
;;
5) if [ -z "$(sudo ls -la /root/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di root"
else
echo "Terdeteksi ada file .bash_history di folder /root/"
sudo ls -la /root/.bash_history
fi
;;
6) if [ -z "$(sudo ls -la /root/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di root"
else
echo "File .bash_history di folder /root/ dibuka"
sudo nano /root/.bash_history
fi
;;
7) if [ -z "$(sudo ls -la /root/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di root"
else
echo "File .bash_history di folder /root/ hak aksesnya diubah menjadi root.root"
sudo chown root.root /root/.bash_history
fi
;;
8) if [ -z "$(sudo ls -la /root/.bash_history)" ]; then
echo "Tidak terdeteksi ada file .bash_history di root"
else
echo "File .bash_history di folder /root/ dihapus"
echo "Log baru akan tampil setelah linux direstart"
sudo rm /root/.bash_history
sudo touch /root/.bash_history
sudo chown root.root /root/.bash_history
fi
;;
9) if [ -z "$(sudo ls -A /var/log/apache2/access.log)" ]; then
echo "Tidak terdeteksi ada file access.log* di folder /var/log/apache2/"
else
echo "Terdeteksi ada file access.log di folder /var/log/apache2/"
sudo ls -l /var/log/apache2/access.log
fi
;;
10) if [ -z "$(sudo ls -A /var/log/apache2/access.log)" ]; then
echo "Tidak terdeteksi ada file access.log* di folder /var/log/apache2/"
else
echo "File access.log di folder /var/log/apache2/ dibuka"
sudo nano /var/log/apache2/access.log
fi
;;
11) if [ -z "$(sudo ls -A /var/log/apache2/access.log)" ]; then
echo "Tidak terdeteksi ada file access.log* di folder /var/log/apache2/"
else
echo "File access.log di folder /var/log/apache2/ hak aksesnya diubah menjadi root.adm"
sudo chown root.adm /var/log/apache2/access.log
fi
;;
12) if [ -z "$(sudo ls -A /var/log/apache2/access.log)" ]; then
echo "Tidak terdeteksi ada file access.log di folder /var/log/apache2/"
else
echo "File access.log di folder /var/log/apache2/ dihapus"
echo "Log baru akan tampil setelah linux direstart"
sudo rm /var/log/apache2/access.log*
sudo touch /var/log/apache2/access.log
sudo chown root.adm /var/log/apache2/access.log
fi
;;
13) if [ -z "$(sudo ls -A /var/log/auth.log)" ]; then
echo "Tidak terdeteksi ada file auth.log di folder /var/log/"
else
echo "Terdeteksi ada file auth.log di folder /var/log/"
sudo ls -l /var/log/auth.log
fi
;;
14) if [ -z "$(sudo ls -A /var/log/auth.log)" ]; then
echo "Tidak terdeteksi ada file auth.log* di folder /var/log/"
else
echo "File auth.log di folder /var/log/ dibuka"
sudo nano /var/log/auth.log
fi
;;
15) if [ -z "$(sudo ls -A /var/log/auth.log)" ]; then
echo "Tidak terdeteksi ada file auth.log di folder /var/log/"
else
echo "File auth.log di folder /var/log/ hak aksesnya diubah menjadi root.adm"
sudo chown syslog.adm /var/log/auth.log
fi
;;
16) if [ -z "$(sudo ls -A /var/log/auth.log)" ]; then
echo "Tidak terdeteksi ada file auth.log di folder /var/log/"
else
echo "File auth.log di folder /var/log/"
echo "Log baru akan tampil setelah linux direstart"
sudo rm /var/log/auth.log*
sudo touch /var/log/auth.log
sudo chown syslog.adm /var/log/auth.log
fi
;;
17) if [ -z "$(sudo ls -A /etc/passwd)" ]; then
echo "Tidak terdeteksi file /etc/passwd di linux"
else
echo "File /etc/passwd dibuka"
sudo cat /etc/passwd
fi
;;
18) if [ -z "$(sudo ls -A /etc/group)" ]; then
echo "Tidak terdeteksi file /etc/group di linux"
else
echo "File /etc/group dibuka"
sudo cat /etc/group
fi
;;
19) if [ -z "$(sudo ls -A /etc/group)" ]; then
echo "Tidak terdeteksi file /etc/shadow di linux"
else
echo "File /etc/shadow dibuka"
sudo cat /etc/shadow
fi
;;
20) if [ -z "$(sudo ls -A /etc/rc.local)" ]; then
echo "Tidak terdeteksi ada file rc.local di /etc/"
else
echo "File rc.local di folder /etc/ disisipkan penghapus log"
sudo sed -i -e '$i \rm /root/.bash_history\n' /etc/rc.local
sudo sed -i -e '$i \rm /var/log/apache2/access.log*\n' /etc/rc.local
sudo sed -i -e '$i \rm /root/log/auth.log*\n' /etc/rc.local
sudo sed -i -e '$i \touch /root/.bash_history\n' /etc/rc.local
sudo sed -i -e '$i \touch /var/log/apache2/access.log\n' /etc/rc.local
sudo sed -i -e '$i \touch /root/log/auth.log\n' /etc/rc.local
sudo sed -i -e '$i \chown root.root /root/.bash_history\n' /etc/rc.local
sudo sed -i -e '$i \chown root.adm /var/log/apache2/access.log\n' /etc/rc.local
sudo sed -i -e '$i \chown syslog.adm /root/log/auth.log\n' /etc/rc.local
fi
;;
21) if [ -z "$(sudo ls -A /etc/rc.local)" ]; then
echo "Tidak terdeteksi ada file rc.local di /etc/"
else
echo "File rc.local di folder /etc/ dibuka"
nano /etc/rc.local
fi
;;
22) exit
;;
*) echo "Maaf, menu tidak ada"
esac
echo ""
echo "X-code Anti Admin (Root access only)"
echo "Oleh Kurniawan. xcode.or.id. E-mail : [email protected]"
echo ""
echo -n "Kembali ke menu? [y/n]: ";
read again;
while [ $again != 'Y' ] && [ $again != 'y' ] && [ $again != 'N' ] && [ $again != 'n' ];
do
echo "Masukkan yang anda pilih tidak ada di menu";
echo -n "Kembali ke menu? [y/n]: ";
read again;
done
done