python 端口扫描
备份
>>> from socket import socket >>> def scan_address(host, port): s = socket() s.settimeout(3) try: s.connect((host, port)) except: return False s.close() return True >>> scan_address('localhost', 5432) True
身是菩提树,心如明镜台,时时勤拂拭,勿使惹尘埃。