Cross platform solution for automating ncurses-type telnet sessions

你离开我真会死。 提交于 2019-12-20 01:13:19

问题


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.

回答1:


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.



来源:https://stackoverflow.com/questions/2060420/cross-platform-solution-for-automating-ncurses-type-telnet-sessions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!