Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh: Allow passing disabled_algorithms keyword argument from ssh to paramiko #2546

Merged
merged 4 commits into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The table below shows which release corresponds to each branch, and what date th
- [#2529][2529] Add LoongArch64 support
- [#2506][2506] ROP: fix `ROP(ELF(exe)).leave` is `None` in some ELF
- [#2504][2504] doc: add example case for `tuple` (host, port pair) in `gdb.attach`
- [#2546][2546] ssh: Allow passing disabled_algorithms keyword argument from ssh to paramiko

[2519]: https://github.com/Gallopsled/pwntools/pull/2519
[2507]: https://github.com/Gallopsled/pwntools/pull/2507
Expand All @@ -97,6 +98,7 @@ The table below shows which release corresponds to each branch, and what date th
[2529]: https://github.com/Gallopsled/pwntools/pull/2529
[2506]: https://github.com/Gallopsled/pwntools/pull/2506
[2504]: https://github.com/Gallopsled/pwntools/pull/2504
[2546]: https://github.com/Gallopsled/pwntools/pull/2546

## 4.15.0 (`beta`)

Expand Down
7 changes: 5 additions & 2 deletions pwnlib/tubes/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ class ssh(Timeout, Logger):
def __init__(self, user=None, host=None, port=22, password=None, key=None,
keyfile=None, proxy_command=None, proxy_sock=None, level=None,
cache=True, ssh_agent=False, ignore_config=False, raw=False,
auth_none=False, *a, **kw):
auth_none=False, disabled_algorithms=None, *a, **kw):
"""Creates a new ssh connection.

Arguments:
Expand All @@ -593,6 +593,9 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None,
ignore_config(bool): If :const:`True`, disable usage of ~/.ssh/config and ~/.ssh/authorized_keys
raw(bool): If :const:`True`, assume a non-standard shell and don't probe the environment
auth_none(bool): If :const:`True`, try to authenticate with no authentication methods
disabled_algorithms(dict):
Mapping of algorithm type and list of algorithm identifiers to disable.
See :class:`paramiko.transport.Transport` for more information.

NOTE: The proxy_command and proxy_sock arguments is only available if a
fairly new version of paramiko is used.
Expand Down Expand Up @@ -682,7 +685,7 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None,
proxy_sock = None

try:
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)
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)
except paramiko.BadHostKeyException as e:
self.error("Remote host %(host)s is using a different key than stated in known_hosts\n"
" To remove the existing entry from your known_hosts and trust the new key, run the following commands:\n"
Expand Down
Loading