Skip to content

Parse various network packets using nom

License

Notifications You must be signed in to change notification settings

Yakiv-Huryk/pktparse-rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PktParse

This repository is just a bunch of packet parsing routines made with nom

Usage

Admitting your packet.data is an [u8]:

        if let Done(remaining, eth_frame) = ethernet::parse_ethernet_frame(packet.data) {
            if eth_frame.ethertype != EtherType::IPv4 {
                continue;
            }
            if let Done(remaining, ipv4_packet) = ipv4::parse_ipv4_header(remaining) {

For now the list of available parsers is rather short:

  • ethernet (with optional VLAN tag)
  • IPv4
  • IPv6
  • UDP
  • TCP ... but I'll gladly accept contributions.

Last changes (thanks @Stargateur !)

  • migrated to nom 5.1
  • added Clone & Copy traits when possible

About

Parse various network packets using nom

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%