Skip to content

Instantly share code, notes, and snippets.

@ruden
Created May 18, 2016 06:24
Show Gist options
  • Save ruden/e05d22c1152dc1325236317650deb724 to your computer and use it in GitHub Desktop.
Save ruden/e05d22c1152dc1325236317650deb724 to your computer and use it in GitHub Desktop.
Web authorization for Nodeny billing system
#!/bin/sh
HOST="your host"
USERNAME="your login"
PASSWORD="your password"
URL="https://$HOST/cgi-bin/stat.pl"
ses()
{
echo `wget --no-check-certificate -qO- $URL | grep -Eo -e '[0-9]{5,7}'`
}
hex_md5()
{
echo -n "$1 $2" | md5sum - | awk '{print $1}'
}
SES=`ses`;
PP=`hex_md5 $SES $PASSWORD`
while true;
do
auth_result=`wget --no-check-certificate -q -O- "$URL?uu=$USERNAME&a=98&pp=$PP"`;
echo $auth_result | grep -q 'meta http-equiv="refresh"'
if [ 0 -ne $? ];
then
SES=`ses`;
PP=`hex_md5 $SES $PASSWORD`
fi;
sleep 40;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment