sshmitm.plugins.netconf.log_session module

NETCONF session-logging plugin.

Logs every RPC operation (operation name + message-id) and every RPC reply (message-id + ok / error-tag list) to the sshmitm logger. All messages are forwarded transparently — nothing is modified.

Enable with:

ssh-mitm server --netconf-forwarder log-session ...
class sshmitm.plugins.netconf.log_session.NetconfLoggingForwarder(session)

Bases: NetconfBaseForwarder

Log all NETCONF RPC operations and replies; forward everything unchanged.

Parameters:

session (Session)

handle_rpc_reply(message_id, element)

Called for each server RPC reply after the <hello> exchange.

message_id is the message-id attribute of the <rpc-reply>. element is the parsed <rpc-reply> element.

Return a modified element to rewrite the reply, or None to forward the original bytes unchanged. The default implementation always returns None.

Parameters:
  • message_id (str)

  • element (Element)

Return type:

Element | None

handle_rpc_request(message_id, operation, element)

Called for each client RPC after the <hello> exchange.

message_id is the message-id attribute of the <rpc> element. operation is the local name of the operation (e.g. "get-config"). element is the parsed <rpc> Element.

Return a modified element to rewrite the message, or None to forward the original bytes unchanged. The default implementation always returns None.

Parameters:
  • message_id (str)

  • operation (str)

  • element (Element)

Return type:

Element | None