infer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package infer provides protocol reverse engineering — automatic structure inference from binary data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InferResult

type InferResult struct {
	Fields      []InferredField `json:"fields"`
	MinLength   int             `json:"min_length"`
	MaxLength   int             `json:"max_length"`
	FixedFields []int           `json:"fixed_offsets"`
}

InferResult holds the inference result.

func Infer

func Infer(packets [][]byte) (*InferResult, error)

Infer analyzes multiple packets and infers protocol structure.

func (*InferResult) ToPSL

func (r *InferResult) ToPSL(name string) string

ToPSL generates a candidate PSL file from inference results.

type InferredField

type InferredField struct {
	Offset     int            `json:"offset"`
	Length     int            `json:"length"`
	Name       string         `json:"name"`
	Type       string         `json:"type"` // "uint", "bytes", "string", "length_field", "enum"
	Confidence float64        `json:"confidence"`
	Values     []uint64       `json:"sample_values,omitempty"`
	EnumVals   map[uint64]int `json:"enum_distribution,omitempty"`
}

InferredField represents a field discovered by inference.

Jump to

Keyboard shortcuts

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