[Tutor] Capture telnet output to a file?

Bill Campbell bill at celestial.net
Mon Oct 16 19:53:31 CEST 2006

On Mon, Oct 16, 2006, dpotter at nc.rr.com wrote:
>I am trying to capture telnet output to a file.  For example I want to
>telnet into a router and run the command ?show arp? and be able to
>capture all the arp information that normally would show up on the
>screen to a file on my system.    I am using python and pexpect to
>backup my router configurations on a daily basis, but for this the
>router has the option to send the configuration via tftp to a server,
>there is no option to send normal screen data to a file.  Any ideas?

One could use the ``script'' program in *NIX systems which
captures your entire session.

I haven't used pexpect with python yet, but the perl expect
module can also be used to capture things like this, and I would
expect that one could do this with pexpect as well.

INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``If the personal freedoms guaranteed by the Constitution inhibit the
government's ability to govern the people, we should look to limit those
   -President Bill Clinton, August 12, 1993

More information about the Tutor mailing list