analyzer

package
v0.0.0-...-38f8c47 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

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

func New

func New(pcapFile, outputDir string, workers int) *Analyzer

func NewLive

func NewLive(iface, bpfFilter, outputDir string, workers int) *Analyzer

func (*Analyzer) Analyze

func (a *Analyzer) Analyze() error

func (*Analyzer) AnalyzeLive

func (a *Analyzer) AnalyzeLive() error

func (*Analyzer) ExportCSV

func (a *Analyzer) ExportCSV() error

func (*Analyzer) ExportHTML

func (a *Analyzer) ExportHTML() error

func (*Analyzer) ExportJSON

func (a *Analyzer) ExportJSON() error

func (*Analyzer) GetC2DetectionCount

func (a *Analyzer) GetC2DetectionCount() int

func (*Analyzer) GetCertCount

func (a *Analyzer) GetCertCount() int

func (*Analyzer) GetCredentialCount

func (a *Analyzer) GetCredentialCount() int

func (*Analyzer) GetCredentials

func (a *Analyzer) GetCredentials() []Credential

func (*Analyzer) GetFileCount

func (a *Analyzer) GetFileCount() int

func (*Analyzer) GetFlowCount

func (a *Analyzer) GetFlowCount() int

func (*Analyzer) GetHTTPRequestCount

func (a *Analyzer) GetHTTPRequestCount() int

func (*Analyzer) GetOutputDir

func (a *Analyzer) GetOutputDir() string

func (*Analyzer) GetProcessed

func (a *Analyzer) GetProcessed() int64

func (*Analyzer) GetProcessingTime

func (a *Analyzer) GetProcessingTime() time.Duration

func (*Analyzer) GetProtocolDistribution

func (a *Analyzer) GetProtocolDistribution() map[string]int64

func (*Analyzer) GetRecentC2

func (a *Analyzer) GetRecentC2(limit int) []C2Detection

func (*Analyzer) GetRecentThreats

func (a *Analyzer) GetRecentThreats(limit int) []Threat

func (*Analyzer) GetStartTime

func (a *Analyzer) GetStartTime() time.Time

func (*Analyzer) GetStats

func (a *Analyzer) GetStats() Statistics

Helper methods for GUI

func (*Analyzer) GetThreatCount

func (a *Analyzer) GetThreatCount() int

func (*Analyzer) GetThreats

func (a *Analyzer) GetThreats() []Threat

func (*Analyzer) GetTopFlows

func (a *Analyzer) GetTopFlows(limit int) []Flow

func (*Analyzer) GetTopTalkers

func (a *Analyzer) GetTopTalkers(limit int) []TalkerInfo

func (*Analyzer) GetTotalBytes

func (a *Analyzer) GetTotalBytes() int64

func (*Analyzer) IsCaptureStopped

func (a *Analyzer) IsCaptureStopped() bool

func (*Analyzer) PrintSummary

func (a *Analyzer) PrintSummary()

func (*Analyzer) StopCapture

func (a *Analyzer) StopCapture()

type Anonymization

type Anonymization struct {
	Timestamp  string
	SrcIP      string
	DstIP      string
	DstPort    uint16
	Type       string
	Confidence string
}

Anonymization represents detected anonymization/VPN usage

type BeaconPattern

type BeaconPattern struct {
	FlowKey     FlowKey
	Interval    time.Duration
	Jitter      float64
	Confidence  string
	PacketCount int
	StartTime   time.Time
	EndTime     time.Time
	BytesTotal  int64
}

BeaconPattern represents a detected beaconing pattern

type C2Detection

type C2Detection struct {
	Timestamp  time.Time
	Framework  string // CobaltStrike, Metasploit, Empire, etc.
	Indicator  string
	Confidence string // high, medium, low
	Detail     string
	SrcIP      string
	DstIP      string
	URL        string
}

type Certificate

