fork download
  1. import re
  2.  
  3. regex = r"^Encryption Algorithms:([\w-]+(?:,[\w-]+)*)"
  4.  
  5. test_str = ("SSH Enabled - version 2.0\n"
  6. "Authentication methods:publickey,keyboard-interactive,password\n"
  7. "Encryption Algorithms:aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc\n"
  8. "MAC Algorithms:hmac-sha1,hmac-sha1-96\n"
  9. "Authentication timeout: 120 secs; Authentication retries: 3\n"
  10. "Minimum expected Diffie Hellman key size : 1024 bits\n"
  11. "IOS Keys in SECSH format(ssh-rsa, base64 encoded):")
  12.  
  13. matches = re.search(regex, test_str, re.MULTILINE)
  14. if matches:
  15. print(matches.group(1).split(","))
Success #stdin #stdout 0.01s 27712KB
stdin
Standard input is empty
stdout
['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-cbc', '3des-cbc', 'aes192-cbc', 'aes256-cbc']