networkdetect

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 15 Imported by: 0 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

Index

Constants

View Source
const FlightSimRevision = "3709d1c6905d9527885c62f66f49a955c7b0d191"
View Source
const StatsFilename = "NetworkDetection.json"

Variables

This section is empty.

Functions

func BeaconStats

func BeaconStats(times []int64) (mean, jitter float64)

BeaconStats summarizes the intervals between consecutive connection starts. Jitter is the coefficient of variation (standard deviation / mean).

func SyntheticOnlyCase

func SyntheticOnlyCase(name string) bool

SyntheticOnlyCase reports qualification cases without a captured FlightSim execution: the benign controls and periodic beacons, which FlightSim at the pinned revision does not generate.

Types

type ApplicationEngine

type ApplicationEngine struct {
	Alerts, Overflow uint64
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(c Config) *ApplicationEngine

func (*ApplicationEngine) Observe

type ApplicationObservation

type ApplicationObservation struct {
	At                                             int64
	Scope                                          Scope
	Kind, SrcIP, DstIP                             string
	SrcPort, DstPort                               uint16
	Method, Path, Host, CommunityID, Qualification string
	Status                                         int
	Executable                                     bool
}

func Observation

func Observation(m proto.Message) (ApplicationObservation, bool)

type Config

type Config struct {
	WindowNS        int64       `json:"windowNS"`
	DedupNS         int64       `json:"dedupNS"`
	MaxKeys         int         `json:"maxKeys"`
	MaxFlows        int         `json:"maxFlows"`
	DNSNames        int         `json:"dnsNames"`
	ScanTargets     int         `json:"scanTargets"`
	SMTPHosts       int         `json:"smtpHosts"`
	ICMPEchoes      int         `json:"icmpEchoes"`
	SSHBytes        uint64      `json:"sshBytes"`
	ApprovedSources []string    `json:"approvedSources"`
	Indicators      []Indicator `json:"indicators"`

	// Periodic TCP connection starts from one source to one service. Samples
	// is the number of connection starts examined (0 disables), Jitter the
	// largest accepted coefficient of variation of their intervals.
	BeaconSamples       int     `json:"beaconSamples"`
	BeaconJitter        float64 `json:"beaconJitter"`
	BeaconMinIntervalNS int64   `json:"beaconMinIntervalNS"`
	BeaconWindowNS      int64   `json:"beaconWindowNS"`
}

func DefaultConfig

func DefaultConfig() Config

func LoadConfig

func LoadConfig(path string) (Config, error)

func (Config) Validate

func (c Config) Validate() error

type Engine

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

func New

func New(c Config) (*Engine, error)

func (*Engine) Observe

func (e *Engine) Observe(ev Event) ([]*types.Alert, error)

func (*Engine) Stats

func (e *Engine) Stats() Stats

type Event

type Event struct {
	At      int64  `json:"at"`
	Scope   Scope  `json:"scope"`
	Kind    string `json:"kind"`
	SrcIP   string `json:"srcIP"`
	DstIP   string `json:"dstIP"`
	SrcPort uint16 `json:"srcPort,omitempty"`
	DstPort uint16 `json:"dstPort,omitempty"`
	Name    string `json:"name,omitempty"`
	QType   uint16 `json:"qType,omitempty"`
	Seq     uint32 `json:"seq,omitempty"`
	Payload []byte `json:"payload,omitempty"`
}

Event is capture-derived; fixture scenario labels are never detector inputs.

func PacketEvents

func PacketEvents(packet gopacket.Packet, scope Scope) []Event

type Evidence

type Evidence struct {
	Schema         int        `json:"schema"`
	Detector       string     `json:"detector"`
	Classification string     `json:"classification"`
	Scope          Scope      `json:"scope"`
	FirstSeen      int64      `json:"firstSeen"`
	LastSeen       int64      `json:"lastSeen"`
	Observed       uint64     `json:"observed"`
	Threshold      uint64     `json:"threshold"`
	WindowNS       int64      `json:"windowNS"`
	Samples        []string   `json:"samples"`
	Limitations    []string   `json:"limitations"`
	Indicator      *Indicator `json:"indicator,omitempty"`
}

type Indicator

type Indicator struct {
	Value      string `json:"value"`
	Kind       string `json:"kind"`
	Category   string `json:"category"`
	Source     string `json:"source"`
	Version    string `json:"version"`
	ValidFrom  int64  `json:"validFrom"`
	ValidUntil int64  `json:"validUntil"`
}

type Scope

type Scope struct {
	Sensor    string   `json:"sensor"`
	Interface string   `json:"interface"`
	VLANs     []uint16 `json:"vlans,omitempty"`
}

func PacketScope

func PacketScope(packet gopacket.Packet, scope Scope) Scope

type Stats

type Stats struct {
	ApplicationAlerts uint64 `json:"applicationAlerts,omitempty"`
	Schema            int    `json:"schema"`
	Events            uint64 `json:"events"`
	Alerts            uint64 `json:"alerts"`
	Overflow          uint64 `json:"overflow"`
	Late              uint64 `json:"late"`
	StreamGaps        uint64 `json:"streamGaps"`
	Keys              int    `json:"keys"`
	Flows             int    `json:"flows"`
	Indicators        int    `json:"indicators"`
	Error             string `json:"error,omitempty"`
}

func ReadStats

func ReadStats(path string) (Stats, error)

Jump to

Keyboard shortcuts

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