1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-24 01:25:37 +01:00

Merge pull request #194 from calebstewart/issue-185-private-key-password

[FIXES 185] Added logic for calling correct paramiko method
This commit is contained in:
Caleb Stewart 2021-09-19 01:38:51 -04:00 committed by GitHub
commit faec8be275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@ and simply didn't have the time to go back and retroactively create one.
- Fixed verbose logging handler to be __unique__ for every `channel` - Fixed verbose logging handler to be __unique__ for every `channel`
- Fixed docstrings in `Command` modules - Fixed docstrings in `Command` modules
- Changed docker base image to `python3.9-alpine` to fix python version issues. - Changed docker base image to `python3.9-alpine` to fix python version issues.
- Added logic for calling correct paramiko method when reloading an encrypted SSH privat ekey ([#185](https://github.com/calebstewart/issues/185)).
### Added ### Added
- Added alternatives to `bash` to be used during _shell upgrade_ for a _better shell_ - Added alternatives to `bash` to be used during _shell upgrade_ for a _better shell_
- Added a warning message when a `KeyboardInterrupt` is caught - Added a warning message when a `KeyboardInterrupt` is caught

View File

@ -65,7 +65,12 @@ class Ssh(Channel):
except paramiko.ssh_exception.SSHException: except paramiko.ssh_exception.SSHException:
password = prompt("RSA Private Key Passphrase: ", is_password=True) password = prompt("RSA Private Key Passphrase: ", is_password=True)
try: try:
key = paramiko.RSAKey.from_private_key_file(identity, password) if isinstance(identity, str):
key = paramiko.RSAKey.from_private_key_file(identity, password)
else:
# Seek back to the beginning of the file (the above load read the whole file)
identity.seek(0)
key = paramiko.RSAKey.from_private_key(identity, password)
except paramiko.ssh_exception.SSHException: except paramiko.ssh_exception.SSHException:
raise ChannelError(self, "invalid private key or passphrase") raise ChannelError(self, "invalid private key or passphrase")