Scapy forges, decodes, sends, and captures network packets across many protocols. It works as an interactive shell or an imported Python library on Linux, macOS, BSD, and Windows.
Overview
Scapy is a Python-based interactive packet manipulation program and library. It can build or parse packets for a wide range of protocols, transmit them on the wire, capture traffic, read and write pcap files, and match requests with replies.
Default field values speed up packet prototyping. Documented use spans scanning, tracerouting, probing, unit tests, attacks, and network discovery, and the authors note overlap with tools such as hping, nmap, arpspoof, tcpdump, and wireshark for many classical tasks. It also supports specialized scenarios like invalid frames, custom 802.11 injection, and combined techniques such as VLAN hopping with ARP cache poisoning.
Scapy runs as a REPL shell or embedded library, requires Python 3.9+, and is intended to be cross-platform on Linux, macOS, most Unix systems, and Windows (with Npcap on Windows). Optional Python dependencies unlock plotting and cryptography features.
Installation is commonly via pip after platform prerequisites; Windows setups require mandatory dependencies described in the documentation. The project is GPLv2-licensed and maintained with extensive tutorials, notebooks, and community references.
Key features
- Multi-protocol packet forge and decode
- Live send, capture, and pcap I/O
- Interactive REPL shell
- Embeddable Python library API
- Request and reply matching
- 802.11 and VLAN techniques
- Cross-platform with Windows Npcap
- Extensible custom network layers
Use cases
- Network discovery and scanning
- Protocol prototyping and testing
- Traffic capture and analysis
- Security research and education
- VoIP and wireless lab experiments