How to automate interactive telnet commands?

青春壹個敷衍的年華 提交于 2020-01-02 18:54:51

问题


I would like to query a telnet server on port 105. What I have to do currently is start an interactive session and enter the commands later one by one.

Since I already know the commands, I would like to automate this process and fetch the results without any manual intervention.

When I try to use pipe to push commands at the time of logging in, this doesn't work. Any help is highly appreciated.


回答1:


You are probably looking for a tool like expect.




回答2:


Since you do not say what OS you use, and what kind of script language you want to use I will just provide a few suggestions for further reading.

this questions might answer what you are looking for.

Also I found this that could help you out a bit.



来源:https://stackoverflow.com/questions/13340530/how-to-automate-interactive-telnet-commands

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