(filename: str = "ssh_host_key")
| 23 | |
| 24 | |
| 25 | def ensure_key(filename: str = "ssh_host_key") -> str: |
| 26 | path = pathlib.Path(filename) |
| 27 | if not path.exists(): |
| 28 | rsa_key = asyncssh.generate_private_key("ssh-rsa") |
| 29 | path.write_bytes(rsa_key.export_private_key()) |
| 30 | return str(path) |
| 31 | |
| 32 | |
| 33 | async def interact(connection: PromptToolkitSSHSession | TelnetConnection) -> None: |