paramiko / paramiko/paramiko

Tweak `PKey.get_fingerprint` to use string-ish hexdigest, not bytes-ish digest.

Open
#726 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Python
Stars
9.9k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

If the following code using paramiko 0.16.0:

import paramiko

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('127.0.0.1', username='user', password='password')

Is run in Python 3.5.1 with BytesWarnings enabled (-bb flag), an error is triggered:

$ python3 -bb para.py
Traceback (most recent call last):
  File "para.py", line 5, in <module>
    client.connect('127.0.0.1', username='user', password='ironmanmachine')
  File "/usr/local/lib/python3.5/site-packages/paramiko/client.py", line 348, in connect
    server_key)
  File "/usr/local/lib/python3.5/site-packages/paramiko/client.py", line 623, in missing_host_key
    (key.get_name(), hostname, hexlify(key.get_fingerprint())))
BytesWarning: str() on a bytes instance

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PKey.get_fingerprint and the client.py call shown at line 623, then reproduce the reported connection with Python 3.5.1 and the -bb flag. The work is done when the fingerprint uses the requested string-oriented hexadecimal form and the example no longer raises BytesWarning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.