mirror of
https://github.com/jtesta/ssh-audit.git
synced 2025-06-22 10:43:41 +02:00
Fix RuntimeError for the JSON export (#44)
* Fix RuntimeError for the JSON export It is never a good idea to modify an iterable while iterating over it. Copying the iterable fixes #41 modified: ssh-audit.py * Add test case for #41 new file: test/test_build_struct.py * Fix linting error modified: test/test_build_struct.py
This commit is contained in:
@ -3366,7 +3366,7 @@ def build_struct(banner: Optional['SSH.Banner'], kex: Optional['SSH2.Kex'] = Non
|
||||
host_keys = kex.host_keys()
|
||||
|
||||
# Normalize all RSA key types to 'ssh-rsa'. Otherwise, due to Python's order-indifference dictionary types, we would iterate key types in unpredictable orders, which interferes with the docker testing framework (i.e.: tests would fail because elements are reported out of order, even though the output is semantically the same).
|
||||
for host_key_type in host_keys.keys():
|
||||
for host_key_type in list(host_keys.keys())[:]:
|
||||
if host_key_type in SSH2.HostKeyTest.RSA_FAMILY:
|
||||
val = host_keys[host_key_type]
|
||||
del host_keys[host_key_type]
|
||||
|
Reference in New Issue
Block a user