View Single Post
  #6 (permalink)  
Old 11-20-2007, 06:44 PM
Wilson
Guest
 
Posts: n/a
Default Re: Script to disconnect Linksys WRT54G wireless router on Windows

On Mon, 19 Nov 2007 10:01:16 -0800, Jeff Liebermann wrote:
> Another way to do this is to install DD-WRT or OpenWRT on your WRT54G,
> and use various shell or expect scripts to turn the router on and off.


Hi Jeff,
Do you think this perl script modified to hit the disconnect & connect
button will work? I'm googling for just how I would change the script
below.

So far, I see the following changes needed:
1. I will google to see how to give the "null" set (blank?) as a login
2. I need to figure out how to press the disconnect button

Before I dig further, is this script below a good place to start in order
to create a Windows script that disconnects the Linksys WRT54G wireless
router from the ISP from a wireless portable PC client?

Wilson

#!/usr/bin/perl -w
use strict;

# check out this documentation:
# first, the cookbook
# http://search.cpan.org/~gaas/libwww-...05/lwpcook.pod
# the LWP reference
# http://search.cpan.org/~gaas/libwww-...805/lib/LWP.pm
# oh but this is JUST what we want
# http://lwp.interglacial.com/ch05_05.htm

my $adr='https://192.168.0.1/Services.asp'; # talk to this
my $user='root';
my $pass='letmein';

# make a User Agent
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;

# make a request object
# fill in the button name and value from
# looking at the page source.
# DD-WRT puts out a complicated page with Javascript that
# I don't understand how to deal with, so this doesn't work,
# but in principle (if I knew what to put in for action and reboot)
# it should.
my $req = HTTP::Request->new(POST => $adr,
['action','reboot']);

$req->authorization_basic($user, $pass);

# send the request
my $result = $ua->request($req);


# print the result
print $result->as_string;

Reply With Quote