PingSweep with Scapy

hacking network ping ping sweep programming python scapy security

Want to get a bit geekier with your ping sweeps? Python Scapy can be used to create, modify, send, and intercept network packets and any TCP/IP layer. Here is a simple ping sweep script with Python Scapy:

!/usr/bin/python from scapy.all import * TIMEOUT = 2 conf.verb = 0 for ip in range(201, 256): #Change it to your target range packet = IP(dst="192.168.1." + str(ip), ttl=20)/ICMP() #Change dst to your scheme reply = sr1(packet, timeout=TIMEOUT) if not (reply is None): print reply.dst, "is online" else: print "Timeout waiting for %s" % packet[IP].dst

The author would love to hear your comments. Let us discuss at Twitter @qasimchadhar.