[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using curl/wget to call logout



On Friday 15 July 2016 10:28 AM, Jonathan Dowland wrote:
On Fri, Jul 15, 2016 at 05:40:40AM +0000, Bob wrote:
I'm trying to use curl to call the logout function of a logout button
already working through browser.
snip
already tried with

curl -c my.cookie  <link>/home.jsp
curl -X GET -c my.cookie <link>/Login.jsp?message=logout

but no success. How can I use curl/wget to logout through CLI ?
It would be helpful if instead of 'no success' you provided precisely what
did happen and what output/return code you got.

The problem here, or really the behaviour you are asking questions about, is
specific to whichever device you are trying to interact with, and is not really
a wget question. Without knowing the device, there's little we can do to help
you.

You might need to set HTTP Auth headers for the wget request. If that were the
case, the result of trying without would indicate that authentication was
required.

Cloning the session cookie from your browser won't work; the session management
code in your device is designed to prevent you doing that. You will likely need
to initiate a new session from a script, and use the cookie /that/ process sets
for the request to press the poweroff button.

You could try getting wget to set the referrer, you could also try asking wget
to use the same User-Agent string as your browser.


Hi Jonathan,

Thanks for your response. I need to login/out from a web-based form of ISP to enable/disable internet. I'm trying do the same from console with curl/wget. Now I have dig more and found following source code when logged in, wonder how to use it with curl/wget to call the logout function.

~~~

function logout(){
                var out = confirm ('Do you really want to Logout ?')
                    if(out){
                    document.forms["logoutForm"].submit();
                    }
            }
function logoutbut(){
                var out = confirm ('Do you really want to Logout ?')
                    if(out){
                    document.forms["logoutbut"].submit();
                    }
            }
~~~~

<form action="logoutUI.do" method="get" name="logoutForm" id="logoutForm" style="margin-top: 0px;">
Welcome<b> <USERNAME> </b> &nbsp;
&nbsp; <a href="javascript:logout();" style="background: url(&quot;logout.GIF&quot;) no-repeat;" onmouseover="return showStatus('text');">&nbsp;<u>Logout</u>&nbsp;</a> <input type="hidden" id="SeUserName" name="SeUserName" value="<USERNAME>"></form>
~~~~~

here <USERNAME> is provided by the ISP

regards,
Bob


Reply to: