Sniffing & Spoofingpacket sniffernetwork analysiszero-copypcaptrafgenmausezahnnetwork debugging

netsniff-ng

netsniff-ng is a high performance Linux network sniffer for packet inspection. It uses zero-copy mechanisms to avoid kernel-to-userspace packet copying.

Description

netsniff-ng is a Linux network packet sniffer toolkit designed for protocol analysis, reverse engineering, and network debugging. It provides high performance through zero-copy mechanisms, eliminating the need for the kernel to copy packets from kernelspace to userspace. The toolkit includes multiple utilities for various network tasks, such as packet capturing/replaying, generation, statistics monitoring, and tunneling.

The suite consists of tools like netsniff-ng for packet analysis, trafgen for multithreaded packet generation, mausezahn for high-level packet generation with Cisco-CLI, ifpps for networking statistics, curvetun for IP tunneling, astraceroute for AS tracing, flowtop for connection tracking, and bpfc for BPF compilation. These tools support a wide range of use cases from traffic generation to filter compilation and system tracing.

Installation size is 2.08 MB and it depends on several libraries including libpcap, libnetfilter-conntrack, and libsodium. Users should refer to man pages for full flag details and advanced usage.

How It Works

netsniff-ng leverages zero-copy mechanisms for high-speed packet processing, directly handling packets without kernel-to-userspace copying. It supports BPF filters via bpfc compiler, fanout groups for load distribution, and various input/output formats like netdev, pcap, and directories. Utilities like trafgen use multithreading and zero-copy for packet generation, astraceroute employs TCP/ICMP probes for AS path tracing, curvetun implements curve25519-based encryption for IP tunneling, and tools like flowtop and ifpps provide real-time ncurses-based monitoring of netfilter flows and kernel statistics.

Installation

bash
sudo apt install netsniff-ng

Flags

-i|-d|--dev|--in <dev|pcap|->Input source as netdev, pcap or pcap stdin
-o|--out <dev|pcap|dir|cfg|->Output sink as netdev, pcap, directory, trafgen, or stdout
-f|--filter <bpf-file|-|expr>Use BPF filter from bpfc file/stdin or tcpdump-like expression
-H|--host <host>Host/IPv4/IPv6 to lookup AS route to (astraceroute)
-p|--port <num>Server port number (curvetun)
-4|--ipv4Show only IPv4 flows (flowtop)

Examples

Capture tcp or udp traffic from eth0 to pcap file with snaplen and timestamp
netsniff-ng --in eth0 --out dump.pcap -s -T 0xa1b2c3d4 --bind-cpu 0 tcp or udp
Capture raw 802.11 frames from wlan0 silently
netsniff-ng --in wlan0 --rfraw --out dump.pcap --silent --bind-cpu 0
IPv4 trace of AS with TCP SYN probe
astraceroute -i eth0 -N -S -H netsniff-ng.org
Generate packets from trafgen config on eth0
trafgen --dev eth0 --conf trafgen.cfg
Start interactive mode with telnet CLI on port 99
mausezahn -x 99
Show top-like netfilter TCP/UDP flows
flowtop
Show networking statistics for eth0
ifpps eth0
Updated 2026-04-16kali.org ↗