gistfile1.txt
· 503 B · Text
Raw
#!/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}")
1 | #!/bin/python3 |
2 | import os,subprocess,re |
3 | def emit(msg): |
4 | print(f" {msg}") |
5 | |
6 | servers = ["cardamom","coffee","earlgrey"] |
7 | network = "teapot.chat" |
8 | ssl_port = 6697 |
9 | print("Here's the report:") |
10 | print("Servers:") |
11 | for server in servers: |
12 | 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) |
13 | result = re.search("Verify return code: .*", sp.stdout).group() |
14 | emit(f"{server} - {result}") |