Crate snmp_parser

Source
Expand description

License: MIT Apache License 2.0 Build Status Crates.io Version

§SNMP Parser

An SNMP parser, implemented with the nom parser combinator framework.

It is written in pure Rust, fast, and makes extensive use of zero-copy. It also aims to be panic-free.

The goal of this parser is to implement SNMP messages analysis, for example to use rules from a network IDS.

To read a message, different functions must be used depending on the expected message version. This crate implements the asn1_rs::FromBer trait, so to parse a message, use the expected object and call function from_ber.

For example, to parse a SNMP v1 or v2c message (message structure is the same), use SnmpMessage::from_ber(input). To parse a SNMP v3 message, use SnmpV3Message::from_ber(input). If you don’t know the version of the message and want to parse a generic SNMP message, use SnmpGenericMessage::from_ber(input).

Other methods of parsing (functions) are provided for compatibility: these functions are parse_snmp_v1, parse_snmp_v2c and parse_snmp_v3. If you don’t know the version of the message and want to parse a generic SNMP message, use the parse_snmp_generic_message function.

The code is available on Github and is part of the Rusticata project.

Re-exports§

pub use asn1_rs;
pub use snmp::*;
pub use snmpv3::*;

Modules§

error
snmp
SNMP Parser (v1 and v2c)
snmpv3
SNMPv3 Parser

Structs§

Oid
Object ID (OID) representation which can be relative or non-relative.

Enums§

OidParseError
An error for OID parsing functions.
SnmpGenericMessage
An SNMP messsage parser, accepting v1, v2c or v3 messages

Functions§

parse_snmp_generic_message
Parse an SNMP messsage, accepting v1, v2c or v3 messages