import socketfrom concurrent.futures import ThreadPoolExecutordef is_socks_proxy(host, port): try: with socket.create_connection((host, port), timeout=2) as s: s.sendall(b'\x05\x01\x00') # 使用 SOCKS5 协议发送版本号和认证方法 response = s.recv(1024) if response and response[0] == 5: print(f"{host}:{port} is socks5") except Exception as e: passdef scan_ports(hosts, ports, num_threads=30): with ThreadPoolExecutor(max_workers=num_threads) as executor: for host in hosts: for port in ports: executor.submit(is_socks_proxy, host, port)if __name__ == "__main__": hosts = ['1.1.1.1', '2.2.2.2'] ports = [7890, 7891, 7892, 7893] scan_ports(hosts, ports)複製代碼
listeners:- name: socks-in type: socks port: 7891 listen: 127.0.0.1 udp: false tunnels:- network: [udp] address: 127.0.0.1:7891 target: 6.6.6.6:7891 proxy: DIRECTproxies:- name: "socks" type: socks5 server: 127.0.0.1 port: 7891- name: "hysteria2" type: hysteria2 server: 1.1.1.1 port: 443 password: 123456 skip-cert-verify: true dialer-proxy: socksrules:- match,DIRECT #直接利用UDP#- match,hysteria2 #中转利用UDP複製代碼