type Certificate struct {
	Subject  string
	Issuer   string
	NotAfter time.Time
	Path     string
}

type Credential

type Credential struct {
	Protocol string
	SrcIP    string
	DstIP    string
	Username string
	Password string
	Method   string
	Strength int
	Packets  []int64
}

type CryptoMining

type CryptoMining struct {
	Timestamp  string
	SrcIP      string
	DstIP      string
	DstPort    uint16
	Pool       string
	Protocol   string
	Confidence string
}

CryptoMining represents detected cryptocurrency mining activity

type DashboardServer

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

DashboardServer serves a live dashboard over HTTP with SSE updates.

func NewDashboardServer

func NewDashboardServer(a *Analyzer, port int) *DashboardServer

NewDashboardServer creates a dashboard bound to the given analyzer.

func (*DashboardServer) Shutdown

func (ds *DashboardServer) Shutdown()

Shutdown gracefully stops the dashboard server.

func (*DashboardServer) Start

func (ds *DashboardServer) Start() error

Start begins serving the dashboard. Non-blocking.

type DashboardSnapshot

type DashboardSnapshot struct {
	Timestamp     string           `json:"timestamp"`
	Uptime        string           `json:"uptime"`
	Stopped       bool             `json:"stopped"`
	Packets       int64            `json:"packets"`
	Bytes         int64            `json:"bytes"`
	Flows         int              `json:"flows"`
	Threats       int              `json:"threats"`
	HTTPReqs      int              `json:"httpReqs"`
	C2Count       int              `json:"c2Count"`
	Credentials   int              `json:"credentials"`
	ThreatScore   float64          `json:"threatScore"`
	Protocols     map[string]int64 `json:"protocols"`
	TopTalkers    []TalkerInfo     `json:"topTalkers"`
	RecentThreats []Threat         `json:"recentThreats"`
	RecentC2      []C2Detection    `json:"recentC2"`
	TopFlows      []FlowSnapshot   `json:"topFlows"`
}

DashboardSnapshot is the JSON payload sent to the browser each tick.

type DataExfiltration

type DataExfiltration struct {
	Timestamp  time.Time
	SrcIP      string
	DstIP      string
	DstPort    uint16
	Protocol   string
	BytesOut   int64
	Duration   time.Duration
	Rate       float64
	Method     string
	Confidence string
}

DataExfiltration represents detected data exfiltration

type ExtractedFile

type ExtractedFile struct {
	Name     string
	Size     int64
	MD5      string
	Protocol string
	Path     string
}

type Flow

type Flow struct {
	Key        FlowKey
	Packets    int64
	Bytes      int64
	StartTime  time.Time
	EndTime    time.Time
	Timestamps []time.Time
}

type FlowKey

type FlowKey struct {
	SrcIP   string
	SrcPort uint16
	DstIP   string
	DstPort uint16
	Proto   string
}

type FlowSnapshot

type FlowSnapshot struct {
	SrcIP   string `json:"srcIP"`
	SrcPort uint16 `json:"srcPort"`
	DstIP   string `json:"dstIP"`
	DstPort uint16 `json:"dstPort"`
	Proto   string `json:"proto"`
	Packets int64  `json:"packets"`
	Bytes   int64  `json:"bytes"`
}

FlowSnapshot is a serializable subset of Flow for the dashboard.

type HTTPRequest

type HTTPRequest struct {
	Timestamp  time.Time
	Method     string
	URL        string
	Host       string
	Path       string
	UserAgent  string
	Referer    string
	StatusCode int
	SrcIP      string
	DstIP      string
}

type ICMPTunnel

type ICMPTunnel struct {
	Timestamp   time.Time
	SrcIP       string
	DstIP       string
	Type        uint8
	Code        uint8
	PayloadSize int
	Entropy     float64
	Suspicious  bool
	Reason      string
	Confidence  string
}

ICMPTunnel represents a detected ICMP tunnel

type IRCMessage

