inference

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyAnnotationWarnings

func ApplyAnnotationWarnings(res *wt.Result)

ApplyAnnotationWarnings appends CLI-facing warnings when observations note conflicts.

func CompeteHypotheses

func CompeteHypotheses(hyps []wt.Hypothesis, topN int) []wt.Hypothesis

CompeteHypotheses prunes near-duplicates and ranks clearer winners per offset span. Losers are recorded on winners' Alternates with a short reason in Params["lost_to_reason"]. topN caps retained hypotheses (0 = keep all winners after collapse).

Prefer fewer high-quality hypotheses: same-span Medium losers under a High winner are dropped, weak Medium integer/pattern spam overlapping High structural winners is pruned, nested envelopes lose to concrete structure, and overlapping same-family fields collapse to non-overlapping winners (improves measured precision / lowers FPR without inventing confidence).

func ComputeChecksum

func ComputeChecksum(alg ChecksumAlg, data []byte) uint64

ComputeChecksum is exported for tests/fuzz.

func ExplainCompetition

func ExplainCompetition(hyps []wt.Hypothesis, start, end, topN int) []wt.Hypothesis

ExplainCompetition returns top-N hypotheses overlapping [start,end) with loser notes.

func Pearson

func Pearson(x, y []float64) (float64, bool)

Math helpers exported for compare package

func Spearman

func Spearman(x, y []float64) (float64, bool)

Types

type AnnotationPass

type AnnotationPass struct {
	Annotations []project.Annotation
}

AnnotationPass boosts hypotheses that agree with trusted human annotations and warns (via observations) when evidence contradicts an annotation. Annotations are never overwritten.

func (AnnotationPass) Name

func (a AnnotationPass) Name() string

func (AnnotationPass) Run

type ArrayPass

type ArrayPass struct{}

ArrayPass detects repeated structures: count field + repeated fixed-width records.

func (ArrayPass) Name

func (ArrayPass) Name() string

func (ArrayPass) Run

func (ArrayPass) Run(ctx context.Context, in *wt.PassInput) (*wt.PassOutput, error)

type BitfieldPass

type BitfieldPass struct{}

BitfieldPass analyzes low-cardinality bytes as flag bitfields.

func (BitfieldPass) Name

func (BitfieldPass) Name() string

func (BitfieldPass) Run

type ChecksumAlg

type ChecksumAlg string

ChecksumAlg identifies a tested algorithm.

const (
	AlgXOR8       ChecksumAlg = "xor8"
	AlgSUM8       ChecksumAlg = "sum8"
	AlgSUM16      ChecksumAlg = "sum16"
	AlgSUM32      ChecksumAlg = "sum32"
	AlgFletcher16 ChecksumAlg = "fletcher16"
	AlgFletcher32 ChecksumAlg = "fletcher32"
	AlgAdler32    ChecksumAlg = "adler32"
	AlgCRC8       ChecksumAlg = "crc8"
	AlgCRC16IBM   ChecksumAlg = "crc16-ibm"
	AlgCRC16CCITT ChecksumAlg = "crc16-ccitt"
	AlgCRC32IEEE  ChecksumAlg = "crc32-ieee"
	AlgCRC32C     ChecksumAlg = "crc32c"
)

type ChecksumPass

type ChecksumPass struct {
	// contains filtered or unexported fields
}

ChecksumPass tests common checksums with staged search + caching.

func (*ChecksumPass) Name

func (c *ChecksumPass) Name() string

func (*ChecksumPass) Run

func (c *ChecksumPass) Run(ctx context.Context, in *wt.PassInput) (*wt.PassOutput, error)

type CounterPass

type CounterPass struct{}

CounterPass detects monotonically increasing counters with wrap awareness.

func (CounterPass) Name

func (CounterPass) Name() string

func (CounterPass) Run

type EntropyClassPass

type EntropyClassPass struct{}

EntropyClassPass classifies high-entropy regions as compressed / encrypted-or-compressed / random / structured-high-entropy candidates. Never claims "encrypted" without caveats.

func (EntropyClassPass) Name

func (EntropyClassPass) Name() string

func (EntropyClassPass) Run

type IntegerPass

type IntegerPass struct{}

func (IntegerPass) Name

func (IntegerPass) Name() string

func (IntegerPass) Run

type LengthFieldPass

type LengthFieldPass struct{}

LengthCorrelationPass correlates integer candidates with message length.

func (LengthFieldPass) Name

func (LengthFieldPass) Name() string

func (LengthFieldPass) Run

type NestedPass

type NestedPass struct{}

NestedPass proposes nested header/payload groupings when length + array evidence aligns. Less conservative than requiring exhaustive proof: Medium confidence when length and trailing payload regions co-occur with array/count hypotheses.

func (NestedPass) Name

func (NestedPass) Name() string

func (NestedPass) Run

type StringPass

type StringPass struct{}

StringPass detects ASCII/UTF-8/null-terminated/length-prefixed strings.

func (StringPass) Name

func (StringPass) Name() string

func (StringPass) Run

type StructuredPass

type StructuredPass struct{}

StructuredPass proposes IPv4/IPv6/MAC/UUID/port pattern candidates (not automatic semantics).

func (StructuredPass) Name

func (StructuredPass) Name() string

func (StructuredPass) Run

type TLVPass

type TLVPass struct{}

TLVPass detects simple repeating Type-Length-Value patterns.

func (TLVPass) Name

func (TLVPass) Name() string

func (TLVPass) Run

func (TLVPass) Run(ctx context.Context, in *wt.PassInput) (*wt.PassOutput, error)

type TimestampPass

type TimestampPass struct{}

TimestampPass finds plausible unix timestamp fields correlated with capture time.

func (TimestampPass) Name

func (TimestampPass) Name() string

func (TimestampPass) Run

type VarintPass

type VarintPass struct{}

VarintPass detects protobuf-like varints / wire-type candidates with low default confidence. It never asserts "this is protobuf" without repeated structural confirmation.

func (VarintPass) Name

func (VarintPass) Name() string

func (VarintPass) Run

Jump to

Keyboard shortcuts

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