-4

我需要什么:

telnet 1.1.1.1 (no password or login required)
#connected
telnet localhost 1234
command_1
command_2
command_3
exit
exit

有什么办法可以在 bash 或 python 上编写它?

4

1 回答 1

2

You can pass input to telnet using a pipe. At your shell:

$ echo "echo -e 'command_1\ncommand_2\ncommand_3' | telnet localhost 1234" | telnet 1.1.1.1
于 2013-04-19T20:24:21.053 回答