Hmm, depending on what that login page looks like, this one could be tricky...
Some questions so I can try to understand how this works...
- How do you get to the login page? Does it have a specific URL that you need to visit every 24 hours? Or does it just pop up when you try to visit some other page but you need to authenticate? Its a URL that pops up when the 24hrs are over and any webpage i try to access redirects me to this intranet URL
- What is the URL of the login page?
- Does it use HTTP or HTTPS? its HTTP
- Can you reauthenticate more than once every 24 hours? Yes. I can manually log out and then login
- Can you post the source code of the login page as an attachment? yes. Attached
USERNAME=your_username_here \
PASSWORD=your_password_here \
HOST=reliancebroadband.co.in \
URL=/reliance/login.do?action=doLoginSubmit \
sh -c 'CONTENT="userId=$USERNAME&password=$PASSWORD"; CONTENT_LENGTH=`echo $CONTENT|wc -c`; REQUEST="POST $URL HTTP/1.0\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: $CONTENT_LENGTH\r\n\r\n$CONTENT"; echo -en $REQUEST | nc $HOST 80'
See if running this from the router is able to log you in:
This is a single command that you can paste into an SSH session. You'll need to put your username and password in there of course...Code:USERNAME=your_username_here \ PASSWORD=your_password_here \ HOST=reliancebroadband.co.in \ URL=/reliance/login.do?action=doLoginSubmit \ sh -c 'CONTENT="userId=$USERNAME&password=$PASSWORD"; CONTENT_LENGTH=`echo $CONTENT|wc -c`; REQUEST="POST $URL HTTP/1.0\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: $CONTENT_LENGTH\r\n\r\n$CONTENT"; echo -en $REQUEST | nc $HOST 80'
If your username or password contain any characters that need to be URL encoded, we'll need to deal with those... See this page for a list of characters.
-Vince
USERNAME=your_username_here \
PASSWORD=your_password_here \
HOST=reliancebroadband.co.in \
URL=/reliance/login.do \
QUERY=?action=doLoginSubmit \
sh -c 'CONTENT="userId=$USERNAME&password=$PASSWORD"; CONTENT_LENGTH=`echo $CONTENT|wc -c`; REQUEST="POST $URL$QUERY HTTP/1.1\r\nHost: $HOST\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: $CONTENT_LENGTH\r\nReferrer: http://$HOST$URL\r\nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\r\nConnection: close\r\n\r\n$CONTENT"; echo -en "REQUEST:\r\n$REQUEST\r\n\r\n"; echo RESPONSE:; echo -en $REQUEST | nc $HOST 80'
Well, darn.
Try this:Code:USERNAME=your_username_here \ PASSWORD=your_password_here \ HOST=reliancebroadband.co.in \ URL=/reliance/login.do \ QUERY=?action=doLoginSubmit \ sh -c 'CONTENT="userId=$USERNAME&password=$PASSWORD"; CONTENT_LENGTH=`echo $CONTENT|wc -c`; REQUEST="POST $URL$QUERY HTTP/1.1\r\nHost: $HOST\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: $CONTENT_LENGTH\r\nReferrer: http://$HOST$URL\r\nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\r\nConnection: close\r\n\r\n$CONTENT"; echo -en "REQUEST:\r\n$REQUEST\r\n\r\n"; echo RESPONSE:; echo -en $REQUEST | nc $HOST 80'
And post the entire output (if your username and password are numbers, replace them with all zeros, but keep the length the same).
Also, did you try logging out first?
Thanks,
Vince
Hmm, the site is setting a cookie. I wonder if that has something to do with it. Try disabling cookies in your web browser and see if that breaks your ability to login from the browser...
-Vince
#!/bin/sh
USERNAME=your_username_here
PASSWORD=your_password_here
HOST=reliancebroadband.co.in
URL=/reliance/login.do
QUERY=?action=doLoginSubmit
CONTENT="userId=$USERNAME&password=$PASSWORD"
CONTENT_LENGTH=`echo $CONTENT|wc -c`
HEADERS="Host: $HOST\r\nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\r\nConnection: close\r\n"
REQUEST="GET $URL HTTP/1.1\r\n$HEADERS\r\n"
echo -en "REQUEST:\r\n$REQUEST\r\n\r\n"
echo RESPONSE:
RESPONSE=`echo -en $REQUEST | nc $HOST 80`
echo "$RESPONSE"
COOKIES=`echo "$RESPONSE"|grep -i ^Set-Cookie:|sed -e "s/Set-Cookie: \?/\1/" -e "s/;.*//"|tr -s '\r\n' \;|sed -e "s/;$//"`
HEADERS="${HEADERS}Cookie: $COOKIES\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: $CONTENT_LENGTH\r\nReferrer: http://$HOST$URL\r\n"
REQUEST="POST $URL$QUERY HTTP/1.1\r\n$HEADERS\r\n$CONTENT"
echo -en "REQUEST:\r\n$REQUEST\r\n\r\n"
echo RESPONSE:
echo -en $REQUEST | nc $HOST 80
Eh, nothing's impossible.
Put this into something like login.sh and run it:
Code:#!/bin/sh USERNAME=your_username_here PASSWORD=your_password_here HOST=reliancebroadband.co.in URL=/reliance/login.do QUERY=?action=doLoginSubmit CONTENT="userId=$USERNAME&password=$PASSWORD" CONTENT_LENGTH=`echo $CONTENT|wc -c` HEADERS="Host: $HOST\r\nUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\r\nConnection: close\r\n" REQUEST="GET $URL HTTP/1.1\r\n$HEADERS\r\n" echo -en "REQUEST:\r\n$REQUEST\r\n\r\n" echo RESPONSE: RESPONSE=`echo -en $REQUEST | nc $HOST 80` echo "$RESPONSE" COOKIES=`echo "$RESPONSE"|grep -i ^Set-Cookie:|sed -e "s/Set-Cookie: \?/\1/" -e "s/;.*//"|tr -s '\r\n' \;|sed -e "s/;$//"` HEADERS="${HEADERS}Cookie: $COOKIES\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: $CONTENT_LENGTH\r\nReferrer: http://$HOST$URL\r\n" REQUEST="POST $URL$QUERY HTTP/1.1\r\n$HEADERS\r\n$CONTENT" echo -en "REQUEST:\r\n$REQUEST\r\n\r\n" echo RESPONSE: echo -en $REQUEST | nc $HOST 80
This will make two HTTP requests. The first one to get any cookies and the second one will use those cookies and log in.
Definitely getting fancy for a shell script.
admin@RT-N16:/tmp/mnt/Elements/Router# sh login.sh
: not foundine 2:
: not foundine 8:
: not foundine 11:
REQUEST:
HTTP/1.1ance/login.do
Host: reliancebroadband.co.in
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Connection: close
RESPONSE:
'c: bad address 'reliancebroadband.co.in
: not foundine 18:
: not foundine 21:
REQUEST:
HTTP/1.1ance/login.do
Host: reliancebroadband.co.in
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Connection: close
RESPONSE:
'c: bad address 'reliancebroadband.co.in
admin@RT-N16:/tmp/mnt/Elements/Router#
Hmm, something isn't right here... Can you double-check the script file?
Maybe run "cat login.sh" and post a screenshot...
sed -i 's/\r//' login.sh
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!