Babbzzz
Babbzzz

Reputation: 194

Shell script to log into a particular site

I need to login to the Internet Access Portal of our college to get access to the Internet. (Cyberoam) I need to keep this window opened all the time. The address is http://192.168.0.1:8090/httpclient.html I need to enter the username and password there to login.

I'm new to scripting. I need help make a script which: 1. Opens Lynx 2. Goes to: http://192.168.0.1:8090/httpclient.html 3. Automatically enters my username and password 4. Keeps me logged in

I need to do this because it is a pain to log in manually each time. If my browser needs updating, it won't update as I don't have internet access yet.

Upvotes: 1

Views: 2648

Answers (1)

Dheerendra
Dheerendra

Reputation: 1568

Use curl to post your username and password.

curl --data "login=userid&pass=password" http://192.168.0.1:8090/httpclient.html.

EDIT:

I am assuming your college is using Cyberoam. In this case you need to keep open a window with login portal.
then for using lynx

echo "login=userid&pass=password\n--\n" | lynx -post_data http://192.168.0.1:8090/httpclient.html

should work.

EDIT:

This answer may be useful for your case as well.

EDIT:

Comeup with an another answer that may help you, since other didn't worked for you. I used curl with lynx for this one.

curl -d "login=userid&pass=password" http://192.168.0.1:8090/httpclient.html | lynx -stdin

Even after this if you see a login window then refresh the page and there will be no login window. I have tried this for many sites and this worked for all.

Upvotes: 1

Related Questions