Networking Forums

Networking Forums > Wireless Networking > Wireless Internet > Script to disconnect Linksys WRT54G wireless router on Windows

Reply
Thread Tools Display Modes

Script to disconnect Linksys WRT54G wireless router on Windows

 
 
Wilson
Guest
Posts: n/a

 
      11-19-2007, 04:15 PM
Is there an existing wireless router linksys WRT54G script out there that
will run from Windows XP and hit the 'connect' & 'disconnect' button?

For example, I'd like to disconnect my wireless router (firmware 1.02.0) by
clicking on a single shortcut to replace the multiple button presses today.

That shortcut would (perhaps using wget or some other idea):
1. Connect to the wireless router IP address (https://192.168.0.1)
2. Log in with a blank username & enter 'letmein' as the password
3. Navigate to the "Status -> Router" Linksys WRT54G web page
4. Press the "Login Status = Disconnect" button

A similar shortcut would reconnect on demand.

Is "wget" the best way to accomplish this?

I can't believe I'm the first person to need this so some kind wireless guy
must have done this already. I googled for "linksys wrt54g connect script"
and found something called "slackware" in addition to "wget" but I'm not a
programmer so I would like to start with an existing script that does
SOMETHING like hit any button on the Linksys WRT54G router. Once I have
that, I can probably modify that program to do what I want.

I did find http://www.seattlewireless.net/index.cgi/LinksysWrt54g
interesting but I did not understand most of the detail (I have a lot to
learn).

Does anyone have a script that runs on windows that will connect to
https://192.168.x.y to then hit a button on the Linksys WRT54G router?
 
Reply With Quote
 
 
 
 
Jack \(MVP-Networking\).
Guest
Posts: n/a

 
      11-19-2007, 04:41 PM
Hi
Routers are propriety devices there is No one universal way to control them.
As a result you cab expect Windows as an OS to be programmed to control
every Independent 3rd party device.
If it really important you can learn simple scripting, or pay some one to do
it.
If you just want to disconnect a computer from the Router you can use the
IPCONFOG /release command.
http://www.ezlan.net/iprel.html
Jack (MVP-Networking).

"Wilson" <(E-Mail Removed)> wrote in message
newswj0j.46096$(E-Mail Removed) et...
> Is there an existing wireless router linksys WRT54G script out there that
> will run from Windows XP and hit the 'connect' & 'disconnect' button?
>
> For example, I'd like to disconnect my wireless router (firmware 1.02.0)
> by
> clicking on a single shortcut to replace the multiple button presses
> today.
>
> That shortcut would (perhaps using wget or some other idea):
> 1. Connect to the wireless router IP address (https://192.168.0.1)
> 2. Log in with a blank username & enter 'letmein' as the password
> 3. Navigate to the "Status -> Router" Linksys WRT54G web page
> 4. Press the "Login Status = Disconnect" button
>
> A similar shortcut would reconnect on demand.
>
> Is "wget" the best way to accomplish this?
>
> I can't believe I'm the first person to need this so some kind wireless
> guy
> must have done this already. I googled for "linksys wrt54g connect script"
> and found something called "slackware" in addition to "wget" but I'm not a
> programmer so I would like to start with an existing script that does
> SOMETHING like hit any button on the Linksys WRT54G router. Once I have
> that, I can probably modify that program to do what I want.
>
> I did find http://www.seattlewireless.net/index.cgi/LinksysWrt54g
> interesting but I did not understand most of the detail (I have a lot to
> learn).
>
> Does anyone have a script that runs on windows that will connect to
> https://192.168.x.y to then hit a button on the Linksys WRT54G router?


 
Reply With Quote
 
Jeff Liebermann
Guest
Posts: n/a

 
      11-19-2007, 05:01 PM
Wilson <(E-Mail Removed)> hath wroth:

>Is there an existing wireless router linksys WRT54G script out there that
>will run from Windows XP and hit the 'connect' & 'disconnect' button?


Sure. There are several Windoze "automation" tools. The one I like
to use is the ancient "Macro Recorder" from Windoze 3.1. However, I'm
not going to recommend this because of its age.

More modern incantations can be found at:
<http://www.kratronic.com/recorder/> ($23)
<http://www.aldostools.com/macro.html>
<http://www.jitbit.com/macrorecorder.aspx>
and so on. Search Google for "macro recorder" or "keystroke mouse
recorder". Lots to choose from.

You start the recorder, do whatever it takes with your mouse and
keyboard, stop the recorder when done, and save the macro. If you
want to repeat it again, just run the macro. Simple.

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.
The command to turn on/off the WAN connection could be:
ifconfig eth1 up
ifconfig eth1 down
or something like that.



--
Jeff Liebermann (E-Mail Removed)
150 Felker St #D http://www.LearnByDestroying.com
Santa Cruz CA 95060 http://802.11junk.com
Skype: JeffLiebermann AE6KS 831-336-2558
 
Reply With Quote
 
Wilson
Guest
Posts: n/a

 
      11-20-2007, 04:57 PM
On Mon, 19 Nov 2007 12:41:48 -0500, Jack (MVP-Networking). wrote:
> If you just want to disconnect a computer from the Router you can use the
> IPCONFOG /release command.
>> Does anyone have a script that runs on windows that will connect to
>> https://192.168.x.y to then hit a button on the Linksys WRT54G router?


Hi Jack,
I want to disconnect the router from the isp (not the pc from the router).
I dug some more and have some perl scripts (whatever perl is) and will see
if they will run on Windows.

Apparently they need to know the name of the Linksys WRT54G button. I
viewed the page source at https://192.168.1.0/StaRouter.htm and I think
that the button is called "connect" and then "disconnect".

I'll keep digging and asking questions and posting the answers as I find
them until we have a Linksys WRT54G script that runs from Windows to
a) Log into the Linksys WRT54G router
b) Navigate to the https://10.2.18.20/StaRouter.htm page
c) Press the disconnect button
d) Wait five or ten seconds
e) Press the connect button

