Il 13 marzo 2012 08:49, Giorgio Zoppi <giorgio.zo...@gmail.com> ha scritto: > raw sockets + icmp > scapy penso faccia al tuo caso.
Purtroppo questo richiede privilegi di root. Ci ho sbattuto la testa un buon paio d'ore sul problema e sono giunto alla conclusione che l'unica soluzione è parsare l'output di 'ping' e tanti saluti. Se può tornare utile all'OP, eccolo qui (funzia solo su UNIX): from subprocess import call, PIPE def ping(host, timeout=10): """Return True if host is up.""" # -q = quiet output # -c = count # -w = total timeout # -W = timeout for a single ICMP REPLY # -n = no DNS resolution for the output timeout = str(timeout) assert timeout.isdigit(), timeout retcode = call(["ping", "-q", "-c", "1", "-w", timeout, "-W", "1", "-n", host], stdout=PIPE) return True if retcode == 0 else False _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python