Packet-Sniffer: pure-Python Network Packet Sniffing tool

Network Packet Sniffer

Python 3 Network Packet Sniffer

A simple pure-Python network packet sniffer. Packets are disassembled as they arrive at a given network interface controller and their information is displayed on the screen.

This application maintains no dependencies on third-party modules and can be run by any Python 3.x interpreter.

Installation

GNU / Linux

git clone https://github.com/EONRaider/Packet-Sniffer.git

Other Systems

This project is dependent on PF_PACKET – a stateful packet filter not found on Windows or Mac OS X. For demonstration purposes, you can try out this package in a Docker container. Although it will not have full access to localhost on your machine, you can still sniff on the Docker subnet and at least get the module running.

Use this command to build and run from the project directory:

docker build -t sniff . && docker run –network host sniff

Note that the entry command is simply python packet_sniffer.py, so feel free to use the full functionality of the module by overriding the default command. Remember that we tagged the container with the name “sniff” before, so we can pass command-line arguments to the sniffer in the following manner:

docker run –network host sniff [your command goes here]
echo “Now let’s print help”
docker run –network host sniff python packet_sniffer.py –help

Usage of –network host is not supported on OS X or Windows so this container won’t be fully functional – but you will see packets traveling within the docker subnet.

Use

Network Packet Sniffer

Running the Application

Objective Initiate the capture of packets on all available interfaces
Execution sudo python3 packet_sniffer.py
Outcome Refer to sample output below
  • Sample output:

Source: https://github.com/EONRaider/