mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-11-16 13:35:39 +01:00
Added similar algorithm suggestions to --lookup (#80)
This commit is contained in:
parent
c2da269f06
commit
a3e4f9dbaa
@ -899,12 +899,30 @@ def algorithm_lookup(alg_names: str) -> int:
|
||||
if alg_name not in algorithms_dict_flattened
|
||||
]
|
||||
|
||||
similar_algorithms = [
|
||||
alg_unknown + " --> (" + alg_type + ") " + alg_name
|
||||
for alg_unknown in algorithms_not_found
|
||||
for alg_type in adb.keys()
|
||||
for alg_name in adb[alg_type]
|
||||
# Perform a case-insensitive comparison using 'casefold'
|
||||
# and match substrings using the 'in' operator.
|
||||
if alg_unknown.casefold() in alg_name.casefold()
|
||||
]
|
||||
|
||||
if len(algorithms_not_found) > 0:
|
||||
retval = exitcodes.FAILURE
|
||||
out.head('# unknown algorithms')
|
||||
for algorithm_not_found in algorithms_not_found:
|
||||
out.fail(algorithm_not_found)
|
||||
|
||||
print()
|
||||
|
||||
if len(similar_algorithms) > 0:
|
||||
retval = exitcodes.FAILURE
|
||||
out.head('# suggested similar algorithms')
|
||||
for similar_algorithm in similar_algorithms:
|
||||
out.warn(similar_algorithm)
|
||||
|
||||
return retval
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user