| christoph_un@cenonet.de 2007-11-28, 7:07 pm |
| Hello,
I managed to reconnect my WRT54GL via perl from my Linux box.
Here is my script:
#!/usr/bin/perl -w
use strict;
use warnings;
use LWP;
use HTTP::Request::Common;
our $ua = LWP::UserAgent->new;
$ua->request(POST 'http://admin:letmein@192.168.10.10/apply.cgi',
[submit_button => 'Status_Router', submit_type => 'Disconnect_pppoe',
change_action => 'gozila_cgi', wan_proto => 'pppoe']);
sleep 5;
$ua->request(POST 'http://admin:letmein@192.168.10.10/apply.cgi',
[submit_button => 'Status_Router', submit_type => 'Connect_pppoe',
change_action => 'gozila_cgi', wan_proto => 'pppoe']);
This might not work for your router right away, but you may tweak it
to
your own needs. The important thing is setting the correct POST
variables. A network sniffer like Wireshark (www.wireshark.org) is
really handy for that. Just sniff a disconnect and right click on any
of
the packets of your HTTP Session and choose "Follow TCP stream". On
top
of the output you will find the whole header and beneath it there is a
line with all the POST variables. Mine looked like this:
submit_button=Status_Router&submit_type=Disconnect_pppoe&change_action=gozila_cgi&wan_proto=pppoe
Repeat this procedure for connecting and you are done.
Also make sure which script is called (first line of the header). My
Status_Router.asp did not call itself but apply.cgi.
Note that my way of parsing username and password via URL is really
insecure so only use it in a trusted network.
Greetings,
Christoph
|