Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Automatically loggin on to a network with cgi?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
khendon
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2003
Posts: 80

PostPosted: Tue Mar 25, 2003 11:22 am    Post subject: Automatically loggin on to a network with cgi? Reply with quote

My ISP today introduced what they choose to call a new "feature" meaning that I now have to open a web browser and log on using a login page at https://194.47.121.1/index.html before my internet connection starts working. It sends the login data to https://194.47.121.1/cgi-bin/login.cgi and once that's done, my internet connection works.

What I'd like to know is if there is some way to simplify this process. Can the login data be sent to the cgi-script directly via some URL? Or is there another way it can be done?

The problem is described in https://forums.gentoo.org/viewtopic.php?t=34019&highlight=telia+adsl (in swedish though) but the methods described there are for another ISP and I can't get them to work with mine.

Any help appreciated.
Back to top
View user's profile Send private message
de4d
Apprentice
Apprentice


Joined: 12 Sep 2002
Posts: 181
Location: fr. i. br. (ger)

PostPosted: Tue Mar 25, 2003 1:15 pm    Post subject: Reply with quote

what about
Code:

wget <yourfunnycgiURL>

in /etc/ppp/ip-up ?
_________________
void main(){fork();main();}
Back to top
View user's profile Send private message
khendon
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2003
Posts: 80

PostPosted: Tue Mar 25, 2003 1:48 pm    Post subject: Reply with quote

Don't think that'll work, as far as I understand it just typing in some URL won't work with the POST method for sending data to cgi scripts.
Back to top
View user's profile Send private message
khendon
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2003
Posts: 80

PostPosted: Tue Mar 25, 2003 1:56 pm    Post subject: Reply with quote

I was given this script from someone:

!/usr/bin/perl

use LWP::UserAgent;

my $ua = LWP::UserAgent -> new;
my $req =HTTP::Request -> new(POST => "https://194.47.121.1/cgi-bin/login");
$req->content_type('application/x-www-form-urlencoded");
$req->content("login=mylogin&password=mypassword");

my $res = $ua -> request($req);
if ($res -> is_success)
{
print "Success\n";
}
else
{
print "Error\n";
}

But it gives me an error saying "Can't locate LWP/UserAgent.pm in @INC (@INC contains.... lots of stuff).

I'm unfamiliar with perl, so I'm not really sure what to do about that.
Back to top
View user's profile Send private message
thehyperintelligentslug
n00b
n00b


Joined: 30 Jun 2002
Posts: 49
Location: Edinburgh

PostPosted: Tue Mar 25, 2003 5:14 pm    Post subject: Reply with quote

Quote:
But it gives me an error saying "Can't locate LWP/UserAgent.pm in @INC (@INC contains.... lots of stuff).

I'm unfamiliar with perl, so I'm not really sure what to do about that.


I think an

Code:
emerge libwww-perl


Should fix that.
_________________
Cheers,

Neil.

---
http://www.thehyperintelligentslug.co.uk
Back to top
View user's profile Send private message
acidreign
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 122
Location: Brisbane, Australia

PostPosted: Tue Mar 25, 2003 11:07 pm    Post subject: CPAN Reply with quote

Young jedi, you have much to learn. CPAN is the perl masters friend, learn it, use it well.

You can instantiate the CPAN module in perl, by issuing the following commands command

perl -MCPAN -e shell

You will then be asked a series of probing questions, this is the first test. After answering the questions successfully, you must then go on to install the module.

This can be acheieved by issuing the following command at the CPAN prompt.

install LW:P::UserAgent

This is the second test, this may fetch dependancies, and this may test your patience young jedi. Feel the binary flow, be one with the binary. A jedi knight you will become.
Back to top
View user's profile Send private message
bumpus
n00b
n00b


Joined: 14 Feb 2003
Posts: 64
Location: Cedar Rapids, IA, USA

PostPosted: Wed Mar 26, 2003 2:30 am    Post subject: wget should work Reply with quote

More than likely you'll be able to URL encode the post data. Most cgi programs don't actually check to see if the data really came from a post action. In your case you should be able to add
Code:
wget http://194.47.121.1/cgi-bin/login.cgi?login=YOURUSERNAME&password=YOURPASSWORD

and I think that'll do it for you.
_________________
-------------
Just because I can.
Back to top
View user's profile Send private message
Dalrain
Tux's lil' helper
Tux's lil' helper


Joined: 02 Jul 2002
Posts: 136
Location: Wooster, OH USA

PostPosted: Wed Mar 26, 2003 5:22 pm    Post subject: Reply with quote

Just a quick comment, I agree CPAN is a wonderful thing, but the e-builds have a nice effect of upgrading when you're doing your world updates. (Assuming the the e-builds are updated...) Not that perl modules change much, but sometimes there can be an advantage to the e-build as well. (As seen in time saved by not configuring the module yourself, and just watching it fly by in an install.)

Yes, I use CPAN for everything else, but for a home machine...e-builds are good things. Use them wisely.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum