Script to disconnect Linksys WRT54G wireless router on Windows

Oooooooops. I'm still *searching* the Internet for a method that works. So, I haven't given up; I've just concluded Perl isn't able to perform the three-step task of

  • going to a certain web page
  • logging into an https connection
  • press a particular button

I've downloaded some of the suggested Windows freeware and am seeing if that will do it.

I've given up on the Perl tutorial for doing the three steps above so I do thank you all for your kind help. I know you didn't have to help me. You have edified me more than I could have done so myself. This is my last post on the subject, having concluded what I should have known before I started.

That's the one thing you should have told me but I don't blame you. If it can't be done, only the ones who have tried would know. Right?

Wilson

Reply to
Wilson
Loading thread data ...

Pathologically Eclectic Rubbish Lister

Reply to
DTC

You're just so incompetent and ridiculous, that I'm believing, you not only know really nothing about Perl and HTTPS, but you also even know nothing about pressing buttons ;-)

BTW: to press Buttons "on the router" with Perl, maybe you need an extra "module":

formatting link
SCNR, VB.

Reply to
Volker Birk

Have you tried using

formatting link
If the web page served by the router is being too clever (and they *always* seem to be) then this may help.

Ben

Reply to
Ben Morrow

You're in way over your head and nobody here owes it to you to solve your programming problems. Since your biggest difficulty is lack of Perl experience, you might try perl.beginners.

People there will be more likely to help if they can be sure this is purely a Perl-programming problem. If you haven't done so already, get the original reboot script working before making any modifications. That will verify that Perl and its libraries are properly installed and configured, that nothing in Windows networking (or maybe a local firewall?) is keeping Perl from talking to the network, that the router is reachable by Perl, that the username/password pair is working as expected, and that Perl can successfully issue commands to the router. Then if your script doesn't work, you know that the problem lies somewhere in your modifications to the reboot script.

Reply to
tramp

Are you being deliberately argumentative?

WWW::Mechanize is *very* capable of all of the above. You need to be a Perl programmer to know how to use it, of course. If you're not, that means that

*you* aren't able to perform the above tasks in Perl - it's a limitation of your own skill set, not a limitation of Perl.

Wrong. The above steps *can* be done in the general sense, by anyone with a little bit of Perl skill.

If someone *with* that skill tried to do so with this particular router, and posted a specific reason why the attempt failed - then I would agree with the assessment that it can't be done.

When someone who admits to not having any Perl knowledge, and to not being a programmer at all, claims to know what Perl is capable of, I have serious doubts about that claim. Someone who's at that level simply doesn't have the experience or background to reasonably assess Perl's capabilities.

sherm--

Reply to
Sherman Pendley

agreed. That's why I'm asking here.

agreed. I'm asking anyone with a Linksys WRT54G router to just run the script once and report back if they see the same issue.

agreed. However an experienced programmer wrote the original script & it failed to reboot the router.

It is and is not a perl-programming problem. If Perl can't do it (which I seriously suspect), then it's not a perl programming problem, I agree. We can't really ask perl to do what it just can not do.

The original perl script never worked for anyone, not even the original programmer. He did his best. So did I. Both failed.

I agree - we need to verify this somehow. What would be a good way to verify that an https web page can be accessed via a perl script and a button on that https web page pressed?

I've turned off the software firewall for the testing

Another good one. What is the basic test of that?

Yet another good one. How would we test this?

Ah. This is the big kehuna. Can perl issue commands to a router or not?

The reboot script never worked even for the original programmer. He said it was the best he could do in perl.

Reply to
Wilson

Hi Ben, You were the only one, it seems, who actually offered real help that pushed this project forward. I appreciate that.

I'm still trying some avenues but have lost most of my trust in perl as there are no working scripts I can find to test it on my router. If I could only find a working script for a Linksys router that did anything - it would give me confidence in that approach.

I have a couple more ideas going that I am trying and if perl continues to fail me, I will use the method you denoted and as always, post the results so everyone benefits from the exchange of information.

Thank you Ben for helping me and by doing so, helping the next person with the same request!

Reply to
Wilson

Hi Sherman,

I understand your argument, however, one (or all) of us is missing the main point (maybe I didn't make it well enough so I'll try again).

I don't know if it will push this project forward to continue to "discuss" without actually progressing - but - my main point was there is no evidence in the literature that it has ever been done with a Linksys WRT54G router.

... no evidence in the literature that perl works for this purpose ...

That's a pretty strong statement given how prevalent the Linksys WRT54G router is and how common Perl programming seems to be.

... there is no working script on the Internet that anyone has posted ...

