Ubuntu: bash script to login to webpage



Question:

I am trying to login into this page but I cannot for the life of me get it to work. I have to login to this site when i connect to my school's wifi in order to start a session.

So far ive tried to use bash and cUrl to achieve this but have only achieved to give myself a headache. will cUrl work or am I on the wrong track? Any help is greatly appreciated!

Thanks,

N

Here's what i tried:

curl --cookie-jar cjar --output /dev/null http://campus.fsu.edu/webapps/login/    curl --cookie cjar --cookie-jar cjar \      --data 'username=foo' \      --data 'password=bar' \      --data 'service=http://campus.fsu.edu/webapps/login/' \      --data 'loginurl=http://campus.fsu.edu/webapps/login/bb_bb60/logincas.jsp' \      --location \      --output ~/loginresult.html \          http://campus.fsu.edu/webapps/login/  


Solution:1

Easiest way to bash login:

wget --save-cookies cookies.txt --keep-session-cookies --post-data="username=foo&password=bar" "http://some.site/login.php"  

Although some websites may have some restrictions to login like this.


Solution:2

You can try this even in Yahoo prompt bash ... you will get a login accepted

curl --user name:password http://mail.yahoo.com -v   

curl is the way to do it in bash.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »