Skip to content

Commit 8b30517

Browse files
authored
ssh: Allow passing disabled_algorithms keyword argument from ssh to paramiko (#2546)
* ssh: allow passing `disabled_algorithms` keyword argument from `ssh` to paramiko * update changelog * point to paramiko documentation * point sphinx docs to latest stable version of paramiko
1 parent 60cff24 commit 8b30517

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ The table below shows which release corresponds to each branch, and what date th
8686
- [#2529][2529] Add LoongArch64 support
8787
- [#2506][2506] ROP: fix `ROP(ELF(exe)).leave` is `None` in some ELF
8888
- [#2504][2504] doc: add example case for `tuple` (host, port pair) in `gdb.attach`
89+
- [#2546][2546] ssh: Allow passing disabled_algorithms keyword argument from ssh to paramiko
8990

9091
[2551]: https://github.com/Gallopsled/pwntools/pull/2551
9192
[2519]: https://github.com/Gallopsled/pwntools/pull/2519
@@ -99,6 +100,7 @@ The table below shows which release corresponds to each branch, and what date th
99100
[2529]: https://github.com/Gallopsled/pwntools/pull/2529
100101
[2506]: https://github.com/Gallopsled/pwntools/pull/2506
101102
[2504]: https://github.com/Gallopsled/pwntools/pull/2504
103+
[2546]: https://github.com/Gallopsled/pwntools/pull/2546
102104

103105
## 4.15.0 (`beta`)
104106

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def __setattr__(self, name, value):
266266
]
267267

268268
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None),
269-
'paramiko': ('https://docs.paramiko.org/en/2.1/', None)}
269+
'paramiko': ('https://docs.paramiko.org/en/stable/', None)}
270270

271271
# The name of an image file (relative to this directory) to place at the top of
272272
# the title page.

pwnlib/tubes/ssh.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ class ssh(Timeout, Logger):
573573
def __init__(self, user=None, host=None, port=22, password=None, key=None,
574574
keyfile=None, proxy_command=None, proxy_sock=None, level=None,
575575
cache=True, ssh_agent=False, ignore_config=False, raw=False,
576-
auth_none=False, *a, **kw):
576+
auth_none=False, disabled_algorithms=None, *a, **kw):
577577
"""Creates a new ssh connection.
578578
579579
Arguments:
@@ -592,6 +592,9 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None,
592592
ignore_config(bool): If :const:`True`, disable usage of ~/.ssh/config and ~/.ssh/authorized_keys
593593
raw(bool): If :const:`True`, assume a non-standard shell and don't probe the environment
594594
auth_none(bool): If :const:`True`, try to authenticate with no authentication methods
595+
disabled_algorithms(dict):
596+
Mapping of algorithm type and list of algorithm identifiers to disable.
597+
See :class:`paramiko.transport.Transport` for more information.
595598
596599
NOTE: The proxy_command and proxy_sock arguments is only available if a
597600
fairly new version of paramiko is used.
@@ -681,7 +684,7 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None,
681684
proxy_sock = None
682685

683686
try:
684-
self.client.connect(host, port, user, password, key, keyfiles, self.timeout, allow_agent=ssh_agent, compress=True, sock=proxy_sock, look_for_keys=not ignore_config)
687+
self.client.connect(host, port, user, password, key, keyfiles, self.timeout, allow_agent=ssh_agent, compress=True, sock=proxy_sock, look_for_keys=not ignore_config, disabled_algorithms=disabled_algorithms)
685688
except paramiko.BadHostKeyException as e:
686689
self.error("Remote host %(host)s is using a different key than stated in known_hosts\n"
687690
" To remove the existing entry from your known_hosts and trust the new key, run the following commands:\n"

0 commit comments

Comments
 (0)