mail

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 30 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

This section is empty.

Variables

View Source
var Decoder = &decoder.AbstractDecoder{
	Type:        types.Type_NC_Mail,
	Name:        "Mail",
	Description: "Email messages collected from the network traffic",
	PostInit: func(d *decoder.AbstractDecoder) error {
		var err error
		mailLog, _, err = logging.InitZapLogger(
			decoderconfig.Instance.Out,
			"mail",
			decoderconfig.Instance.Debug,
		)
		return err
	},
	DeInit: func(sd *decoder.AbstractDecoder) error {
		return mailLog.Sync()
	},
}

Decoder for protocol analysis and writing audit records to disk.

Functions

func Parse

func Parse(conv *core.ConversationInfo, buf []byte, from, to string, logger *zap.Logger, origin string, ordinal uint64) *types.Mail

Parse attempts to read a mail from the conversation.

func ReadDotMessage added in v0.16.0

func ReadDotMessage(r *bufio.Reader) ([]byte, func(), error)

func ReadWireLine added in v0.16.0

func ReadWireLine(r *bufio.Reader) (string, error)

ReadWireLine preserves line endings and refuses oversized protocol lines.

func WriteMail

func WriteMail(d *types.Mail)

WriteMail writes an email audit record to disk.

Types

type MailFileExtractor

type MailFileExtractor struct{}

MailFileExtractor implements file extraction for email attachments

func (*MailFileExtractor) DescribeFile

func (m *MailFileExtractor) DescribeFile(handle *file.FileHandle) string

DescribeFile returns a human-readable description of the email attachment

func (*MailFileExtractor) ExtractFile

func (m *MailFileExtractor) ExtractFile(conv *core.ConversationInfo, data []byte, metadata file.FileMetadata) error

ExtractFile performs email attachment extraction

func (*MailFileExtractor) GetFileHandle

func (m *MailFileExtractor) GetFileHandle(conv *core.ConversationInfo, isOrigin bool, depth int) string

GetFileHandle generates a unique identifier for an email attachment

func (*MailFileExtractor) ProtocolName

func (m *MailFileExtractor) ProtocolName() string

ProtocolName returns the protocol name

type MailSecurityAnalysis

type MailSecurityAnalysis struct {
	// SPF/DKIM/DMARC results
	SPFResult   string
	SPFDomain   string
	DKIMResult  string
	DKIMDomain  string
	DMARCResult string
	DMARCPolicy string

	// Phishing indicators
	SenderDisplayNameMismatch bool
	HasSuspiciousReplyTo      bool
	URLCount                  int32
	AttachmentCount           int32
	AttachmentTypes           []string
	HasExecutableAttachment   bool
	HasMacroEnabledAttachment bool
	SubjectEntropy            float64
	HasUrgencyKeywords        bool
	ReceivedHopCount          int32
	IsForwarded               bool
	ReplyTo                   string
	FromDomain                string
}

MailSecurityAnalysis contains security analysis results for an email

func AnalyzeMail

func AnalyzeMail(mail *types.Mail, headers map[string]string, body string) *MailSecurityAnalysis

AnalyzeMail performs security analysis on an email

Jump to

Keyboard shortcuts

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