MCPcopy
hub / github.com/jtesta/ssh-audit / run

Method run

src/ssh_audit/hostkeytest.py:76–104  ·  view source on GitHub ↗
(out: 'OutputBuffer', s: 'SSH_Socket', server_kex: 'SSH2_Kex')

Source from the content-addressed store, hash-verified

74
75 @staticmethod
76 def run(out: 'OutputBuffer', s: 'SSH_Socket', server_kex: 'SSH2_Kex') -> None:
77 KEX_TO_DHGROUP = {
78 'diffie-hellman-group1-sha1': KexGroup1,
79 'diffie-hellman-group14-sha1': KexGroup14_SHA1,
80 'diffie-hellman-group14-sha256': KexGroup14_SHA256,
81 'curve25519-sha256': KexCurve25519_SHA256,
82 'curve25519-sha256@libssh.org': KexCurve25519_SHA256,
83 'diffie-hellman-group16-sha512': KexGroup16_SHA512,
84 'diffie-hellman-group18-sha512': KexGroup18_SHA512,
85 'diffie-hellman-group-exchange-sha1': KexGroupExchange_SHA1,
86 'diffie-hellman-group-exchange-sha256': KexGroupExchange_SHA256,
87 'ecdh-sha2-nistp256': KexNISTP256,
88 'ecdh-sha2-nistp384': KexNISTP384,
89 'ecdh-sha2-nistp521': KexNISTP521,
90 # 'kexguess2@matt.ucc.asn.au': ???
91 }
92
93 # Pick the first kex algorithm that the server supports, which we
94 # happen to support as well.
95 kex_str = None
96 kex_group = None
97 for server_kex_alg in server_kex.kex_algorithms:
98 if server_kex_alg in KEX_TO_DHGROUP:
99 kex_str = server_kex_alg
100 kex_group = KEX_TO_DHGROUP[kex_str](out)
101 break
102
103 if kex_str is not None and kex_group is not None:
104 HostKeyTest.perform_test(out, s, server_kex, kex_str, kex_group, HostKeyTest.HOST_KEY_TYPES)
105
106 @staticmethod
107 def perform_test(out: 'OutputBuffer', s: 'SSH_Socket', server_kex: 'SSH2_Kex', kex_str: str, kex_group: 'KexDH', host_key_types: Dict[str, Dict[str, bool]]) -> None:

Callers

nothing calls this directly

Calls 1

perform_testMethod · 0.80

Tested by

no test coverage detected