[nzlug] Telnet in all it's... hmm.... greatness?
Nick 'Zaf' Clifford
zaf at nrc.co.nz
Tue Jun 10 11:56:24 NZST 2008
The other thing I've done in that case is use the web page interface
instead of telnet.
Believe it or not, its often easier.
Because you know the page will never change its format (unless you
upgrade its firmware), you can basically pull out anything the webpage
displays easily.
The commandToTryAndStartPPP will probably be a HTTP POST, which you can
send easily enough with a perl script.
That said, its probably "better" to use the telnet interface, as thats
kinda what it was suppose to be for.
Nick
Nevyn wrote:
> Hi Guys,
>
> Another little interesting question.
>
> Along with that router script which I mentioned in another script,
> I've been able to get my router to sometimes connect PPP again by
> using it's telnet interface. However, there are some serious flaws in
> the script. At the moment, it doesn't test the state of adsl before
> trying to bring up PPP so if the router's just been rebooted, it kind
> of does not so good things.... It also can't exit cleanly from the
> telnet session (there's no exit or quit command and logout leaves you
> with a login prompt) but that's a whole other post...
>
> The way I've got the script communicating with the device is from
> something in a post on here a couple of weeks back. It goes something
> along the lines of:
>
> (
> sleep 1
> echo username
> sleep 1
> echo password
> sleep 1
> commandToTryAndStartPPP
> sleep 10
> echo logout
> ) | telnet $ROUTER
> kill `pidof telnet` # I don't think this is such a good idea. Need to
> figure out how to a) exit cleanly or b) grab the PID of just this
> telnet session or c) to leave the session open and have the script
> just use that session everytime it wants to communicate with the
> router
>
>
> So it's communication one way. I would like it to be able to get the
> status of ADSL before attempting to connect PPP, to be able to then
> check to see if the PPP status has changed at all and if it hasn't to
> try something else. Is there anyway to process the output of a telnet
> session run in this way?
>
> Regards,
> Nevyn.
>
> _______________________________________________
> NZLUG mailing list NZLUG at linux.net.nz
> http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
>
More information about the NZLUG
mailing list