Cross platform solution for automating ncurses-type telnet sessions
Background
Part of my work in networking and telco involves automating telnet sessions when legacy hardware doesn't offer easy solutions in other interfaces. Many older pieces of equipment can only be accessed via craft ports (RS-232 serial ports), SNMP, or telnet. Sometimes telnet is the only way to access specific information, however telnet is designed as a human interface and thus requires screen scraping. In addition, there is also the issue of scraping screens where only portions are updated in order to save bandwidth (see ncurses). In my work I have used ActiveState Expect and the Python telnet library.
Question
Which languages and libraries are able to automate telnet sessions and have the following requirements:
- Suitable for large projects (e.g. Tcl doesn't seem to scale开发者_运维技巧 as well as Python in my experience and seems outdated)
- Cross Platform (e.g. Pexpect does not work on Windows and Activestate Expect behaves differently on Windows plus requires DEP on newer machines to be turned off)
- Able to screen scrape sessions that repaint portions of the screen (similar to the behavior of ncurses in command-line programs)
- Free as in beer!
A preferable solution would also include the following:
- Easily redistributable (e.g. Does not require some huge runtime to be installed on a machine.)
- Also works for SSH, serial connections, and other command-line interfaces.
Take a look at demos/Expect/term_expect in the ActiveTcl distribution. It emulates a cursor-addressable terminal and allows you to test output at specific screen locations. Check out the example screen-scraping code at the end of the file.
精彩评论