#!/bin/python3 import os,subprocess,re def emit(msg): print(f" {msg}") servers = ["cardamom","coffee","earlgrey"] network = "teapot.chat" ssl_port = 6697 print("Here's the report:") print("Servers:") for server in servers: sp = subprocess.run(["/usr/bin/openssl","s_client","-connect",f"{server}.{network}:{str(ssl_port)}"], capture_output=True, text=True, input="QUIT :quit")#timeout=10) result = re.search("Verify return code: .*", sp.stdout).group() emit(f"{server} - {result}")