Crate t2plugin

source ·
Expand description

This crate allows to easily develop Rust plugins for Tranalyzer2, a network traffic analysis tool.

An example Rust plugin for Tranalyzer2 using this crate can be found here: https://git.tranalyzer.com.com/tranalyzer/rustExample

Create a new plugin

  1. Download and install Tranalyzer2.

  2. Use t2plugin to create a new plugin based on the rustTemplate.

    cd $T2HOME/plugins
    t2plugin --rust -c myPluginName
    cd myPluginName
    
  3. Optional: change the PLUGINORDER at the top of autogen.sh.

  4. Fill the different methods of the T2Plugin trait implementation in src/lib.rs.

Modules

  • Contains the definition of a Flow.
  • Contains the definition of the different protocol headers (IP, TCP, UDP, …).
  • Contains the definition of a Packet.
  • Contains the SliceReader which allows to easily read integers and strings from a byte slice.

Macros

  • This macro transforms a struct implementing the T2Plugin trait into a plugin which can be loaded by Tranalyzer2.

Structs

  • This structure represents the output header of this plugin.

Enums

  • Types of values which can be outputted in Tranalyzer2 flow files.
  • Rust opaque representation of binary_value_t struct from Tranalyzer2
  • Rust opaque representation of outputBuffer_t struct from Tranalyzer2

Constants

Traits

  • Trait to tranform a per flow struct into a Tranalyzer2 plugin.

Functions

  • Returns the flow::Flow structure of the flow with flow_index=index.
  • Returns the number of flows that Tranalyzer2 can store in its internal hashtable.
  • Appends bytes to Tranalyzer2 output buffer.
  • Appends an IP address to Tranalyzer2 output buffer.
  • Appends a number (integer or float) to Tranalyzer2 output buffer.
  • Appends a list of numbers (integers or floats) to Tranalyzer2 output buffer.
  • Appends a string to Tranalyzer2 output buffer.
  • Appends a list of strings to Tranalyzer2 output buffer.

Type Definitions

  • unsigned long in C: u32 on 32-bit systems and u64 on 64-bit systems.