type IRCMessage struct {
	Timestamp time.Time
	Channel   string
	Nick      string
	Message   string
	Type      string // JOIN, PART, PRIVMSG, NOTICE, etc.
	SrcIP     string
	DstIP     string
}

type LDAPMessage

type LDAPMessage struct {
	Timestamp  time.Time
	Operation  string // BIND, SEARCH, ADD, MODIFY, DELETE
	DN         string // Distinguished Name
	Username   string
	Password   string
	Filter     string
	Attributes []string
	SrcIP      string
	DstIP      string
}

type LateralMovement

type LateralMovement struct {
	Timestamp   time.Time
	SrcIP       string
	Targets     []string
	Protocol    string
	Port        uint16
	Technique   string
	Confidence  string
	TargetCount int
}

LateralMovement represents detected lateral movement activity

type PacketInfo

type PacketInfo struct {
	Number    int64
	Timestamp time.Time
	Length    int
	SrcIP     string
	DstIP     string
	SrcPort   uint16
	DstPort   uint16
	Protocol  string
	Info      string
}

type SIPMessage

type SIPMessage struct {
	Timestamp time.Time
	Method    string // REGISTER, INVITE, BYE, etc.
	From      string
	To        string
	CallID    string
	UserAgent string
	Auth      string
	SrcIP     string
	DstIP     string
}

type SNMPMessage

type SNMPMessage struct {
	Timestamp time.Time
	Version   string
	Community string // v1/v2c community string
	Operation string // GET, SET, GETNEXT, TRAP, etc.
	OID       string
	Value     string
	SrcIP     string
	DstIP     string
}

type SSHTunnel

type SSHTunnel struct {
	Timestamp      time.Time
	SrcIP          string
	DstIP          string
	SrcPort        uint16
	DstPort        uint16
	BytesPerSecond float64
	PacketRate     float64
	Duration       float64
	TotalBytes     int64
	TotalPackets   int64
	Suspicious     bool
	Reason         string
	Confidence     string
}

SSHTunnel represents a detected SSH tunnel

type Statistics

type Statistics struct {
	TotalPackets int64
	TotalBytes   int64
	Duration     time.Duration
	Protocols    map[string]int64
	TopTalkers   []TalkerInfo
	ThreatScore  float64
}

type StegoDetection

type StegoDetection struct {
	Timestamp  time.Time
	Protocol   string
	Filename   string
	FileType   string
	Indicator  string
	Confidence string
	SrcIP      string
	DstIP      string
	Method     string
}

StegoDetection represents detected steganography

type SyslogMessage

type SyslogMessage struct {
	Timestamp time.Time
	Facility  int
	Severity  int
	Hostname  string
	Message   string
	SrcIP     string
	DstIP     string
}

type TFTPTransfer

type TFTPTransfer struct {
	Timestamp time.Time
	Operation string // RRQ (read) or WRQ (write)
	Filename  string
	Mode      string
	Size      int64
	SrcIP     string
	DstIP     string
}

type TLSFingerprint

type TLSFingerprint struct {
	Timestamp  time.Time
	SrcIP      string
	DstIP      string
	SrcPort    uint16
	DstPort    uint16
	JA3Hash    string
	JA3String  string
	ServerName string
	TLSVersion string
	Suspicious bool
	Framework  string
	Confidence string
}

TLSFingerprint represents a JA3/JA4 fingerprint

type TalkerInfo

type TalkerInfo struct {
	IP      string
	Packets int64
	Bytes   int64
}

type Threat

type Threat struct {
	Type     string
	Severity string
	Detail   string
	IOC      string
	Packet   int64
}

type XMPPMessage

type XMPPMessage struct {
	Timestamp time.Time
	Type      string // message, presence, iq
	From      string
	To        string
	Body      string
	Subject   string
	SrcIP     string
	DstIP     string
}

Jump to

Keyboard shortcuts

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