-
Notifications
You must be signed in to change notification settings - Fork 478
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
Add custom regexes and allow for delicate SSH servers #468
Conversation
…ssh to be more gentle with target SSH servers and the shells they spawn.
Is there an issue with this PR @takluyver ? I have to monkey patch this to fix devices that include "password" in the MOTD after a successful login. |
pexpect/pxssh.py
Outdated
options={}, encoding=None, codec_errors='strict'): | ||
options={}, encoding=None, codec_errors='strict', | ||
password_regex='(?i)(?:password:)|(?:passphrase for key)', | ||
disable_original_sync=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style point: I prefer to avoid negative boolean parameters like disable_foo
, unless there's a clear reason that the negative makes sense.
Looking at the rest of this class, I think the parameter fits better in the login()
method (which already has parameters affecting syncing and changing the prompt). I'd probably just call it sync_original_prompt
.
pexpect/pxssh.py
Outdated
|
||
|
||
if self.disable_original_sync: | ||
return(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, rather than making the method a no-op, let's check it in login()
and skip calling the method.
This all seems fine to me. |
While PR #452 does fix it, for some reason this was reverted due to other devices not matching the password prompt (iirc, brocade devices). I made this PR because devices like PFsense have So I figured I might as well write something to fix both. |
Do you need someone to look after pxssh a bit more? I've used pxssh quite a lot for an extensive amount of time. |
Thanks, this looks good now. :-) Having a maintainer who's more familiar with pxssh would certainly be good. If you're interested, would you mind sending us (the current maintenance team is myself, @jquast and @MountainRider ) a bit of information about yourself, so we know who we're trusting. |
Let me know where and what to send. :) |
You can post here if you're happy to do it in public, or use the email addresses on our Github profiles. As for what, there's no fixed list, I'd just like to have an idea who you are. What's your name? Where do you live (roughly - I don't need an address)? How do you come to be using pxssh a lot? What else are you interested in or working on? |
I'll send an email around. Thanks! |
@MountainRider my email to your technicolor.com address bounced. Do you have another address we should use now? |
There were no objections, so I've added @Red-M on GitHub. Welcome to Pexpect maintenance! 🍪 |
Thanks! |
Patch that allows setting some custom regexes for pxssh and allows pxssh to be more gentle with target SSH servers and the shells they spawn.
This is for #451
Please let me know if I need to change anything in regards to docs or comments and those requests will be handled.