import socket
targets = [
 ("hermes.prod-user-4-4-obbana2.svc.cluster.local", [8642,8770,8090]),
 ("hermes.prod-user-4-4-obbana2-c78ffe8c.svc.cluster.local", [8770]),
 ("hermes.prod-user-572-476-probe-user-3a6e150b.svc.cluster.local",[8770,8642]),
 ("hermes.default.svc.cluster.local",[8770]),
]
for host,ports in targets:
    try:
        ips = sorted({ai[4][0] for ai in socket.getaddrinfo(host,None)})
    except Exception as e:
        print("DNS",host,"ERR",type(e).__name__,str(e)[:80]); continue
    print("DNS",host,"->",ips)
    for p in ports:
        for ip in ips:
            s=socket.socket(); s.settimeout(4)
            try:
                s.connect((ip,p)); print("  TCP",ip,p,"OPEN")
            except Exception as e:
                print("  TCP",ip,p,"ERR",type(e).__name__)
            finally: s.close()
for ip in ["10.222.205.28"]:
    for p in [8770,8642,8090]:
        s=socket.socket(); s.settimeout(3)
        try: s.connect((ip,p)); print("TCP",ip,p,"OPEN")
        except Exception as e: print("TCP",ip,p,"ERR",type(e).__name__)
        finally: s.close()
print("== resolv.conf ==")
try: print(open("/etc/resolv.conf").read())
except Exception as e: print("ERR",e)
