aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/boca-auth-runs4
-rw-r--r--tools/boca-outmanage4
-rw-r--r--tools/boca-submit-logroot4
-rwxr-xr-xtools/boca-submit-run-aux149
-rwxr-xr-xtools/singlefilebkp.sh6
5 files changed, 88 insertions, 79 deletions
diff --git a/tools/boca-auth-runs b/tools/boca-auth-runs
index 3155b90..b6f7881 100755
--- a/tools/boca-auth-runs
+++ b/tools/boca-auth-runs
@@ -40,13 +40,13 @@ for i in wget sha256sum cut; do
done
temp=/tmp/.temp.`date +%s%N`.txt
-md=`wget --no-check-certificate -t 2 -T 7 -S https://$BOCASERVER/boca/getcode.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
+md=`wget -4 --no-check-certificate -t 2 -T 7 -S https://$BOCASERVER/boca/getcode.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
echo "$md" | grep -q PHPSESS
if [ "$?" == "0" ]; then
md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
ress=`echo -n $pass | sha256sum - | cut -f1 -d' '`
res=`echo -n "${ress}${md}" | sha256sum - | cut -f1 -d' '`
- wget --no-check-certificate -t 2 -T 7 "https://$BOCASERVER/boca/getcode.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
+ wget -4 --no-check-certificate -t 2 -T 7 "https://$BOCASERVER/boca/getcode.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
grep -qi incorrect $temp
if [ $? == 0 ]; then
echo ""
diff --git a/tools/boca-outmanage b/tools/boca-outmanage
index 58c8cfe..b4ecd2d 100644
--- a/tools/boca-outmanage
+++ b/tools/boca-outmanage
@@ -55,7 +55,7 @@ if [ ! -f /root/.ssh/$BOCASERVER -o ! -f /root/.ssh/$BOCASERVER.pub -o ! -f /roo
ress=`echo -n $pass | sha256sum - | cut -f1 -d' '`
fi
- md=`wget --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/updatessh.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
+ md=`wget -4 --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/updatessh.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
echo "$md" | grep -q PHPSESS
if [ "$?" == "0" ]; then
md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
@@ -67,7 +67,7 @@ if [ ! -f /root/.ssh/$BOCASERVER -o ! -f /root/.ssh/$BOCASERVER.pub -o ! -f /roo
echo -n "&data=" >> $temp
cat /root/.ssh/$BOCASERVER.pub | uuencode -m zzzzzzzzzz | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> $temp
- wget --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/updatessh.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
+ wget -4 --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/updatessh.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
rm -f $temp
rm -f ${temp}.cookie.txt
grep -qi incorrect ${temp}.out
diff --git a/tools/boca-submit-logroot b/tools/boca-submit-logroot
index 901da3c..836225e 100644
--- a/tools/boca-submit-logroot
+++ b/tools/boca-submit-logroot
@@ -32,7 +32,7 @@ if [ "$res" != "0" ]; then
fi
done
temp=/root/.temp.`date +%s%N`.txt
- md=`wget --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/logexternal.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
+ md=`wget -4 --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/logexternal.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
echo "$md" | grep -q PHPSESS
if [ "$?" == "0" ]; then
md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
@@ -44,7 +44,7 @@ if [ "$res" != "0" ]; then
echo -n "&data=" >> $temp
grep "^>" /root/.logroot.diff | uuencode -m zzzzzzzzzz | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> $temp
- wget --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/logexternal.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
+ wget -4 --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/logexternal.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
rm -f $temp
rm -f ${temp}.cookie.txt
grep -qi incorrect ${temp}.out
diff --git a/tools/boca-submit-run-aux b/tools/boca-submit-run-aux
index 9376462..9983750 100755
--- a/tools/boca-submit-run-aux
+++ b/tools/boca-submit-run-aux
@@ -4,90 +4,99 @@ export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
[ -r "$1" ] && . "$1"
if [ "$BOCASERVER" == "" -o "$user" == "" -o "$pass" == "" -o "$data" == "" -o "$name" == "" ]; then
- echo "parameters missing in file $1"
- exit 1
+ echo "parameters missing in file $1"
+ exit 1
fi
if [ "$problem" == "" -o "$language" == "" ]; then
- echo "parameters missing in file $1"
- exit 1
+ echo "parameters missing in file $1"
+ exit 1
fi
for i in uuencode wget tr perl sha256sum cut; do
- p=`which $i`
- if [ -x "$p" ]; then
- echo -n ""
- else
- echo "$i" not found
- exit 1
- fi
+ p=`which $i`
+ if [ -x "$p" ]; then
+ echo -n ""
+ else
+ echo "$i" not found
+ exit 1
+ fi
done
temp=/tmp/.temp.`date +%s%N`.txt
-md=`wget --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/index.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
+md=`wget -4 --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/index.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1`
echo "$md" | grep -q PHPSESS
if [ "$?" == "0" ]; then
- md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
- res=`echo -n $pass | sha256sum - | cut -f1 -d' '`
- res=`echo -n "${res}${md}" | sha256sum - | cut -f1 -d' '`
- wget --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
- grep -qi incorrect $temp
- if [ $? == 0 ]; then
- echo "$BOCASERVER: User or password incorrect"
- rm -f $temp
- rm -f ${temp}.cookie.txt
- exit 3
+ md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'`
+ res=`echo -n $pass | sha256sum - | cut -f1 -d' '`
+ res=`echo -n "${res}${md}" | sha256sum - | cut -f1 -d' '`
+ wget -4 --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O $temp 2>/dev/null >/dev/null
+ grep -qi incorrect $temp
+ if [ $? == 0 ]; then
+ echo "$BOCASERVER: User or password incorrect"
+ rm -f $temp
+ rm -f ${temp}.cookie.txt
+ exit 3
+ else
+ oknet=9
+ if [ -f /usr/bin/boca-checkinternet ]; then
+ /usr/bin/boca-checkinternet
+ oknet=$?
else
- echo -n "name=`echo -n $name | perl -MURI::Escape -lne 'print uri_escape($_)'`" > $temp
- if [ "$uniq" != "" ]; then
- echo -n "&pastcode=$uniq" >> $temp
- if [ "$code" != "" ]; then
- echo -n "&pasthash=$code" >> $temp
- fi
- if [ "$dateerr" != "" ]; then
- echo -n "&pastabs=${dateerr}" >> $temp
- let "dateerr = `date +%s` - $dateerr"
- echo -n "&pastval=${dateerr}" >> $temp
- comp="error"
- if [ -r /root/submissions/comp ]; then
- comp=`cat /root/submissions/comp`
- fi
- echo -n "&comp=${comp}" >> $temp
- if [ -r /root/submissions/code ]; then
- code=`cat /root/submissions/code`
- res=`echo -n "${code}${uniq}${comp}${dateerr}" | sha256sum - | cut -f1 -d' '`
- echo -n "&pastvalhash=${res}" >> $temp
- fi
- fi
+ echo "system must be updated - missing script"
+ exit 4
+ fi
+ echo -n "name=`echo -n $name | perl -MURI::Escape -lne 'print uri_escape($_)'`" > $temp
+ if [ "$uniq" != "" ]; then
+ echo -n "&pastcode=$uniq" >> $temp
+ if [ "$code" != "" ]; then
+ echo -n "&pasthash=$code" >> $temp
+ fi
+ if [ "$dateerr" != "" ]; then
+ echo -n "&pastabs=${dateerr}" >> $temp
+ let "dateerr = `date +%s` - $dateerr"
+ echo -n "&pastval=${dateerr}" >> $temp
+ comp="error"
+ if [ -r /root/submissions/comp ]; then
+ comp=`cat /root/submissions/comp`
fi
- echo -n "&problem=`echo -n $problem | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
- echo -n "&language=`echo -n $language | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
- echo -n "&data=`echo -n $data | tr -d ' ' | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
- wget --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/team/run.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
-
- res=`tail -n1 ${temp}.out`
- echo $res | grep -q "RESULT:"
- if [ "$?" == "0" ]; then
-# if [ "$uniq" == "" ]; then
- echo "$BOCASERVER : $res"
-# else
-# echo "$BOCASERVER : run code $uniq dateerr $dateerr : $res"
-# fi
- else
-# if [ "$uniq" == "" ]; then
- echo "$BOCASERVER : error to upload the run, will NOT try again, check details at /tmp/boca-submit.err"
-# else
-# echo "$BOCASERVER : run $uniq dateerr $dateerr : error to upload the run, will NOT try again, check details at /tmp/boca-submit.err"
- cat ${temp}.out > /tmp/boca-submit.err
- chmod 400 /tmp/boca-submit.err
-# fi
- rm -f ${temp}.out
- exit 4
+ echo -n "&comp=${comp}" >> $temp
+ if [ -r /root/submissions/code ]; then
+ code=`cat /root/submissions/code`
+ res=`echo -n "${code}${uniq}${comp}${dateerr}" | sha256sum - | cut -f1 -d' '`
+ echo -n "&pastvalhash=${res}" >> $temp
fi
- rm -f ${temp}.out
+ fi
fi
- [ -f "$temp" ] && rm -f "$temp"
- rm -f ${temp}.cookie.txt
+ echo -n "&oknet=`echo -n $oknet | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
+ echo -n "&problem=`echo -n $problem | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
+ echo -n "&language=`echo -n $language | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
+ echo -n "&data=`echo -n $data | tr -d ' ' | perl -MURI::Escape -lne 'print uri_escape($_)'`" >> $temp
+ wget -4 --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/team/run.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null
+
+ res=`tail -n1 ${temp}.out`
+ echo $res | grep -q "RESULT:"
+ if [ "$?" == "0" ]; then
+ # if [ "$uniq" == "" ]; then
+ echo "$BOCASERVER : $res"
+ # else
+ # echo "$BOCASERVER : run code $uniq dateerr $dateerr : $res"
+ # fi
+ else
+ # if [ "$uniq" == "" ]; then
+ echo "$BOCASERVER : error to upload the run, will NOT try again, check details at /tmp/boca-submit.err"
+ # else
+ # echo "$BOCASERVER : run $uniq dateerr $dateerr : error to upload the run, will NOT try again, check details at /tmp/boca-submit.err"
+ cat ${temp}.out > /tmp/boca-submit.err
+ chmod 400 /tmp/boca-submit.err
+ # fi
+ rm -f ${temp}.out
+ exit 4
+ fi
+ rm -f ${temp}.out
+ fi
+ [ -f "$temp" ] && rm -f "$temp"
+ rm -f ${temp}.cookie.txt
else
- exit 2
+ exit 2
fi
exit 0
diff --git a/tools/singlefilebkp.sh b/tools/singlefilebkp.sh
index 2358a84..6cd9ba5 100755
--- a/tools/singlefilebkp.sh
+++ b/tools/singlefilebkp.sh
@@ -22,14 +22,14 @@ if [ "$1" == "" ]; then
fi
if [ -r "$1" ]; then
-md=`wget --no-check-certificate -S https://$BOCASERVER/boca/index.php -O /dev/null --save-cookies /tmp/.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1 | cut -f2 -d'=' | cut -f1 -d';'`
+md=`wget -4 --no-check-certificate -S https://$BOCASERVER/boca/index.php -O /dev/null --save-cookies /tmp/.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1 | cut -f2 -d'=' | cut -f1 -d';'`
echo -n "User: "
read user
echo -n "Password: "
read pass
res=`echo -n $pass | md5sum - | cut -f1 -d' '`
res=`echo -n "${res}${md}" | md5sum - | cut -f1 -d' '`
-wget --no-check-certificate "https://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies /tmp/.cookie.txt --keep-session-cookies --save-cookies /tmp/.cookie.txt -O /tmp/.temp.txt 2>/dev/null >/dev/null
+wget -4 --no-check-certificate "https://$BOCASERVER/boca/index.php?name=${user}&password=${res}" --load-cookies /tmp/.cookie.txt --keep-session-cookies --save-cookies /tmp/.cookie.txt -O /tmp/.temp.txt 2>/dev/null >/dev/null
grep -qi incorrect /tmp/.temp.txt
if [ $? == 0 ]; then
echo User or password incorrect
@@ -37,7 +37,7 @@ else
nom=`echo -n $1 | perl -MURI::Escape -lne 'print uri_escape($_)'`
echo -n "name=${nom}&data=" > /tmp/.temp.txt
uuencode -m zzzzzzzzzz < $1 | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> /tmp/.temp.txt
-wget --no-check-certificate "https://$BOCASERVER/boca/team/getfile.php" --load-cookies /tmp/.cookie.txt --keep-session-cookies -O /dev/null --post-file=/tmp/.temp.txt >/dev/null 2>/dev/null
+wget -4 --no-check-certificate "https://$BOCASERVER/boca/team/getfile.php" --load-cookies /tmp/.cookie.txt --keep-session-cookies -O /dev/null --post-file=/tmp/.temp.txt >/dev/null 2>/dev/null
fi
rm -f /tmp/.temp.txt
rm -f /tmp/.cookie.txt