📅  最后修改于: 2022-03-11 14:46:09.982000             🧑  作者: Mango
import nmap, socket
ip_addr = input('Enter ip or url to check if it is up or down: ')
scanner = nmap.PortScanner()
host = socket.gethostbyname(ip_addr)
scanner.scan(host, '1', '-v')
print("IP Status: ", scanner[host].state())