traffic

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

Traffic Encoder

Traffic encoders are WASM-based callback functions used to encode/decode C2 messages. This package implements the wrapper API around the WASM runtime. Default functions are implemented in server/assets/traffic-encoders/.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateWasmEncoderID

func CalculateWasmEncoderID(wasmEncoderData []byte) uint64

CalculateWasmEncoderID - Creates an Encoder ID based on the hash of the wasm bin

Types

type TrafficEncoder

type TrafficEncoder struct {
	ID       uint64
	FileName string
	Data     []byte
	// contains filtered or unexported fields
}

TrafficEncoder - Implements the `Encoder` interface using a wasm backend

func CreateTrafficEncoder

func CreateTrafficEncoder(name string, wasm []byte, logger TrafficEncoderLogCallback) (*TrafficEncoder, error)

CreateTrafficEncoder - Initialize an WASM runtime using the provided module name, code, and log callback

func (*TrafficEncoder) Close

func (t *TrafficEncoder) Close() error

func (*TrafficEncoder) Decode

func (t *TrafficEncoder) Decode(data []byte) ([]byte, error)

Decode - Decode bytes using the wasm backend

func (*TrafficEncoder) Encode

func (t *TrafficEncoder) Encode(data []byte) ([]byte, error)

Encode - Encode data using the wasm backend

type TrafficEncoderLogCallback

type TrafficEncoderLogCallback func(string)

TrafficEncoderLogCallback - Callback function exposed to the wasm runtime to log messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL