knipknap / exscript

A Python module making Telnet and SSH easy
MIT License
367 stars 136 forks source link

Problem with nxos #191

Open int3rlop3r opened 5 years ago

int3rlop3r commented 5 years ago

There are some versions of Nexus switches that have a null byte in their prompt - '\x00' and hence doesn't match the prompt re even though the driver was set to nxos.

Exscript.protocols.exception.TimeoutException: Buffer: u'\r\nCisco Nexus Operating System (NX-OS) Software\r\nTAC support: http://www.cisco.com/tac\r\nCopyright (c) 2002-2014, Cisco Systems, Inc. All rights reserved.\r\nThe copyrights to certain works contained in this software are\r\nowned by other third parties and used and distributed under\r\nlicense. Certain components of this software are licensed under\r\nthe GNU General Public License (GPL) version 2.0 or the GNU\r\nLesser General Public License (LGPL) Version 2.1. A copy of each\r\nsuch license is available at\r\nhttp://www.opensource.org/licenses/gpl-2.0.php and\r\nhttp://www.opensource.org/licenses/lgpl-2.1.php\r\n\r\x00HOST-1# '
int3rlop3r commented 5 years ago

Is there any release scheduled this week?

Mir-ina commented 1 year ago

I suppose that the same problem will appear for any telnet server, which can use binary telnet transmittion (RFC 856), because the TRANSMIT-BINARY equal 0 (zero). We see this when we use exscript to connect to telnetlib3.server, for example (python3 -m telnetlib3.server). In this case can see the traceback: Traceback (most recent call last): File "/.../Exscript/workqueue/job.py", line 78, in run self.function(self) File "/.../Exscript/queue.py", line 102, in _wrapped result = func(job, host, conn, *args, **kwargs) File "/home/yren/workspace/sandbox/python-test/telnet/simple-exscript.py", line 8, in do_something conn.expect('tel:sh') File "/.../Exscript/protocols/protocol.py", line 1058, in expect result = self._expect(prompt) File "/.../Exscript/protocols/protocol.py", line 1033, in _expect result = self._domatch(to_regexs(prompt), True) File "/.../Exscript/protocols/telnet.py", line 85, in _domatch result, match, self.response = func( File "/.../Exscript/protocols/telnetlib.py", line 754, in expect return self._waitfor(relist, timeout, True, cleanup=cleanup) File "/.../Exscript/protocols/telnetlib.py", line 672, in _waitfor self.process_rawq() File "/.../Exscript/protocols/telnetlib.py", line 545, in process_rawq command == WILL and 'WILL' or 'WONT', ord(opt)) TypeError: ord() expected a character, but string of length 0 found