diff options
Diffstat (limited to 'paramiko/hostkeys.py')
-rw-r--r-- | paramiko/hostkeys.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index b189aac6..bbfa5755 100644 --- a/paramiko/hostkeys.py +++ b/paramiko/hostkeys.py @@ -20,6 +20,7 @@ from base64 import encodebytes, decodebytes import binascii import os +import re from collections.abc import MutableMapping from hashlib import sha1 @@ -328,7 +329,8 @@ class HostKeyEntry: """ Parses the given line of text to find the names for the host, the type of key, and the key data. The line is expected to be in the - format used by the OpenSSH known_hosts file. + format used by the OpenSSH known_hosts file. Fields are separated by a + single space or tab. Lines are expected to not have leading or trailing whitespace. We don't bother to check for comments or empty lines. All of @@ -337,7 +339,7 @@ class HostKeyEntry: :param str line: a line from an OpenSSH known_hosts file """ log = get_logger("paramiko.hostkeys") - fields = line.split(" ") + fields = re.split(" |\t", line) if len(fields) < 3: # Bad number of fields msg = "Not enough fields found in known_hosts in line {} ({!r})" |