View previous topic :: View next topic |
Author |
Message |
khendon Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 19 Mar 2003 Posts: 80
|
Posted: Tue Mar 25, 2003 11:22 am Post subject: Automatically loggin on to a network with cgi? |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
de4d Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 12 Sep 2002 Posts: 181 Location: fr. i. br. (ger)
|
Posted: Tue Mar 25, 2003 1:15 pm Post subject: |
|
|
what about
Code: |
wget <yourfunnycgiURL>
|
in /etc/ppp/ip-up ? _________________ void main(){fork();main();} |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
khendon Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 19 Mar 2003 Posts: 80
|
Posted: Tue Mar 25, 2003 1:48 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
khendon Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 19 Mar 2003 Posts: 80
|
Posted: Tue Mar 25, 2003 1:56 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
thehyperintelligentslug n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/13470167103eba876205054.png)
Joined: 30 Jun 2002 Posts: 49 Location: Edinburgh
|
Posted: Tue Mar 25, 2003 5:14 pm Post subject: |
|
|
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
Should fix that. _________________ Cheers,
Neil.
---
http://www.thehyperintelligentslug.co.uk |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
acidreign Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 21 Apr 2002 Posts: 122 Location: Brisbane, Australia
|
Posted: Tue Mar 25, 2003 11:07 pm Post subject: CPAN |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
bumpus n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/16510410863e5bdd21d16bd.jpg)
Joined: 14 Feb 2003 Posts: 64 Location: Cedar Rapids, IA, USA
|
Posted: Wed Mar 26, 2003 2:30 am Post subject: wget should work |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Dalrain Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 02 Jul 2002 Posts: 136 Location: Wooster, OH USA
|
Posted: Wed Mar 26, 2003 5:22 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|