pcapgen

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package pcapgen writes a synthetic capture containing known, labelled attacker behaviour.

This exists for two reasons that turn out to be the same reason.

The demo reason: anyone who clones this repository can watch the sensor find real detections in one command, without needing a network to sniff, without downloading a malware sample, and without the legal and privacy problems that come with shipping a capture of somebody's actual traffic.

The engineering reason: the generator declares what it planted. That turns "does the detector work?" from an opinion into an assertion — the integration test replays this capture and requires that every planted behaviour is found and that nothing else fires. A detector that stops working, or starts crying wolf on the benign background traffic, fails the build.

Index

Constants

View Source
const (
	Snaplen = 2048
)

Snaplen is the capture length recorded in the file header. Bulk-transfer packets are truncated to headerSnap, mirroring what a real sensor running with a small snaplen produces: full byte accounting, minimal file size.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expectation

type Expectation struct {
	RuleID string `json:"rule_id"`
	Src    string `json:"src"`
	Dst    string `json:"dst,omitempty"`
	Note   string `json:"note"`
}

Expectation is a behaviour deliberately planted in the capture.

type Summary

type Summary struct {
	Packets  int           `json:"packets"`
	Bytes    uint64        `json:"bytes"`
	Start    time.Time     `json:"start"`
	Duration time.Duration `json:"duration"`
	Expected []Expectation `json:"expected"`
	Hosts    []string      `json:"hosts"`
}

Summary describes what was written.

func Write

func Write(w io.Writer, start time.Time) (Summary, error)

Write generates the scenario capture.

Jump to

Keyboard shortcuts

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