Assuming you got something like this (copied from here):
#!/usr/bin/python
from scapy.all import *
TIMEOUT = 2
conf.verb = 0
for ip in range(0, 256):
packet = IP(dst="192.168.0." + str(ip), ttl=20)/ICMP()
reply = sr1(packet, timeout=TIMEOUT)
if not (reply is None):
print reply.src, "is online"
else:
print "Timeout waiting for %s" % packet[IP].src
There is no need to wait for each ping to finish before trying the next host. Could I put the loop interior each time into the background along the lines of the &
in:
for ip in 192.168.0.{0..255}; do
ping -c 1 $ip &
done