Replies: 2 comments 1 reply
-
you can't with paramiko/ssh2/asyncssh but with the other transports you can easily do this by disabling channel auth and having a custom on open as you mentioned. the wlc example does this exactly. also will have to futz with prompt pattern matching. if there's a way to make paramiko/ssh2/asyncssh do this defo open to a pr but as they are all expecting "normal" ssh auth im not sure they support anything like that. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, that is where I was stuck. How would I go about doing item 1 in the below code snippet? something with channel? def crypto_on_open(cls):
"""Example `on_open` function for use with crypto prompt"""
# 1) - not sure how to read in the prompt text here...transport.read? channel.read?
# do i need to modify the current expected prompt text, let it find that, then somehow read that in?
m = re.match(r"my (example crypto prompt) here", cls.transport.read()) # not sure how to read in data during the login process
if m:
# 2) process crypto information to generate password
print("saw the crypto prompt")
cls.transport.auth_password = my_crypto_function(m.group(1))
# continue and send the password
cls.transport.write(cls.transport.auth_password)
cls.transport.write(cls.channel.comms_return_char) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to create a custom login function? We have an oddball setup that requires reading in a multiline password prompt (and doing some crypto stuff with it), then generating the password. The password creation can't be done until first viewing the password prompt. It looks like I need to use the auth_pypass and on_open method, but I am having a hard time figuring out to make those work together and how to put the multiline password prompt string into a variable.
Any suggestions on how to do this with scrapli without losing other functionality?
Beta Was this translation helpful? Give feedback.
All reactions