Question: 3 0 points Code Assignment: Writing a Network Sniffer and Host Discovery Tool Objective: The purpose of this assignment is to implement a Python -

30 points
Code Assignment: Writing a Network Sniffer and Host Discovery Tool
Objective: The purpose of this assignment is to implement a Python-based network sniffer that
can capture, decode, and analyze network packets. You will build several components: a basic
packet sniffer, an IP header decoder, and a tool to discover active hosts on a network using UDP
and ICMP packets.
Tasks:
Basic Packet Sniffer:
Create a Python script (basic_sniffer.py) that uses raw sockets to capture
network packets on a specified host.
The script should be able to sniff packets and display the raw data of at least one
captured packet.
Hint: Use Python's socket library and handle platform-specific configurations for
Windows and Linux.
Decode IP Headers:
Enhance the basic sniffer by adding a decoding function that extracts and displays
the IP header information from captured packets.
Create a new script (ip_header_decoder.py) that defines an IP class. Use the
ctypes or struct module to parse the binary data of the IP header.
The script should output the protocol type, source IP address, and destination IP
address for each captured packet.
Hint: Refer to the IP header structure in Figure 3-1 of the provided chapter.
ICMP Packet Decoder:
Extend the packet sniffer to decode ICMP packets specifically. Create a script
(icmp_decoder.py) that identifies ICMP packets and decodes their type and
code.
Print the decoded ICMP packet details to the console.
Hint: Use the struct module to parse the ICMP header fields.
UDP Host Discovery Tool:
Write a script (udp_host_discovery.py) that sends UDP datagrams across a
specified subnet to discover active hosts. The tool should wait for ICMP
responses to identify live hosts.
Use threading to handle sending packets and listening for responses concurrently.
Print a list of active hosts on the subnet after the scan completes.
3 0 points Code Assignment: Writing a Network

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!