I need to use "telnet" to connect to my camera. I had used putty and knew that the camera prompt was '~ # '
. If I execute 'echo "test"'
then I expect the response 'echo "test"\r\ntest\r\n'
. But Exscript's response is 'echo "test"\r\ntest\r\n~'
, including the prompt's first character '~'
.
Code
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)
Code Response
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~'
Putty response
Network-Camera login: root
~ # echo "test"
test
~ #