Skip to content

Commit 6fd6007

Browse files
author
Marcel Vilas
committed
Add support for paramiko 4.0.0.
1 parent 15b26ea commit 6fd6007

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

Exscript/key.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
Represents a private key.
2525
"""
2626
from builtins import object
27-
from paramiko import RSAKey, DSSKey
27+
from paramiko import RSAKey, ECDSAKey, Ed25519Key
2828
from paramiko.ssh_exception import SSHException
2929

3030

@@ -72,11 +72,15 @@ def from_file(filename, password='', keytype=None):
7272
keytype = 'rsa'
7373
except SSHException:
7474
try:
75-
DSSKey.from_private_key_file(filename, password=password)
76-
keytype = 'dss'
75+
ECDSAKey.from_private_key_file(filename, password=password)
76+
keytype = 'ecdsa'
7777
except SSHException:
78-
msg = 'not a recognized private key: ' + repr(filename)
79-
raise ValueError(msg)
78+
try:
79+
Ed25519Key.from_private_key_file(filename, password=password)
80+
keytype = 'ed25519'
81+
except SSHException:
82+
msg = 'not a recognized private key: ' + repr(filename)
83+
raise ValueError(msg)
8084
key = PrivateKey(keytype)
8185
key.filename = filename
8286
key.password = password

Exscript/protocols/drivers/driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
+ _any_path + r'?'
5050
+ r'[: ]?'
5151
+ _any_path + r'?'
52-
+ r'(?:\(' + _filename + '\))?'
52+
+ r'(?:\(' + _filename + r'\))?'
5353
+ r'[\]\-]?'
5454
+ r'[#>%\$\]] ?'
5555
+ _unprintable + r'*'

Exscript/protocols/ssh2.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
util.log_to_file(os.devnull)
5151

5252
# Register supported key types.
53-
keymap = {'rsa': paramiko.RSAKey, 'dss': paramiko.DSSKey}
53+
keymap = {'rsa': paramiko.RSAKey, 'ecdsa': paramiko.ECDSAKey, 'ed25519': paramiko.Ed25519Key}
5454
for key in keymap:
5555
PrivateKey.keytypes.add(key)
5656

@@ -259,9 +259,11 @@ def _paramiko_auth_key(self, username, keys, password):
259259
def _paramiko_auth_autokey(self, username, password):
260260
keyfiles = []
261261
for cls, file in ((paramiko.RSAKey, '~/.ssh/id_rsa'), # Unix
262-
(paramiko.DSSKey, '~/.ssh/id_dsa'), # Unix
262+
(paramiko.ECDSAKey, '~/.ssh/id_ecdsa'), # Unix
263+
(paramiko.Ed25519Key, '~/.ssh/id_ed25519'), # Unix
263264
(paramiko.RSAKey, '~/ssh/id_rsa'), # Windows
264-
(paramiko.DSSKey, '~/ssh/id_dsa')): # Windows
265+
(paramiko.ECDSAKey, '~/ssh/id_ecdsa'), # Windows
266+
(paramiko.Ed25519Key, '~/ssh/id_ed25519')): # Windows
265267
file = os.path.expanduser(file)
266268
if os.path.isfile(file):
267269
keyfiles.append((cls, file))

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
future
22
configparser
33
pycryptodomex
4-
paramiko>=1.17,<=3
4+
paramiko>=1.17,<5

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
package_data = {},
2424
packages = find_packages(),
2525
scripts = ['scripts/exscript', 'scripts/otp'],
26-
install_requires = ['future', 'configparser', 'paramiko', 'pycryptodomex'],
26+
install_requires = ['future', 'configparser', 'paramiko>=1.17,<5', 'pycryptodomex'],
2727
extras_require = {},
2828
keywords = ' '.join(['exscript',
2929
'telnet',

0 commit comments

Comments
 (0)