File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,15 +65,11 @@ Parsing of `authorized_keys` files:
6565::
6666
6767 from sshpubkeys import AuthorizedKeysFile
68+ f = open("/home/username/.ssh/authorized_keys", "r")
69+ key_file = AuthorizedKeysFile(f, strict=False)
6870
69- key_file = AuthorizedKeysFile("""ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEGODBKRjsFB/1v3pDRGpA6xR+QpOJg9vat0brlbUNDD\n"""
70- """#This is a comment\n\n"""
71- """ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAF9QpvUneTvt8"""
72- """lu0ePSuzr7iLE9ZMPu2DFTmqh7BVn89IHuQ5dfg9pArxfHZWgu9lMdlOykVx0I6OXkE35A/mFqwwApyiPmiwno"""
73- """jmRnN//pApl6QQFINHzV/PGOSi599F1Y2tHQwcdb44CPOhkUmHtC9wKazSvw/ivbxNjcMzhhHsWGnA=="""
74- strict=True, disallow_options=True)
7571 for key in key_file.keys:
76- print(key.key_type, key.bits, key.hash_512() )
72+ print(key.key_type, key.bits, key.comment )
7773
7874
7975Options
You can’t perform that action at this time.
0 commit comments