Expand description
pkttap — cross-platform packet capture with pktbaffle filter expressions.
§Quick start
use pkttap::Capture;
// Live capture
let mut cap = Capture::live("eth0")
.promiscuous(true)
.filter("tcp port 443")
.open()?;
while let Some(pkt) = cap.next()? {
println!("{} bytes", pkt.data.len());
}
// File capture
let mut cap = Capture::from_file("dump.pcap")
.filter("udp port 53")
.open()?;
while let Some(pkt) = cap.next()? {
println!("{} bytes at {:?}", pkt.data.len(), pkt.timestamp);
}Structs§
- Capture
- A packet source: either a live network interface or a pcap/pcapng file.
- Capture
Builder - Builder for a
Capture. - Dump
- A packet sink that writes to a pcap or pcapng file.
- Dump
Builder - Builder for a
Dump. - Packet
- An owned captured packet.
Enums§
Functions§
- default_
interface - Return the name of the default network interface for live capture.
- dump_
packets - Write
packetsto a pcap or pcapng file in one call. - interfaces
- List available network interfaces by name.