Open abhijitbakale opened 4 years ago
I have several devices connected to cisco Terminal Server and while I am trying to reach out to those nodes, I am not about to get in.
The code: from Exscript.util.interact import read_login from Exscript.protocols import Telnet
account = read_login() conn = Telnet(debug=5) conn.set_driver('ios') conn.connect('192.100.101.201', 2042) conn.login(account) conn.execute('conf t') conn.send('exit\n') conn.close()
Output Traceback Stack:
Please enter your user name [user1]: cisco Please enter your password: ios: Attempting to authenticate cisco. ios: Attempting to app-authenticate cisco. ios: waiting for: ['[\r\n][^\r\n](?:bad secrets|denied|invalid|too short|incorrect|connection timed out|failed|failure)', 'user ?name: ?$', u'(?:s\/key|otp-md4) (\d+) (\S+)(?=\s|[\r\n])', '(?:[\r\n][Pp]assword: ?|last resort password:)$', '[\r\n][\-\w+\.:/]+(?:\([^\)]+\))?[>#] ?$'] Telnet(192.100.101.201,2042): Expecting ['[\r\n][^\r\n](?:bad secrets|denied|invalid|too short|incorrect|connection timed out|failed|failure)', 'user ?name: ?$', u'(?:s\/key|otp-md4) (\d+) (\S+)(?=\s|[\r\n])', '(?:[\r\n][Pp]assword: ?|last resort password:)$', '[\r\n][\-\w+\.:/]+(?:\([^\)]+\))?[>#] ?$'] Telnet(192.100.101.201,2042): recv '\xff\xfb\x01\xff\xfb\x03\xff\xfd\x18\xff\xfd\x1f' Telnet(192.100.101.201,2042): IAC WILL 1 Telnet(192.100.101.201,2042): IAC WILL 3 Telnet(192.100.101.201,2042): IAC DO 24 Telnet(192.100.101.201,2042): IAC DO 31 Telnet(192.100.101.201,2042): recv '\xff\xfc\x03\xff\xfa\x18\x01\xff\xf0' Telnet(192.100.101.201,2042): IAC WONT 3 Telnet(192.100.101.201,2042): IAC SUBCOMMAND 24 Telnet(192.100.101.201,2042): IAC SUBCOMMAND_END Telnet(192.100.101.201,2042): indicating support for terminal type dumb ios: Response was u'' Traceback (most recent call last): File "c:/Users/user1/Desktop/DC Automation Scripts/exscript1_ter_ser.py", line 10, in conn.login(account) File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 675, in login self.authenticate(account, flush=False) File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 701, in authenticate self.app_authenticate(app_account, flush=flush) File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 870, in app_authenticate self._app_authenticate(account, password, flush, bailout) File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 774, in _app_authenticate raise TimeoutException(msg) Exscript.protocols.exception.TimeoutException: Buffer: u''
please enlighten me if I am doing anything wrong.
You'll have to implement your own driver. The ios driver in this package doesn't handle ANSI escape codes. (posting this in case someone comes across a similar issue in the future).
I have several devices connected to cisco Terminal Server and while I am trying to reach out to those nodes, I am not about to get in.
The code: from Exscript.util.interact import read_login from Exscript.protocols import Telnet
account = read_login() conn = Telnet(debug=5) conn.set_driver('ios') conn.connect('192.100.101.201', 2042) conn.login(account) conn.execute('conf t') conn.send('exit\n') conn.close()
Output Traceback Stack:
Please enter your user name [user1]: cisco Please enter your password: ios: Attempting to authenticate cisco. ios: Attempting to app-authenticate cisco. ios: waiting for: ['[\r\n][^\r\n](?:bad secrets|denied|invalid|too short|incorrect|connection timed out|failed|failure)', 'user ?name: ?$', u'(?:s\/key|otp-md4) (\d+) (\S+)(?=\s|[\r\n])', '(?:[\r\n][Pp]assword: ?|last resort password:)$', '[\r\n][\-\w+\.:/]+(?:\([^\)]+\))?[>#] ?$'] Telnet(192.100.101.201,2042): Expecting ['[\r\n][^\r\n](?:bad secrets|denied|invalid|too short|incorrect|connection timed out|failed|failure)', 'user ?name: ?$', u'(?:s\/key|otp-md4) (\d+) (\S+)(?=\s|[\r\n])', '(?:[\r\n][Pp]assword: ?|last resort password:)$', '[\r\n][\-\w+\.:/]+(?:\([^\)]+\))?[>#] ?$'] Telnet(192.100.101.201,2042): recv '\xff\xfb\x01\xff\xfb\x03\xff\xfd\x18\xff\xfd\x1f' Telnet(192.100.101.201,2042): IAC WILL 1 Telnet(192.100.101.201,2042): IAC WILL 3 Telnet(192.100.101.201,2042): IAC DO 24 Telnet(192.100.101.201,2042): IAC DO 31 Telnet(192.100.101.201,2042): recv '\xff\xfc\x03\xff\xfa\x18\x01\xff\xf0' Telnet(192.100.101.201,2042): IAC WONT 3 Telnet(192.100.101.201,2042): IAC SUBCOMMAND 24 Telnet(192.100.101.201,2042): IAC SUBCOMMAND_END Telnet(192.100.101.201,2042): indicating support for terminal type dumb ios: Response was u'' Traceback (most recent call last): File "c:/Users/user1/Desktop/DC Automation Scripts/exscript1_ter_ser.py", line 10, in
conn.login(account)
File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 675, in login
self.authenticate(account, flush=False)
File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 701, in authenticate
self.app_authenticate(app_account, flush=flush)
File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 870, in app_authenticate
self._app_authenticate(account, password, flush, bailout)
File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 774, in _app_authenticate
raise TimeoutException(msg)
Exscript.protocols.exception.TimeoutException: Buffer: u''
please enlighten me if I am doing anything wrong.