This refreshes with a new IP address.

 
Reply With Quote
 
Wilson
Guest
Posts: n/a

 
      11-20-2007, 05:01 PM
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.
> The command to turn on/off the WAN connection could be:
> ifconfig eth1 up
> ifconfig eth1 down


Hi Jeff,
I know from googling that you are a God on this here newsgroup so I
appreciate your help even if I'm not quite sure how to install "DD-WRT".

I'll look it up and hopfully post an answer so the next guy can press a
button to log into the Linksys WRT54G router, navigate to the status router
page, press the disconnect button, wait five seconds, press the connect
button.

This will automatically get a new IP address (at least in my setup it does
when I do this manually).
 
Reply With Quote
 
Wilson
Guest
Posts: n/a

 
      11-20-2007, 05:44 PM
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
 
Wilson
Guest
Posts: n/a

 
      11-20-2007, 06:01 PM
Bearing in mind I don't know perl, in the previous perl script to press the
disconnect button on the Linksys WRT54G router ... do these changes seem
correct to you perl programmers?
-----
1. Log in from Windows to the Linksys WRT54G router with a blank username
and a password of "letmein".
INSTEAD OF:
> my $user='root';
> my $pass='letmein';

I WOULD USE:
my $user='';
$pass='letmein';
-----
2. Navigate to the Linksys WRT54G "Status -> Router" web page.
INSTEAD OF:
> my $adr='https://192.168.0.1/Services.asp'; # talk to this

I WOULD USE:
my $adr='https://192.168.0.1/StaRouter.htm'; # talk to this
-----
3. Press the disconnect button on that Status->Router web page.
INSTEAD OF:
> my $req = HTTP::Request->new(POST => $adr,
> ['action','reboot']);

I WOULD USE:
my $req = HTTP::Request->new(POST => $adr,
['action','disconnect']);
-----
4. Reconnect after a period of time, say 5 seconds.
INSTEAD OF:
my $req = HTTP::Request->new(POST => $adr,
['action','disconnect']);
I WOULD USE:
my $req = HTTP::Request->new(POST => $adr,
----- ['action','connect']);
Since I don't know perl (nor even how to run perl on Windows XP), I wish to
ask before trying to see if the approach seems like it will work for you.

Meanwhile, I'll try to get the script to work (so far, when I click on my
modified script, see below, it just brings up Notepad).

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 $adr='https://192.168.0.1/StaRouter.htm'; # talk to this
my $user='';
# my $pass='mypassword';
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']);
my $req = HTTP::Request->new(POST => $adr,
['action','disconnect']);

# I need to figure out how to wait 5 seconds in perl; then reconnect

my $req = HTTP::Request->new(POST => $adr,
['action','connect']);

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

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


# print the result
print $result->as_string;

# The end of a perl script to run on Windows to tell the Linksys WRT54G
# router to disconnect from the ISP; then after 5 seconds, to reconnect.
 
Reply With Quote
 
Wilson
Guest
Posts: n/a

 
      11-21-2007, 12:35 AM
It's not working yet - but it's closer than it was
Here is the tutorial so far.

STEP 1:
Install ActiveState activeperl freeware on Windows XP
http://www.activestate.com/Products/activeperl

STEP 2:
Modify script to use YOUR password for your Linksys WRT54G router review

STEP 3:
Run script

At this point, I get the following error.
I will google for this package and see if I can find it on the web.

501 Protocol scheme 'https' is not supported (Crypt::SSLeay not installed)
Content-Type: text/plain
Client-Date: Wed, 21 Nov 2007 01:22:38 GMT
Client-Warning: Internal response

