Created
June 2, 2018 05:42
-
-
Save pulsejet/263914cc5b7de4b3bdaeb490eb0cfa32 to your computer and use it in GitHub Desktop.
Script to login to IITB Network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -n $1 ]] | |
then | |
UNAME=$1 | |
else | |
read -p 'Username: ' UNAME | |
[[ -z $UNAME ]] && exit 1 | |
fi | |
if [[ -n $2 ]] | |
then | |
PASSWD=$2 | |
else | |
read -sp 'Password: ' PASSWD | |
[[ -z $PASSWD ]] && exit 1 | |
fi | |
wget --no-proxy --quiet --post-data="uname=$UNAME&passwd=$PASSWD&submit=button" \ | |
https://internet.iitb.ac.in/index.php -O - | \ | |
grep -q window.location.href && \ | |
echo 'Logged in!' || \ | |
echo "Something's wrong." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment