1.Advanced IP Scanner(网上下载)
2. 通过python脚本:
import asyncio import ipaddress #通过扫描端口号确定 哪些IP可以ping通 async def scan_port(ip, port): try: # 尝试在1秒内建立连接 reader, writer = await asyncio.wait_for( asyncio.open_connection(str(ip), port), timeout=1 ) print(f"Port {port} is open on {ip}") writer.close() await writer.wait_closed() except (ConnectionRefusedError, TimeoutError, OSError): pass # 端口关闭或超时,不输出任何信息 async def scan_ip(ip, ports): tasks = [scan_port(ip, port) for port in ports] await asyncio.gather(*tasks) async def scan_ip_range(start_ip, end_ip, ports): # 解析起始和结束IP start = ipaddress.ip_address(start_ip) end = ipaddress.ip_address(end_ip) # 遍历IP范围 for ip_int in range(int(start), int(end) + 1): ip = ipaddress.ip_address(ip_int) await scan_ip(ip, ports) def main(): start_ip = '10.100.107.1' end_ip = '10.100.107.254' ports = [23] # 可以替换为你想检查的端口号列表 23代表telnet,22代表 ssh asyncio.run(scan_ip_range(start_ip, end_ip, ports)) if __name__ == "__main__": main()