Unix Technical Forum

Automating router http configuration

This is a discussion on Automating router http configuration within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> I have a router that is configured via a web browser (It's a Netgear). I need to change the ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 09:26 PM
Mr Balloon
 
Posts: n/a
Default Automating router http configuration

I have a router that is configured via a web browser (It's a Netgear).

I need to change the port forwarding options now and again, and so would
like to write a script to do this automatically, then I can just run the
script rather than firing up a browser.

I figure if I strip out the necessary HTML to make the changes (eg,
everything in the form) and submit this to the Netgear's port 80 (Along with
my login credentials in the form), this would make my life easier.

My query is, what could I achieve to do this.

Say I set up a couple of HTML files with the form data in, how could I
submit that? If I put something in the script to "lynx form.html" it'd only
display it on the screen, not submit the form as well.

Anyone achieved something similar to this before?


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-18-2008, 09:27 PM
Keith Keller
 
Posts: n/a
Default [OT] Re: Automating router http configuration

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2003-12-19, Mr Balloon <mrballoon@aol.com> wrote:
> I have a router that is configured via a web browser (It's a Netgear).
>
> I need to change the port forwarding options now and again, and so would
> like to write a script to do this automatically, then I can just run the
> script rather than firing up a browser.
>
> I figure if I strip out the necessary HTML to make the changes (eg,
> everything in the form) and submit this to the Netgear's port 80 (Along with
> my login credentials in the form), this would make my life easier.
>
> My query is, what could I achieve to do this.


You wouldn't strip out the HTML, but figure out what POST parameters the
Netgear wants. You can then use the Perl LWP modules to post that data
to the Netgear. These issues are all offtopic here, so I suggest
finding a CGI or (if you start coding in Perl) a Perl forum for your
questions.

- --keith

- --
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/4yxqhVcNCxZ5ID8RAo5CAKCcDfvncD9p47CcthMW6CY3yepdNA CeMqzR
mBNEzv6hdHCyQU8nVl4tObc=
=mvOa
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-18-2008, 09:27 PM
dcba@dcba.dcba.org
 
Posts: n/a
Default Re: [OT] Re: Automating router http configuration

Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1


pgp trash troll delete

> You wouldn't strip out the HTML, but figure out what POST
> parameters the Netgear wants. You can then use the Perl LWP
> modules to post that data to the Netgear. These issues are all
> offtopic here, so I suggest finding a CGI or (if you start coding
> in Perl) a Perl forum for your questions.


Here you are complaining about an off-topic posting and yet you are
using pgp which is against the policy of this ng.

cordially, as always,

rm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-18-2008, 09:28 PM
Menno Duursma
 
Posts: n/a
Default Re: [OT] Re: Automating router http configuration

On Fri, 19 Dec 2003 08:50:53 -0800, Keith Keller wrote:

> On 2003-12-19, Mr Balloon <mrballoon@aol.com> wrote:
>> I have a router that is configured via a web browser (It's a Netgear).
>>
>> I need to change the port forwarding options now and again, and so would
>> like to write a script to do this automatically, then I can just run the
>> script rather than firing up a browser.


I would think you should be able to do that via SNMP try net-snmp
( maybe from: http://linuxpackages.net ) for that.

>> I figure if I strip out the necessary HTML to make the changes (eg,
>> everything in the form) and submit this to the Netgear's port 80 (Along with
>> my login credentials in the form), this would make my life easier.


You could probably look at a valid connection (dumping the payload
with "ngrep", "sniffit" or some such) and script some ol' hackery with
"socket" or "nc" (netcat) ...

>> My query is, what could I achieve to do this.


Try the "-auth" and (maybe) "-post_data" flags to "lynx" -- man lynx .
What ever you do though, it will probably take some coding.

> You wouldn't strip out the HTML, but figure out what POST parameters the
> Netgear wants. You can then use the Perl LWP modules to post that data
> to the Netgear.


Maybe have a look at the scrips used for dynamically updateing DNS
records and modify them (if SNMP isn't available). Such as the "clients"
for dyndns.org

> These issues are all offtopic here,


Agreed.

> so I suggest finding a CGI


Wouldn't a CGI (common gateway interface) be server-side scriting -
in this scenario: on the router?

> or (if you start coding in Perl) a Perl forum for your questions.


Or, "expect" some "telnet" trick :-).

--
-Menno.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-18-2008, 09:28 PM
Keith Keller
 
Posts: n/a
Default Re: [OT] Re: Automating router http configuration

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2003-12-19, Menno Duursma <menno@desktop.lan> wrote:
>
> I would think you should be able to do that via SNMP try net-snmp
> ( maybe from: http://linuxpackages.net ) for that.


Not all routers support SNMP. I don't believe my Netgear ''router''
does.

> You could probably look at a valid connection (dumping the payload
> with "ngrep", "sniffit" or some such) and script some ol' hackery with
> "socket" or "nc" (netcat) ...


See below.

> Wouldn't a CGI (common gateway interface) be server-side scriting -
> in this scenario: on the router?


Well, the router has some sort of CGI program that processes the POST
data from the web browser. It is helpful to know how parts of an HTML
document will be processed by the CGI on the other end (or, at least,
what keys and values the CGI expects). But you're right, no particular
CGI knowledge is really needed; knowing which HTML tags will be
processed by the CGI is more important.

> Or, "expect" some "telnet" trick :-).


Ewww.

- --keith

- --
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD4DBQE/49BkhVcNCxZ5ID8RAhBDAJjR3XckNCY83XQbVhzGFkcG2euAAJ 9tEct9
oh0A//TevgvncU0cCOqzvA==
=rW/f
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-18-2008, 09:28 PM
dcba@dcba.dcba.org
 
Posts: n/a
Default Re: [OT] Re: Automating router http configuration

Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1


pgp trash troll delete

> On 2003-12-19, Menno Duursma <menno@desktop.lan> wrote:
> >
> > I would think you should be able to do that via SNMP try net-snmp
> > ( maybe from: http://linuxpackages.net ) for that.


> Not all routers support SNMP. I don't believe my Netgear ''router''
> does.


But doesn't the use of pgp interfere with SNMP? Perhaps you might
consider using pgp in a responsible manner in the future. We would
sure appreciate it.

cordially, as always,

rm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-18-2008, 09:28 PM
Fred Emmott
 
Posts: n/a
Default Re: [OT] Re: Automating router http configuration

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dcba@dcba.dcba.org wrote:

> Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1

>
> pgp trash troll delete
>
>> On 2003-12-19, Menno Duursma <menno@desktop.lan> wrote:
>> >
>> > I would think you should be able to do that via SNMP try net-snmp
>> > ( maybe from: http://linuxpackages.net ) for that.

>
>> Not all routers support SNMP. I don't believe my Netgear ''router''
>> does.

>
> But doesn't the use of pgp interfere with SNMP? Perhaps you might
> consider using pgp in a responsible manner in the future. We would
> sure appreciate it.
>
> cordially, as always,
>
> rm


For newsgroup searchers: No it doesn't interfere with SNMP, just our
resident anti-pgp troll :P

- --

Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.
*****---*Linus*Torvalds
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/5CBjDvn9hyzHIq4RAlLNAJ9mKLq24KSqO5Ldy8aarTv7T5Tr7Q CfRzP+
dfT1JGHSZunq3VLUXSmJSQ4=
=lVZs
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-18-2008, 09:29 PM
dcba@dcba.dcba.org
 
Posts: n/a
Default Re: [OT] Re: Automating router http configuration

Fred Emmott <pcfreak65@hotmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1


pgp trash troll delete

> For newsgroup searchers: No it doesn't interfere with SNMP, just
> our resident anti-pgp troll :P


There are several hundred "anti-pgp trolls" and we bring this issue
to light on their behalf.

Please refrain from the unwarranted use of pgp. It violates this
ng's policy, it violates our sensibilities, and it violates common
sense.

cordially, as always,

rm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:26 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com