cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Questions on wifi portal login

From: Ben Greear <greearb_at_candelatech.com>
Date: Fri, 22 Feb 2013 10:18:26 -0800

On 02/22/2013 10:00 AM, Fabian Keil wrote:
> Ben Greear <greearb_at_candelatech.com> wrote:
>
>> I've been trying to get a slightly hacked version of curl to do
>> an automated login to a wifi hotspot type of thing, but to date,
>> I'm not having too much luck.
>>
>> I suspect part of the problem might be javascript related, but maybe
>> it's user error. The final page I get from the AP talks about enabling
>> cookies..though it seems they are properly enabled in curl.
>>
>> Does anyone see anything obviously wrong with this script below?
>
> Did you already compare the resulting requests with the ones
> made by a browser?

Sort of..but the AP is using https, redirects, and other
trickery, so it's a bit tricky...

> I'm currently writing a script to automatically extend my library
> loans and the login procedure seems to require (besides cookies and
> login data) the following steps:
>
> 1. Request the start page to scrape some kind of object id.
> 2. Use the object id from the previous page to request the
> login form and scrape another object id.
> 3. Use the object id from the previous page to submit the
> login data.
>
> Not following these steps results in a misleading plain text
> message and even after the login most pages require an object id
> from a previous page and can't be accessed out of order as the
> server seems to use some kind of state machine.
>
> Maybe your AP expects a similar login dance.

Probably so... I scraped IDs and such, but must be
missing some step or another...

>
>> And second, are there any suggestions for doing something like scripting
>> a 'real' browser such as firefox or google-chrome so that any funny javascript
>> stuff is automatically taken care of? I'd have to integrate c-ares and
>> hack the device & IP bindings into a browser...so not sure how hard
>> that would be...
>
> I don't remember the details, but a while ago I saw a presentation
> about controlling Firefox with a cpan module through a telnet-like
> interface.

Thanks, I'll look into that!

Ben

-- 
Ben Greear <greearb_at_candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-22