Ping sweep is used to identify the live host from a range of IP addresses by sending the ICMP ECHO request and the ICMP ECHO reply. From a subnet and network address, an attacker or pentester can calculate the network range. In this section, I am going to demonstrate how to take advantage of the ping facility of an operating system.
First, I shall write a simple and small piece of code, as follows:
import os response = os.popen('ping -n 1 10.0.0.1') for line in response.readlines(): print line,
In the preceding code, import os imports the OS module so that we can run on the OS command. The next line, os.popen('ping -n 1 10.0.0.1'), which takes a DOS command, is passed in as a string and returns a file-like object connected to the ...