At least nobody has ever posted a solution for logging into https Linksys WRT54G (other than me and my script didn't work) - so my main point is that there is absolutely no evidence that perl can do these two steps: a) Log into the Linksys WRT54G as https b) Press a button

I'm not asking anyone to "program" for me but if they already have a script that does this - please just post it and we all would benefit from the proof.

Either that, or just run my posted script and let us know if you get the SAME errors I posted.

It's all just talk which gets us nowhere forward unless someone posts a script that works or tries the script that didn't work.

Wilson

Reply to
Wilson

Quoth Wilson :

Don't be ridiculous: it almost certainly can, you just don't know how, and we don't have the router in question or don't care enough to find out.

About the only case where it's non-trivial to fake a browser's request with Perl is when the page includes JavaScript that changes what is about to be submitted in a non-trivial way. This would require that you write a piece of Perl that has the same effect as the given piece of JS: if you can't see that that is always possible, then you shouldn't be attempting to write a program at all.

Download and install WSP that I pointed you to previously, set it as your proxy, do whatever it is you are trying to do with your browser, and WSP will write you a Perl program that does the same thing. That's what it's for :).

s/unless.*/until you stop making unfounded assertions about things you don't understand and start trying to find out what requests the router will actually respond to./s;

Ben

Reply to
Ben Morrow

Hi Ben, As before, you seem to be on to something here as the one posting the most wisdom. I turned off javascript and java in my browser and guess what? I could log into my Linksys WRT54G router but I could NOT access any of the buttons. The web page was "garbled" (for lack of a better description) without Javascript and/or Java.

Hmmmm... does this mean that Perl can "impersonate" java somehow?

Wilson

Reply to
Wilson

You claimed that Perl can't log into an https server and simulate a button click. My point is that this claim is false; that kind of "web scraping" is a very common use of Perl.

Absence of proof is not proof of absence.

In a generic sense, there are literally hundreds of examples of Perl doing what you claim it can't do - just google for "WWW::Mechanize" or "perl web scraping" to see them. There is absolutely no question that Perl is capable of logging into an https web server and performing the moral equivalent of a button click.

I have a different model Linksys. I could adapt the script you posted to work with my own router, and post that as "proof," but that wouldn't be useful for you. It wouldn't work for *your* router, because mine is quite old and it's quite likely that its admin interface is arranged differently.

The odds of your finding someone who owns the exact same model router, *and* is capable of writing a script like this, are very small. You'll need to start with a script that was originally written for another make and model router, and adapt it to fit the admin interface for your own router.

I think your problem is one of unrealistic expectations. There is no standard for browser-based router interfaces, and you can't reasonably expect a script in *any* language that was written for a different router to work unchanged with yours.

sherm--

Reply to
Sherman Pendley

Do you understand how http works? The client makes a request, and the server returns a response. There is no way the server can tell if the client is IE with javascript or something else that just happens to make the same requests in the same order. For the last time: *you need to find out what requests your browser is actually making*. Then you can begin working out how to reproduce them from Perl, which will almost certainly be straightforward.

Ben

Reply to
Ben Morrow

FWIW this isn't a proof. It merely shows that /to date/ nobody smart enough or interested enough has looked into it.

For three hundred years Fermat's Last Theorem stood unproven. That doesn't mean it was impossible to prove. Someday someone will prove the Riemann Hypothesis too.

Reply to
Mark McIntyre

My WRT54G (v8.00.2) is not configured the same as yours so I can not test the script for you. Nor does my device connect directly to the internet, rather it sits behind my DSL modem. No connect/disconnect buttons.

FWIW, by using Win32::Internet on a WinXPsp2 using Perl 5.6.1, I can "click" the 'DHCP Clients Table' button located under Status | Local Network.

Perhaps you should try cURL within a batch file and forgo the programming, but you will still need to know how call a web site outside of a web browser -- same as if you were using Perl.

Reply to
l v

Can you post that Perl script? I'd love to try it out on my Linksys WRT54G wireless router!

Reply to
Wilson

Hi lv, My WRT54G also sits "behind" a DSL modem.

If you navigate to the Linksys WRT54G "Status -> Router" page, do you see the "Disconnect" or "Connect" button?

This connects or disconnects from the DSL modem (depending on whether you are already connected or disconnected).

Reply to
Wilson

OK. Agreed.

Reply to
Wilson

Even web pages which seem to require "javascript" in order to view the buttons?

BTW, I tested the router - it does not need java; just javascript.

Reply to
Wilson

Hi Ben, I'm working on it. Thanks Wilson

Reply to
Wilson

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.