2

我需要使用“telnet”连接到我的相机。我用过腻子,知道相机提示是'~ # '. 如果我执行'echo "test"',那么我期望得到响应'echo "test"\r\ntest\r\n'。但是 Exscript 的响应是'echo "test"\r\ntest\r\n~',包括提示的第一个字符'~'代码

from Exscript import Host, Account
from Exscript.protocols import Telnet, SSH2
username = "root"
password = ""
host = "192.168.200.99"
account = Account(username, password)
session = Telnet(debug=1)
session.connect(host)
session.set_prompt(r"~ # ")
session.login(account)
session.execute('echo "test"')
print((repr(session.response)))
session.close(True)

代码响应

generic: Attempting to authenticate root.
generic: Attempting to app-authenticate root.
shell: Protocol: driver replaced: generic -> shell
shell: Protocol.app_authenticate(): driver replaced
shell: Username prompt 1 received.
shell: Shell prompt received.
shell: Calling driver.auto_authorize().
shell: Attempting to app-authorize root.
shell: Shell prompt received.
'echo "test"\r\ntest\r\n~'

腻子响应

Network-Camera login: root
~ # echo "test"
test
~ #
4

0 回答 0