puresnmp_plugins.security.v2c module

This module implements community based security model for SNMP

class puresnmp_plugins.security.v2c.SNMPv2cSecurityModel

Bases: SecurityModel[PDU, Sequence]

Implementation of the security model for community based SNMPv2 messages

generate_request_message(message: PDU, security_engine_id: bytes, credentials: Credentials) Sequence

Take a plain unprocessed message and applies security to the message as defined by the concrete security model.

It returns the processed message including security modifications. Further processing is provided by the “message-processing-model” to prepare it for sending out to the network.

The kind of processing applied to the message depends on the credential type.

Parameters:
  • message – The original message

  • security_engine_id – The engine-id of the receiving SNMP engine

  • credentials – A credential object giving information on what kind of operations are needed on the message.

process_incoming_message(message: Sequence, credentials: Credentials) PDU

Takes a message which included potential security modifications (like encryption) and “undoes” these modifications in order to make the message usable again.

Returns an unprocessed message.

The kind of processing applied to the message depends on the credential type.

Parameters:
  • message – The original message

  • credentials – A credential object giving information on what kind of operations are needed on the message.

puresnmp_plugins.security.v2c.create() SNMPv2cSecurityModel

Creates a new instance of the SNMPv2 community-based security model