Skip to content

Instantly share code, notes, and snippets.

@soreana
Last active December 28, 2018 16:07
Show Gist options
  • Save soreana/394807793e9810ec0e0b14f6daaf6e72 to your computer and use it in GitHub Desktop.
Save soreana/394807793e9810ec0e0b14f6daaf6e72 to your computer and use it in GitHub Desktop.
Scripts to login in University of Tehran Hotspot network.
38,0-1 84%
#!/bin/bash
# Copyright 2018 Sina Kashipazha (sina_kashipazha@ut.ac.ir)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Manual :
# Make this this script executable by chmod +x login.sh and run it with ./login.sh [login|logout] to authenticate in UT
# hotspot. `./login.sh login` command will instruct you through login process and `./login.sh logout` will logout of the
# hotsopt.
# My recommendation is to put this file in /usr/local/bin or /usr/local/sbin by `sudo cp ~/path/to/login.sh /usr/local/bin/cas`
# command to globally add it for all users.
if [ "$1" == "logout" ] ; then
curl http://internet.ut.ac.ir/logout? > /dev/null && \
echo "done."
exit 0
fi
# Ask the user for their username
echo Please enter your UT email without @ut.ac.ir:
read username
echo It\'s nice to meet you $username :\)
# read pasword
echo -n Password:
read -s password
echo
curl -XPOST -d "username=$username&password=$password&dst=http://google.com" "https://internet.ut.ac.ir/login" > /dev/null && \
curl https://google.com > /dev/null && \
echo "done."
38,0-1 84%
#!/bin/bash
# Copyright 2018 Sina Kashipazha (sina_kashipazha@ut.ac.ir)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Manual :
# Make this this script executable by chmod +x login.sh and run it with ./login.sh [login|logout] to authenticate in UT
# hotspot. `./login.sh login` command will instruct you through login process and `./login.sh logout` will logout of the
# hotsopt.
# My recommendation is to put this file in /usr/local/bin or /usr/local/sbin by `sudo cp ~/path/to/login.sh /usr/local/bin/cas`
# command to globally add it for all users.
if [ "$1" == "logout" ] ; then
curl http://internet.ut.ac.ir/logout? > /dev/null && \
echo "done."
exit 0
fi
# Ask the user for their username
echo Please enter your UT email without @ut.ac.ir:
read username
echo It\'s nice to meet you $username :\)
# read pasword
echo -n Password:
read -s password
echo
curl -XPOST -d "username=$username&password=$password&dst=http://google.com" "https://internet.ut.ac.ir/login" > /dev/null && \
curl https://google.com > /dev/null && \
echo "done."
#!/bin/bash
# Copyright 2018 Sina Kashipazha (sina_kashipazha@ut.ac.ir)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Manual :
# Make this this script executable by chmod +x login.sh and run it with ./login.sh [login|logout] to authenticate in UT
# hotspot. `./login.sh login` command will instruct you through login process and `./login.sh logout` will logout of the
# hotsopt.
# My recommendation is to put this file in /usr/local/bin or /usr/local/sbin by `sudo cp ~/path/to/login.sh /usr/local/bin/cas`
# command to globally add it for all users.
if [ "$1" == "logout" ] ; then
curl http://internet.ut.ac.ir/logout?
exit 0
fi
# Ask the user for their username
echo Please enter your UT email without @ut.ac.ir:
read username
echo It\'s nice to meet you $username :\)
# read pasword
echo -n Password:
read -s password
echo
curl -XPOST -d "username=$username&password=$password&dst=http://google.com" "https://internet.ut.ac.ir/login" && \
curl https://google.com && \
echo "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment