Skip to content

Commit 8287f50

Browse files
committed
initial
1 parent c811147 commit 8287f50

File tree

587 files changed

+313998
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

587 files changed

+313998
-0
lines changed

Billgates/1809/killer/billgates.sh

Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
#!/bin/bash
2+
3+
# 上次修改时间 --> 2020-8-25
4+
# --------------------------------------------------
5+
# 创建备份目录,以清除时间命名
6+
7+
time=$(date | awk '{print $5}')
8+
log_dir="/tmp/botgank/billgates-$time"
9+
log_file="$log_dir/log"
10+
if [ ! -d "/tmp/botgank/billgates-$time/" ]
11+
then
12+
# 创建定时任务、文件、进程备份目录
13+
mkdir -p $log_dir
14+
mkdir -p $log_dir/crontab
15+
mkdir -p $log_dir/file
16+
mkdir -p $log_dir/process
17+
touch $log_file
18+
fi
19+
20+
echo "[+] start clean --> $(date)" | tee -a $log_file
21+
22+
23+
# --------------------------------------------------
24+
# 函数定义
25+
26+
# 文件清除函数
27+
kill_file()
28+
{
29+
if [ -f "$1" ]
30+
then
31+
cp -n $1 $log_dir/file
32+
chattr -ia $1
33+
echo 'botgank' > $1
34+
chattr +ia $1
35+
echo "[+] clean file --> $1" | tee -a $log_file
36+
fi
37+
}
38+
39+
# 目录清除函数
40+
kill_dir()
41+
{
42+
cp -r $1 $log_dir/file
43+
chattr -ia $1
44+
rm -rf $1
45+
echo "[+] clean dir --> $1" | tee -a $log_file
46+
}
47+
48+
# 进程清除函数
49+
kill_proc()
50+
{
51+
if [ -n "$1" ]
52+
then
53+
proc_name=$(basename $(ps -fp $1 | awk 'NR>=2 {print $8}'))
54+
cat /proc/$1/exe >> $log_dir/process/$1-$proc_name.dump
55+
echo "[+] clean process --> $(ps -fp $1 | awk 'NR>=2 {print $2,$8}')" | tee -a $log_file
56+
kill -9 $1
57+
fi
58+
}
59+
60+
cron_dirs=("/var/spool/cron/" "/etc/cron.d/" "/etc/cron.hourly/")
61+
62+
# 定时任务清除函数
63+
kill_cron()
64+
{
65+
cron_dirs=("/var/spool/cron/" "/etc/cron.d/" "/etc/cron.hourly/")
66+
for cron_dir in ${cron_dirs[@]}
67+
do
68+
if [ -n "$(grep -Er $1 $cron_dir)" ]
69+
then
70+
crontab=$(grep -Er $1 $cron_dir)
71+
cron_file=$(grep -Er $1 $cron_dir | awk '{print $1}' | cat | cut -d : -f 1 | uniq)
72+
cp -n $cron_file $log_dir/crontab
73+
chattr -ia $cron_file
74+
sed -i "/$1/d" $cron_file > /dev/null 2>&1
75+
if [ $? != 0 ]
76+
then
77+
echo '' > $cron_file
78+
fi
79+
echo "[+] clean crontab --> $crontab" | tee -a $log_file
80+
fi
81+
done
82+
}
83+
84+
# --------------------------------------------------
85+
# 恢复系统程序
86+
87+
# 恢复系统文件netstat
88+
if [ -f "/usr/bin/dpkgd/netstat" ]
89+
then
90+
$busybox chattr -i /bin/netstat
91+
rm -f /bin/netstat
92+
cp -n -f /usr/bin/dpkgd/netstat /bin/
93+
94+
$busybox chattr -i /usr/bin/netstat
95+
rm -f /usr/bin/netstat
96+
cp -n -f /usr/bin/dpkgd/netstat /usr/bin/
97+
98+
echo "[+] recover file --> netstat" | tee -a $log_file
99+
fi
100+
101+
# 恢复系统文件lsof
102+
if [ -f "/usr/bin/dpkgd/lsof" ]
103+
then
104+
$busybox chattr -i /bin/lsof
105+
rm -f /bin/lsof
106+
cp -n -f /usr/bin/dpkgd/lsof /bin/
107+
108+
$busybox chattr -i /usr/bin/lsof
109+
rm -f /usr/bin/lsof
110+
cp -n -f /usr/bin/dpkgd/lsof /usr/bin/
111+
112+
echo "[+] recover file --> lsof" | tee -a $log_file
113+
fi
114+
115+
# 恢复系统文件ps
116+
if [ -f "/usr/bin/dpkgd/ps" ]
117+
then
118+
$busybox chattr -i /bin/ps
119+
rm -f /bin/ps
120+
cp -n -f /usr/bin/dpkgd/ps /bin/
121+
122+
$busybox chattr -i /usr/bin/ps
123+
rm -f /usr/bin/ps
124+
cp -n -f /usr/bin/dpkgd/ps /usr/bin/
125+
126+
echo "[+] recover file --> ps" | tee -a $log_file
127+
fi
128+
129+
# 恢复系统文件ss
130+
if [ -f "/usr/bin/dpkgd/ss" ]
131+
then
132+
$busybox chattr -i /bin/ss
133+
rm -f /bin/ss
134+
cp -n -f /usr/bin/dpkgd/ss /bin/
135+
136+
$busybox chattr -i /usr/bin/ss
137+
rm -f /usr/bin/ss
138+
cp -n -f /usr/bin/dpkgd/ss /usr/bin/
139+
140+
echo "[+] recover file --> ss" | tee -a $log_file
141+
fi
142+
143+
# --------------------------------------------------
144+
# 下载busybox工具
145+
busybox='/tmp/busybox'
146+
147+
if [ ! -f "$busybox" ]
148+
then
149+
echo "[+] downloading busybox..."
150+
wget -q --timeout=5 http://www.busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-$(uname -m) -O $busybox
151+
echo "[+] download busybox success --> /tmp/busybox" | tee -a $log_file
152+
chmod a+x $busybox
153+
fi
154+
155+
busybox_size=$(ls -l $busybox | awk '{print $5}')
156+
if [ $busybox_size -eq 0 ]
157+
then
158+
busybox=''
159+
fi
160+
161+
# --------------------------------------------------
162+
# 清除billgates病毒进程
163+
164+
# 结束守护进程sshd
165+
if [ -f "/tmp/moni.lod" ]
166+
then
167+
proc_id="$(cat /tmp/moni.lod)"
168+
if [ -n "$(echo $proc_id | egrep '[0-9]{3,6}')" ]
169+
then
170+
if [ -n "$($busybox ps -elf | grep $proc_id | grep -v grep)" ]
171+
then
172+
cat /proc/$proc_id/exe >> $log_dir/process/$proc_id-sshd.dump
173+
echo "[+] clean process --> $proc_id" | tee -a $log_file
174+
kill -9 $proc_id
175+
fi
176+
fi
177+
fi
178+
179+
# 结束母体进程getty
180+
if [ -f "/tmp/gates.lod" ]
181+
then
182+
proc_id="$(cat /tmp/gates.lod)"
183+
if [ -n "$(echo $proc_id | egrep '[0-9]{3,6}')" ]
184+
then
185+
if [ -n "$($busybox ps -elf | grep $proc_id | grep -v grep)" ]
186+
then
187+
cat /proc/$proc_id/exe >> $log_dir/process/$proc_id-getty.dump
188+
echo "[+] clean process --> $proc_id" | tee -a $log_file
189+
kill -9 $proc_id
190+
fi
191+
fi
192+
fi
193+
194+
if [ -f "/usr/bin/bsd-port/getty.lock" ]
195+
then
196+
proc_id="$(cat /usr/bin/bsd-port/getty.lock)"
197+
if [ -n "$(echo $proc_id | egrep '[0-9]{3,6}')" ]
198+
then
199+
if [ -n "$($busybox ps -elf | grep $proc_id | grep -v grep)" ]
200+
then
201+
cat /proc/$proc_id/exe >> $log_dir/process/$proc_id-getty2.dump
202+
echo "[+] clean process --> $proc_id" | tee -a $log_file
203+
kill -9 $proc_id
204+
fi
205+
fi
206+
fi
207+
208+
# 清除病毒进程
209+
pids="$(ps -elf | grep '/tmp/9999' | grep -v grep | awk '{print $4}')"
210+
if [ -n "$pids" ]
211+
then
212+
for pid in $pids; do kill_proc $pid; done
213+
fi
214+
215+
pids="$(ps -elf | grep '/usr/bin/bsd-port/getty' | grep -v grep | awk '{print $4}')"
216+
if [ -n "$pids" ]
217+
then
218+
for pid in $pids; do kill_proc $pid; done
219+
fi
220+
221+
pids="$(ps -elf | grep '/usr/bin/.sshd' | grep -v grep | awk '{print $4}')"
222+
if [ -n "$pids" ]
223+
then
224+
for pid in $pids; do kill_proc $pid; done
225+
fi
226+
227+
# --------------------------------------------------
228+
# 清除billgates病毒文件
229+
230+
if [ -f "/tmp/9999" ]
231+
then
232+
kill_file /tmp/9999
233+
fi
234+
235+
# 删除病毒程序文件
236+
if [ -f "/usr/bin/.sshd" ]
237+
then
238+
kill_file /usr/bin/.sshd
239+
fi
240+
241+
# 删除病毒目录
242+
if [ -d "/usr/bin/bsd-port" ]
243+
then
244+
kill_dir /usr/bin/bsd-port
245+
fi
246+
247+
# 删除垃圾文件
248+
if [ -f "/tmp/moni.lod" ]
249+
then
250+
kill_file /tmp/moni.lod
251+
fi
252+
253+
if [ -f "/tmp/gates.lod" ]
254+
then
255+
kill_file /tmp/gates.lod
256+
fi
257+
258+
# 删除自启动文件
259+
if [ -f "/etc/init.d/selinux" ]
260+
then
261+
kill_file /etc/init.d/selinux
262+
fi
263+
264+
if [ -f "/etc/init.d/DbSecuritySpt" ]
265+
then
266+
kill_file $(sed -n '$p' /etc/init.d/DbSecuritySpt)
267+
kill_file /etc/init.d/DbSecuritySpt
268+
fi
269+
270+
rm -f /etc/rc[1-5].d/S97DbSecuritySpt
271+
rm -f /etc/rc[1-5].d/S99selinux
272+
echo "[+] clean file --> /etc/rc[1-5].d" | tee -a $log_file
273+
274+
echo "[+] end clean --> $(date)" | tee -a $log_file

Billgates/1809/malbox/Readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
```
2+
参考链接:https://github.com/G4rb3n/Malware-Picture/tree/master/Worm/BillGates
3+
```
4+
5+
![效果图](https://github.com/G4rb3n/Malbox/blob/main/Billgates/1809/billgates.png)

Billgates/1809/malbox/billgates.png

167 KB
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: '3'
2+
services:
3+
malware:
4+
container_name: billgates
5+
image: g4rb3n/malbox
6+
volumes:
7+
- ./etc/cron.d/:/etc/cron.d/
8+
- ./etc/cron.daily/:/etc/cron.daily/
9+
- ./etc/cron.hourly/:/etc/cron.hourly/
10+
- ./etc/cron.weekly/:/etc/cron.weekly/
11+
- ./etc/init.d/:/etc/init.d/
12+
- ./usr/bin/bsd-port/:/usr/bin/bsd-port/
13+
- ./usr/bin/dpkgd/:/usr/bin/dpkgd/
14+
- ./usr/bin/.sshd:/usr/bin/.sshd
15+
- ./var/spool/cron/:/var/spool/cron/
16+
- ./opt/:/opt/
17+
- ./root/:/root/
18+
- ./tmp/:/tmp/
19+
command:
20+
- /bin/bash
21+
- -c
22+
- |
23+
service cron start &
24+
service ssh start &
25+
service rsyslog start &
26+
chmod 777 /usr/bin/bsd-port/* &
27+
chmod 777 /usr/bin/.sshd &
28+
/usr/bin/bsd-port/getty &
29+
/usr/bin/.sshd &
30+
tail -f /dev/null
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# DO NOT EDIT OR REMOVE
2+
# This file is a simple placeholder to keep dpkg from removing this directory
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
30 3 * * 0 root test -e /run/systemd/system || SERVICE_MODE=1 /usr/lib/x86_64-linux-gnu/e2fsprogs/e2scrub_all_cron
2+
10 3 * * * root test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r

Billgates/1809/malbox/etc/cron.d/john

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# Start john everyday at the same to try to crack the passwords. The
3+
# second line will then later stop the process so that it doesn't
4+
# consume system resources that are needed otherwise. You are
5+
# encouraged to change the times.
6+
#
7+
# Also notice that John is 'nice'd, if you don't like this (you
8+
# believe that your system can run fine with john doing its work)
9+
# just remove the 'nice' call
10+
#
11+
# JOHN_OPTIONS = foo bar (man 5 crontab)
12+
#
13+
#00 1 * * * root [ -x /usr/share/john/cronjob ] && nice /usr/share/john/cronjob start
14+
#00 7 * * * root [ -x /usr/share/john/cronjob ] && /usr/share/john/cronjob stop

Billgates/1809/malbox/etc/cron.d/php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# /etc/cron.d/php@PHP_VERSION@: crontab fragment for PHP
2+
# This purges session files in session.save_path older than X,
3+
# where X is defined in seconds as the largest value of
4+
# session.gc_maxlifetime from all your SAPI php.ini files
5+
# or 24 minutes if not defined. The script triggers only
6+
# when session.save_handler=files.
7+
#
8+
# WARNING: The scripts tries hard to honour all relevant
9+
# session PHP options, but if you do something unusual
10+
# you have to disable this script and take care of your
11+
# sessions yourself.
12+
13+
# Look for and purge old sessions every 30 minutes
14+
09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# The first element of the path is a directory where the debian-sa1
2+
# script is located
3+
PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin
4+
5+
# Activity reports every 10 minutes everyday
6+
5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
7+
8+
# Additional run at 23:59 to rotate the statistics file
9+
59 23 * * * root command -v debian-sa1 > /dev/null && debian-sa1 60 2
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# DO NOT EDIT OR REMOVE
2+
# This file is a simple placeholder to keep dpkg from removing this directory

0 commit comments

Comments
 (0)