mirror of
https://github.com/xxh/xxh
synced 2024-12-04 09:29:09 +00:00
cleaning
This commit is contained in:
parent
f81bac83ec
commit
c8cb57f9d6
1 changed files with 12 additions and 10 deletions
|
@ -131,7 +131,7 @@ class xxh:
|
||||||
if self.vverbose:
|
if self.vverbose:
|
||||||
self.eprint(f'Pexpect caught pattern: {patterns[pattern]}')
|
self.eprint(f'Pexpect caught pattern: {patterns[pattern]}')
|
||||||
|
|
||||||
if pattern in [0,1]:
|
if pattern in [0, 1]:
|
||||||
# Expected:
|
# Expected:
|
||||||
# The authenticity of host '<...>' can't be established.
|
# The authenticity of host '<...>' can't be established.
|
||||||
# ECDSA key fingerprint is <...>
|
# ECDSA key fingerprint is <...>
|
||||||
|
@ -154,13 +154,15 @@ class xxh:
|
||||||
if pattern == 2:
|
if pattern == 2:
|
||||||
# Expected:
|
# Expected:
|
||||||
# Enter passphrase for key '<keyfile>':
|
# Enter passphrase for key '<keyfile>':
|
||||||
if key_password is None:
|
if user_key_password:
|
||||||
|
sess.sendline(user_key_password)
|
||||||
|
elif key_password:
|
||||||
|
sess.sendline(key_password)
|
||||||
|
else:
|
||||||
user_key_password = getpass.getpass(prompt=(sess.before + sess.after).decode("utf-8")+' ')
|
user_key_password = getpass.getpass(prompt=(sess.before + sess.after).decode("utf-8")+' ')
|
||||||
sess.sendline(user_key_password)
|
sess.sendline(user_key_password)
|
||||||
else:
|
|
||||||
sess.sendline(key_password)
|
|
||||||
|
|
||||||
if pattern in [3,4]:
|
if pattern in [3, 4]:
|
||||||
# Expected:
|
# Expected:
|
||||||
# <host>`s password:
|
# <host>`s password:
|
||||||
if host_password is None:
|
if host_password is None:
|
||||||
|
@ -177,22 +179,22 @@ class xxh:
|
||||||
output = output[3:] if output.startswith(' \r\n') else output
|
output = output[3:] if output.startswith(' \r\n') else output
|
||||||
result = {
|
result = {
|
||||||
'user_host_accept': user_host_accept,
|
'user_host_accept': user_host_accept,
|
||||||
'user_host_password':user_host_password,
|
'user_host_password': user_host_password,
|
||||||
'user_key_password':user_key_password,
|
'user_key_password': user_key_password,
|
||||||
'output':output
|
'output':output
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
if pattern in [6,7]:
|
if pattern in [6, 7]:
|
||||||
# Prompt
|
# Prompt
|
||||||
print(sess.before.decode("utf-8"))
|
print(sess.before.decode("utf-8"))
|
||||||
sess.interact()
|
sess.interact()
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'user_host_accept': user_host_accept,
|
'user_host_accept': user_host_accept,
|
||||||
'user_host_password':user_host_password,
|
'user_host_password': user_host_password,
|
||||||
'user_key_password':user_key_password
|
'user_key_password': user_key_password
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue