-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EOF control in telnet transport with old devices #351
Comments
thanks for this @lorenzo-d-m ill try to take a peak this weekend. will have to re-remember how all the telnet thing work 😄 |
hey @lorenzo-d-m sorry im just getting back to this. when I sat down to look at this this rang some bells in my memory :D looks like this area was tweaked a bit not too long ago here and from Matt's digging into this it shouldn't be necessary anyway. since I have no devices to really test against I'm always a little spooked to make changes to core bits like this -- have you been able to test your update on other devices as well by any chance? If yeah, I'd say let's do it hah, if you're up for a minor pr to nuke those two lines in sync and async that would be great. thanks a bunch for a great issue with the repro and all the back story, very much appreciated! |
awesome thank you @lorenzo-d-m -- wrapping this up over in #355! |
Awesome, thank you @carlmontanari |
Hi Carl,
I'm facing an issue with telnet transport trying to gather configurations from Cisco PIX devices and also from some old ASA.
Such devices put an EOF sequence after the login and before getting the prompt. E.g. the
read()
method assignsself._raw_buf
the value:b"****\r\nType help or '?' for a list of available commands.\r\n\r\x00SEG-TTS-VDF/MONITOR> "
It contains the redacted password, the hint proposed by the device, and unfortunately, in front of the prompt it contains an EOF sequence
\x00
.As
self._raw_buf
is processed by the method_handle_control_chars
, it throws ascrapli.exceptions.ScrapliConnectionNotOpened: server returned EOF, connection not opened
then the connection is closed.
To reproduce:
Expected behavior:
No exceptions
Stack Trace:
OS:
Windows 11 Pro
Scrapli Version: 2024.07.30
Proposed solution:
With some devices the EOF sequence occurs in the middle of
_raw_buf
, however, with others (ASA) EOF occurs at the end of_raw_buf
.Since
_handle_control_chars()
is called fromread()
, which in turn is wrapped in the timeout decorator, I suggest to remove the control on EOF inside_handle_control_chars()
.scrapli/scrapli/transport/plugins/asynctelnet/transport.py
Re-running the above code commenting out the EOF control matches the expected behavior.
The same goes for the sync module.
The text was updated successfully, but these errors were encountered: