traffic

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: GPL-3.0 Imports: 12 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

View Source
const (
	SmallRandom     = "Small Random (64 bytes)"
	MediumRandom    = "Medium Random (8KB)"
	LargeRandom     = "Large Random (8MB)"
	VeryLargeRandom = "Very Large Random (128MB)"
)

Variables

Functions

func CalculateWasmEncoderID

func CalculateWasmEncoderID(wasmEncoderData []byte) uint64

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

func LargeRandomTester

func LargeRandomTester(encoder *TrafficEncoder) *clientpb.TrafficEncoderTest

LargeRandomTester - 8MB random sample

func MediumRandomTester

func MediumRandomTester(encoder *TrafficEncoder) *clientpb.TrafficEncoderTest

MediumRandomTester - 8KB random sample

func SmallRandomTester

func SmallRandomTester(encoder *TrafficEncoder) *clientpb.TrafficEncoderTest

SmallRandomTester - 64 byte sample

func VeryLargeRandomTester

func VeryLargeRandomTester(encoder *TrafficEncoder) *clientpb.TrafficEncoderTest

VeryLargeRandomTester - 128MB random sample

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

type TrafficEncoderTestFunc

type TrafficEncoderTestFunc func(*TrafficEncoder) *clientpb.TrafficEncoderTest

Jump to

Keyboard shortcuts

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