This commit is contained in:
hl 2024-11-23 18:23:43 +08:00
parent 626d7e433a
commit 894b552159

View File

@ -11,18 +11,18 @@ from collections import namedtuple
class Entry(namedtuple('Entry', ['host', 'algorithm', 'hash'])):
separator: str = '.'
def __str__(self):
def __str__(self) -> str:
return f'{self.host} {self.algorithm} {self.hash}'
@property
def key(self):
def key(self) -> str:
return f'{self.algorithm}{self.separator}{self.hash}'
def main(args):
filename: Path | None = getattr(args, 'known_hosts', None)
filename: Path = getattr(args, 'known_hosts', Path())
file_path = filename.resolve()
if not file_path.exists() or not file_path.is_file():
if not file_path.is_file():
sys.exit(1)
entryMap = {}