diff options
| author | Cassio de Campos <cassiopc@gmail.com> | 2017-08-10 10:49:24 +0000 |
|---|---|---|
| committer | Cassio de Campos <cassiopc@gmail.com> | 2017-08-10 10:49:24 +0000 |
| commit | e926ad94df156c2a58e35e24d25229e0ab041aae (patch) | |
| tree | 38db549a3337693aefe30e99582383d5e853e2f9 /tools/boca-auth-runs | |
| parent | 02b4aacc81613792b0fa618692145dc1e2989e42 (diff) | |
| parent | 94c6cd12dacf9de46051c57e6f6bf216e86c8df8 (diff) | |
| download | boca-e926ad94df156c2a58e35e24d25229e0ab041aae.tar.gz boca-e926ad94df156c2a58e35e24d25229e0ab041aae.zip | |
Merge branch 'master' of github.com:cassiopc/boca
Diffstat (limited to 'tools/boca-auth-runs')
| -rwxr-xr-x | tools/boca-auth-runs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/boca-auth-runs b/tools/boca-auth-runs index 565bbd1..b4a3d8f 100755 --- a/tools/boca-auth-runs +++ b/tools/boca-auth-runs @@ -10,9 +10,13 @@ if [ "$BOCASERVER" == "" ]; then fi user="$1" if [ "$user" == "" ]; then - echo "parameter user missing" + echo "parameter user missing. Usage: $0 <user> [<optional-server-address>]" exit 1 fi +if [ "$2" != "" ]; then + BOCASERVER=$2 +fi +echo "Server at $BOCASERVER" read -s -p "Password: " pass for i in wget sha256sum cut; do @@ -26,17 +30,17 @@ for i in wget sha256sum cut; do done temp=/tmp/.temp.`date +%s%N`.txt -md=`wget -t 2 -T 5 -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 -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 -t 2 -T 5 "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 -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 "" - echo "$BOCASERVER: User or password incorrect" + echo "$BOCASERVER: User or password incorrect, or unconfigured server" rm -f $temp rm -f ${temp}.cookie.txt exit 3 |