Crate ether

Source
Expand description

This crate provides a library for parsing and manipulating network data, packet captures.

§Usage

Add ether to the dependencies in your Cargo.toml and the following to root of your crate:

extern crate ether;

Here’s a simple example that prints all packets received on interface en0:

extern crate ether;

use ether::tap;
use ether::tap::Stream;

fn main() {
    let mut tap = tap::Tap::new("en0").unwrap();
    for packet in tap.stream().wait().filter_map(|p| p.ok()) {
        println!("{:?}", packet);
    }
}

Modules§

packet
Interpret data payloads as networking protocol packets/frames
pcap
Parse packet captures as a ‘header’ and list of ‘records’
tap
Tap into a network interface to view/inject real-time traffic