0
我用pyserial在python连接到思科控制台端口:回声控制台连接
>>> import serial
>>> console = serial.Serial('COM5')
>>> console.read(console.inWaiting())
''
>>> console.write('sh ip inter brie\n')
17L
>>> console.read(console.inWaiting())
'sh ip inter brie\r\nInterface IP-Address OK? Method Statu
s Protocol\r\nFastEthernet0 unassigned YES NVRA
M up down \r\nFastEthernet1 unassigned
YES manual up down \r\nBRI0 unassign
ed YES NVRAM administratively down down \r\nBRI0:1
unassigned YES unset administratively down down \r\nBRI0:2
unassigned YES unset administratively down down \r\nFastEtherne
t2 unassigned YES unset up down \r\nFas
tEthernet3 unassigned YES unset up down
\r\nFastEthernet4 unassigned YES unset up
down \r\nFastEthernet5 unassigned YES unset up
down \r\nFastEthernet6 unassigned YES unset up
down \r\nFastEthernet7 unassigned YES unse
t up down \r\n --More-- '
>>>
它的工作原理很好,除了有回复回音。有没有办法禁用它?
你是什么意思*“有回声在回复”*?我能看到的是对你的命令的回应。 – SiHa
我发送命令'sh ip inter brie \ n'并且响应以'sh ip inter brie \ r \ n'开头。没有理由将命令发回给我。我知道可以在telnet中关闭回显,我可以在控制台连接中查看是否有可能 – Ivan