LWP will support https URLs if the Crypt::SSLeay module is installed.
More information at <http://www.linpro.no/lwp/libwww-perl/README.SSL>.

Wilson


#!/usr/bin/perl -w
use strict;
my $adr='https://192.168.0.1/StaRouter.htm'; # talk to this
# my $user='root';
my $user=''; # the Linksys WRT54G wireless router doesn't have login name
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.
my $req = HTTP::Request->new(POST => $adr, ['action','disconnect']);
sleep 5;
my $req = HTTP::Request->new(POST => $adr, ['action','connect']);
$req->authorization_basic($user, $pass);
# send the request
my $result = $ua->request($req);
# print the result
print $result->as_string;
# The end of a perl script to run on Windows to tell the Linksys WRT54G
# router to disconnect from the ISP; then after 5 seconds, to reconnect.
 
Reply With Quote
 
Wilson
Guest
Posts: n/a

 
      11-21-2007, 01:00 AM
Here is my tutorial to press buttons on your router from the Windows
command line.

It's not working yet because I don't know how to modify the perl script to
load the Win32 OpenSSL package I installed in order to talk to https web
site.

Does anyone know what line to add to the script below in order to load the
Win32 OpenSSL freeware?

Wilson



----------------------------------------------------------
How to command your router from the Windows command line:
----------------------------------------------------------
0. Install ActiveState activeperl freeware on Windows XP
http://www.activestate.com/Products/activeperl
----------------------------------------------------------
1. Install Win32 OpenSSL freeware support for https URLs
http://www.openssl.org/related/binaries.html
------------------------------------------------------------
2. Add the following line to the perl script to load openssl
???? what is the line needed to load Win32 OpenSSL????
------------------------------------------------------------
3. Modify the script to press desired buttons on your router


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

# Linksys WRT54G Router automation button pressing script
# Read the cookbook
# http://search.cpan.org/~gaas/libwww-...05/lwpcook.pod
# Read the LWP reference
# http://search.cpan.org/~gaas/libwww-...805/lib/LWP.pm
# Read this too
# http://lwp.interglacial.com/ch05_05.htm

# my $adr='https://192.168.0.1/Services.asp'; # talk to this router
my $adr='https://192.168.0.1/StaRouter.htm'; # talk to this router

# my $user='root';
my $user=''; # the Linksys WRT54G wireless router doesn't have login name
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.
# my $req = HTTP::Request->new(POST => $adr, ['action','reboot']);
#
# A view source on the browser web page seems to indicate the disconnect
# button is named "disconnect" so I'll substitute that instead of "reboot".
my $req = HTTP::Request->new(POST => $adr, ['action','disconnect']);

# Wait five seconds and then run the next command
sleep 5;

my $req = HTTP::Request->new(POST => $adr, ['action','connect']);

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

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

# print the result
print $result->as_string;

# The end of a perl script to run on Windows to tell the Linksys WRT54G
# router to disconnect from the ISP; then after 5 seconds, to reconnect.
 
Reply With Quote
 
Ben Morrow
Guest
Posts: n/a

 
      11-21-2007, 01:08 AM

Quoth Wilson <(E-Mail Removed)>:
> It's not working yet - but it's closer than it was
> Here is the tutorial so far.
>
> STEP 1:
> Install ActiveState activeperl freeware on Windows XP
> http://www.activestate.com/Products/activeperl
>
> STEP 2:
> Modify script to use YOUR password for your Linksys WRT54G router review
>
> STEP 3:
> Run script
>
> At this point, I get the following error.
> I will google for this package and see if I can find it on the web.
>
> 501 Protocol scheme 'https' is not supported (Crypt::SSLeay not installed)


Under ActivePerl you can install Crypt::SSLeay with

C:\> ppm install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd

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


use warnings;

is better than -w nowadays.

> my $adr='https://192.168.0.1/StaRouter.htm'; # talk to this
> # my $user='root';
> my $user=''; # the Linksys WRT54G wireless router doesn't have login name
> 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.
> my $req = HTTP::Request->new(POST => $adr, ['action','disconnect']);


Huh? You surely want to do something with this request, like submit it
to $ua?

Ben

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wireless disconnect: linksys + microsoft windows TheFusionWarrior@gmail.com Wireless Internet 4 01-15-2007 10:44 AM
Linksys Wireless Broadband router (WRT54G-UK) Mooncat Broadband 10 09-11-2004 08:21 AM
Linksys WRT54G wireless router connected to BEFRS41 wired router BGates Linux Networking 2 09-09-2004 04:42 PM
Linksys WRT54G Wireless-G Router Issue Jonny Yen Wireless Internet 1 04-22-2004 10:41 AM
linksys wrt54g wireless router Wireless Internet 0 10-12-2003 12:13 AM



1 2 3 4 5 6 7 8 9 10 11