Skip to content

Instantly share code, notes, and snippets.

@pourmand1376
Last active May 1, 2024 07:03
Show Gist options
  • Save pourmand1376/965625a56c9e8ba4a82cd6f7dd98ed80 to your computer and use it in GitHub Desktop.
Save pourmand1376/965625a56c9e8ba4a82cd6f7dd98ed80 to your computer and use it in GitHub Desktop.
Sharif Login
function sharif_login
{
curl -d "username=$1&password=$2" -X POST "https://net2.sharif.edu/login" > /dev/null
curl -s https://net2.sharif.edu/status | grep -o '<td>.*</td>'
sleep 1s # To See login status
}
function sharif_ip
{
# from ping net2.sharif.edu
# this is written since sometimes DNS server doesn't work!
curl -d "username=$1&password=$2" -X POST -k "https://172.17.1.214/login" > /dev/null
curl -sk https://172.17.1.214/status | grep -o '<td>.*</td>'
sleep 1s # To See login status
}
function sharif_logout
{
curl -d "username=test&password=test" -X POST "https://net2.sharif.edu/logout"
sleep 1s
}
sharif_login1="sharif_login YourUsername Yourpassword"
sharif_ip1="sharif_ip YourUsername YourPassword"
alias 1="sharif_login1 && exit"
alias ۱="1"
@SaeedForoutan
Copy link

SaeedForoutan commented Feb 23, 2024

Thanks for this beneficial code! I found it really helpful. I have a suggestion to enhance it further – consider putting the sharif_login1 directly in an alias and removing the exit at the end. Here's a simplified version:

alias 1="sharif_login YourUsername Yourpassword"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment