I have the following code in python, which contains log messages to debug SSH.
for log_item in ssh_log:
print(log_item.rstrip())
#will show ...
2022-04-06 01:55:15,085 10.x Remote version/idstring: SSH-2.0-ConfD-4.3.11.4
2022-04-06 01:55:15,085 20.x Connected (version 2.0, client ConfD-4.3.11.4)
2022-04-06 01:55:15,161 10.x kex algos:['diffie-hellman-group14-sha1'] server key:['ssh-rsa']
...
What is the approach to get the values in bold assign my variables, maybe some regex as part of the for loop or something else to get the following:
idstring = SSH-2.0-ConfD-4.3.11.4
kex_algos = ['diffie-hellman-group14-sha1']
key_type = ['ssh-rsa']
log_item.find()to filter out the relevant lines, thenlog_item.split()to split those into strings and pick the interesting ones by index.