feat: add cluster management and audit utility scripts
This commit is contained in:
27
scripts/test_both_vips.py
Normal file
27
scripts/test_both_vips.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import socket
|
||||
import struct
|
||||
|
||||
def test_dns(server_ip, domain="google.com"):
|
||||
header = struct.pack(">HHHHHH", 0x1234, 0x0100, 1, 0, 0, 0)
|
||||
qname = b"".join(bytes([len(p)]) + p.encode("ascii") for p in domain.split(".")) + b"\x00"
|
||||
qtype_qclass = struct.pack(">HH", 1, 1)
|
||||
packet = header + qname + qtype_qclass
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
sock.settimeout(4.0)
|
||||
try:
|
||||
sock.sendto(packet, (server_ip, 53))
|
||||
resp, _ = sock.recvfrom(1024)
|
||||
ancount = struct.unpack(">H", resp[6:8])[0]
|
||||
print(f"SUCCESS: {server_ip} returned {len(resp)} bytes with {ancount} answers for {domain}!")
|
||||
except Exception as e:
|
||||
print(f"FAILED to query {server_ip}: {e}")
|
||||
finally:
|
||||
sock.close()
|
||||
|
||||
print("Testing Aerodrome Primary VIP (140.44.4.36):")
|
||||
test_dns("140.44.4.36", "google.com")
|
||||
|
||||
print("\nTesting Spaceport Secondary VIP (140.44.4.65):")
|
||||
test_dns("140.44.4.65", "google.com")
|
||||
|
||||
Reference in New Issue
Block a user