Skip to content
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

Merged
merged 6 commits into from
Mar 9, 2018
Merged

Add custom regexes and allow for delicate SSH servers #468

merged 6 commits into from
Mar 9, 2018

Conversation

Red-M
Copy link
Member

@Red-M Red-M commented Feb 23, 2018

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.

@Red-M
Copy link
Member Author

Red-M commented Mar 9, 2018

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.

@takluyver
Copy link
Member

Sorry, I just hadn't looked at it. I've never used pxssh myself, so I tend to drag my feet on PRs for it, just because it doesn't interest me much.

Does PR #452 help to avoid issues with "password" appearing in the MOTD? It sounds like @orulz was running into the same thing.

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):
Copy link
Member

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)
Copy link
Member

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.

@Red-M
Copy link
Member Author

Red-M commented Mar 9, 2018

This all seems fine to me.

@Red-M
Copy link
Member Author

Red-M commented Mar 9, 2018

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 password in the custom shell script that the devices spawns on login (it is also the reason to disable sync_original_prompt because sending a newline also counts as a 0 which is to exit/logout).

So I figured I might as well write something to fix both.

@Red-M
Copy link
Member Author

Red-M commented Mar 9, 2018

Sorry, I just hadn't looked at it. I've never used pxssh myself, so I tend to drag my feet on PRs for it, just because it doesn't interest me much.

Do you need someone to look after pxssh a bit more?

I've used pxssh quite a lot for an extensive amount of time.

@takluyver
Copy link
Member

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.

@takluyver takluyver merged commit b9e793a into pexpect:master Mar 9, 2018
@Red-M
Copy link
Member Author

Red-M commented Mar 9, 2018

Let me know where and what to send. :)

@takluyver
Copy link
Member

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?

@Red-M
Copy link
Member Author

Red-M commented Mar 9, 2018

I'll send an email around.

Thanks!

@takluyver
Copy link
Member

@MountainRider my email to your technicolor.com address bounced. Do you have another address we should use now?

@takluyver
Copy link
Member

There were no objections, so I've added @Red-M on GitHub. Welcome to Pexpect maintenance! 🍪

@Red-M
Copy link
Member Author

Red-M commented Mar 17, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants