#filter #wireshark #tshark

min_shark

A crate to parse and match a subset of the wireshark filter display language

4 releases (breaking)

0.5.0 Mar 19, 2024
0.4.0 Feb 29, 2024
0.2.0 Sep 19, 2023
0.1.0 Sep 1, 2023

#569 in Network programming

Download history 5/week @ 2024-01-01 13/week @ 2024-02-19 179/week @ 2024-02-26 28/week @ 2024-03-04 55/week @ 2024-03-11 147/week @ 2024-03-18 36/week @ 2024-04-01 12/week @ 2024-04-08

199 downloads per month

MIT/Apache

150KB
4K SLoC

GitHub Workflow Status (with event) docs.rs Crates.io Codecov Crates.io

This is a parser and execution engine for minimal Wireshark®-like filters.

See here for supported syntax.

Usage example:


    let filter = "ip.addr in {192.168.1.0/24, 10.1.1.0/24} and payload ~ '(?i)CaSeInSeNsItIvE'";
    let expression = min_shark::parse(filter);

    // .. later
    let is_match = expression
        .matcher()
        .tcp(true)
        .src_ip("1.1.1.1/24".parse().unwrap())
        .payload(b"CaseInsensitive")
        .is_match();

    assert_eq!(is_match, true);

Dependencies

~4–5.5MB
~100K SLoC