On 4/28/2011 7:09 AM, Allan Pinto wrote:
>
> Hi,
> i run a lot telnet scripts using /dev/tcp for cisco routers, lately we
> have newer models of cisco routers which have ios-xr which is based on
> linux and also some mikrotik routers which are again based on linux,
> on these devices when i run my script all i get is  ÿý^Xÿý
> ÿý#ÿý'ÿý$ÿý! in my output, no username prompt, on the same device if
> if use a netcat -T option which is for telnet negotiation, it works,
> Could anyone guide me in the right direction where i can achieve the
> same using /dev/tcp
> below example script
>
> #!/bin/bash
>
> exec 3<>/dev/tcp/$1/23
> sleep 1
> echo -e "username">&3
> echo -e "password">&3
> echo -e "sh ver">&3
> #sleep 2
> echo -e "logout">&3
> cat<&3 > $1.txt
>

Hi,

Telnet is not just a pipe.  It is a real protocol.  Though, rather a 
simple one.
What you see is a telnet options negotiation.
See http://www.faqs.org/rfcs/rfc854.html for details.

Ilya Bobyr

Reply via email to