Мне нужно использовать «te lnet» для подключения к моей камере. Я использовал шпатлевку и знал, что подсказка камеры была '~ # '
. Если я выполню '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
~ #