From 2361fd666e44b179d2a53a929a3eb5bd0afd45c0 Mon Sep 17 00:00:00 2001 From: Alex Chavkin Date: Tue, 24 Jan 2023 11:12:42 -0500 Subject: Split known_hosts fields on either a single space or tab --- paramiko/hostkeys.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index 13a0355d..7362c013 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 @@ -337,7 +338,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})" -- cgit v1.2.1