import socket import sys TARGET_IP = "202.114.4.114" COMMON_PORTS = [ 511, 515, 516, 517, 518, 519, 520, 1000, 2000, 3000, 4000, 5000, 6060, 7000, 8000, 8001, 8002, 8080, 8300, 9000, 9100, 9200, 9500, 10008 ] print(f"Scanning target monitor {TARGET_IP} for open TCP ports...") open_ports = [] for port in COMMON_PORTS: try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(0.5) result = s.connect_ex((TARGET_IP, port)) if result == 0: print(f" [OPEN] Port {port} is open!") open_ports.append(port) s.close() except Exception as e: pass # Also do a quick scan of port range 500-600 (very common for Contec) print("Scanning port range 500-600...") for port in range(500, 601): if port in COMMON_PORTS: continue try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(0.1) result = s.connect_ex((TARGET_IP, port)) if result == 0: print(f" [OPEN] Port {port} is open!") open_ports.append(port) s.close() except Exception as e: pass print("\nScan complete.") if open_ports: print(f"Found open TCP ports on monitor: {open_ports}") else: print("No open TCP ports found on the monitor. It is not acting as a TCP server on these ports.") with open("C:\\Users\\Dell\\.gemini\\antigravity-ide\\brain\\17f86d9d-29a1-4f54-b185-045db1a407b4\\scratch\\monitor_scan_results.txt", "w") as f: f.write(f"Monitor scan results for {TARGET_IP}:\n") f.write(f"Open ports: {open_ports}\n")