Kamene is a Python3-compatible network packet crafting, sniffing, manipulation, and visualization tool originally forked from Scapy.
Network packet and pcap file crafting/sniffing/manipulation/visualization security tool. Originally forked from scapy in 2015 and providing python3 compatibility since then.
Kamene is primarily used by network security professionals and researchers for creating, analyzing, and manipulating network packets and pcap files. It facilitates network monitoring, intrusion detection, and vulnerability scanning by providing a flexible Python library and CLI toolset for packet-level operations and visualization.
Kamene requires underlying system libraries like libpcap or WinPcap for packet capture and injection; these are not Python modules. Use bytes() instead of str() when converting packets to raw data. Windows users benefit from libdnet not being required, unlike other platforms. For processing large pcap files, use PcapReader to avoid memory issues. Kamene is actively maintained and included in Network Security Toolkit distributions.
Clone the repository: git clone https://github.com/phaethon/kamene.git
Install from source: python3 setup.py install
Or install latest published version via pip: pip3 install kamene
Ensure libpcap (or WinPcap on Windows) is installed on your system for packet sending/receiving
On MacOS, optionally install libdnet via brew: brew install libdnet
Optionally install netifaces on some configurations for improved experience
from kamene.all import * p = IP(dst = 'www.somesite.ex') / TCP(dport = 80) / Raw(b'Some raw bytes') sr1(p)
Creates and sends a TCP packet to a destination IP and receives one response packet.
ls()
Lists all supported protocol layers.
lsc()
Lists all available commands.
bytes(p)
Converts a packet object to its byte representation.
with PcapReader('filename.pcap') as pcap_reader: for pkt in pcap_reader: # process packet
Reads large pcap files iteratively to process packets without loading entire file into memory.
kamene
Starts the Kamene interactive command line interface.
tdecode <packet>
Uses tshark to decode a single packet for interactive debugging.