Kali Linux

Packet-Sniffer : A pure-Python Network Packet Sniffing Tool

Packet-Sniffer is 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

Simply clone this repository with git clone and execute the packet_sniffer.py file as described in the following Usage section.

user@host:~/DIR$ 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.

Usage

packet_sniffer.py [-h] [-i INTERFACE] [-d]
A pure-Python network packet sniffer.
optional arguments:
-h, –help show this help message and exit
-i INTERFACE, –interface INTERFACE
Interface from which packets will be captured (captures
from all available interfaces by default).
-d, –displaydata Output packet data during capture.

Running the Application

ObjectiveInitiate the capture of packets on all available interfaces
Executionsudo python3 packet_sniffer.py
OutcomeRefer to sample output below

Sample output:

[>] Packet #476 at 17:45:13:
[+] MAC ……ae:45:39:30:8f:5a -> dc:d9:ae:71:c8:b9
[+] IPv4 ……….192.168.1.65 -> 140.82.113.3 | PROTO: TCP TTL: 64
[+] TCP ………………40820 -> 443 | Flags: 0x010 > ACK
[>] Packet #477 at 17:45:14:
[+] MAC ……dc:d9:ae:71:c8:b9 -> ae:45:39:30:8f:5a
[+] IPv4 ……….140.82.113.3 -> 192.168.1.65 | PROTO: TCP TTL: 49
[+] TCP ………………..443 -> 40820 | Flags: 0x010 > ACK
[>] Packet #478 at 17:45:18:
[+] MAC ……dc:d9:ae:71:c8:b9 -> ae:45:39:30:8f:5a
[+] ARP Who has 192.168.1.65 ? -> Tell 192.168.1.254
[>] Packet #479 at 17:45:18:
[+] MAC ……ae:45:39:30:8f:5a -> dc:d9:ae:71:c8:b9
[+] ARP ………..192.168.1.65 -> Is at ae:45:39:30:8f:5a

R K

Recent Posts

garak, LLM Vulnerability Scanner : The Comprehensive Tool For Assessing Language Model Security

garak checks if an LLM can be made to fail in a way we don't…

2 days ago

Vermilion : Mastering Linux Post-Exploitation For Red Team Success

Vermilion is a simple and lightweight CLI tool designed for rapid collection, and optional exfiltration…

2 days ago

AD-CS-Forest-Exploiter : Mastering Security Through PowerShell For AD CS Misconfiguration

ADCFFS is a PowerShell script that can be used to exploit the AD CS container…

2 days ago

Usage Of Tartufo – A Comprehensive Guide To Securing Your Git Repositories

Tartufo will, by default, scan the entire history of a git repository for any text…

2 days ago

Loco : A Rails-Inspired Framework For Rust Developers

Loco is strongly inspired by Rails. If you know Rails and Rust, you'll feel at…

3 days ago

Monolith : The Ultimate Tool For Storing Entire Web Pages As Single HTML Files

A data hoarder’s dream come true: bundle any web page into a single HTML file.…

3 days ago