object: scan hosts on the same subnet.
The scanner sends ICMP echo request to all the other subnet IP addresses. For example, let your host’s IP address is 140.117.171.148 and netmask is 255.255.255.0. ICMP echo request (type 8) is sent to 140.117.171.1~140.117.171.254 (except itself) respectively, and the ICMP echo reply (type 0) is caught if the host is alive on the subnet. This is assuming that ICMP is enabled (Ubuntu 18.04 enable by default). Then the hosts will automatically send ICMP echo reply when ICMP echo requests are received.
Send ICMP echo request packet : Fill the IP header according to the following format:
- Header length = calculate by youself
- Total length = calculate by youself
- Id = 0
- Flag = don’t fragment
- TTL = 1
- Protocol = ICMP
Fill the ICMP packet according to the following format:
- Checksum (You can let OS do it.)
- ID: process id
- Sequence number: Starting from 1, increase one by one.