capture

package
v0.1.3-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPRequest  = "text/http-request"
	HTTPResponse = "text/http-response"
	PlainText    = "text/plain"
	Unknown      = "unknown"
)

Variables

View Source
var (
	HTTPRequestPattern    = regexp.MustCompile("(?m)^[A-Z]+\\s\\S+\\sHTTP/\\d+(\\.\\d)*")
	HTTPResponsePattern   = regexp.MustCompile("(?m)^HTTP/\\d+(\\.\\d)*\\s\\d+\\s[A-Z]+")
	PlainTextPattern      = regexp.MustCompile("([[:graph:]]|[[:space:]])+")
	ExtractRawContentType = regexp.MustCompile("[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+")
)
View Source
var (
	FailedToConvertErrorToString = errors.New("failed to convert to string the error received")
)

Functions

func TransformPacketToMap

func TransformPacketToMap(packet gopacket.Packet) map[string]interface{}

Types

type Data

type Data struct {
	Type    string
	Content []byte
}

func DetectChunkFormat

func DetectChunkFormat(content []byte) ([]Data, error)

func NewData

func NewData(t string, content []byte) Data

type Engine

type Engine struct {
	PacketFilter    func(packet gopacket.Packet) (bool, error)
	TCPStreamFilter func(bytes Data) (bool, error)
	VirtualMachine  *gplasma.VirtualMachine

	ErrorChannel chan error

	Packets    chan gopacket.Packet
	TCPStreams chan Data

	// Interface Configuration (This will be setup from the outside)
	Promiscuous      bool
	NetworkInterface string
	PcapFile         *os.File
	// contains filtered or unexported fields
}

func NewEngineWithFile

func NewEngineWithFile(file *os.File) (*Engine, error)

func NewEngineWithInterface

func NewEngineWithInterface(netInterface string) (*Engine, error)

func (*Engine) Close

func (engine *Engine) Close()

func (*Engine) DumpPcap

func (engine *Engine) DumpPcap() []byte

DumpPcap: This function should always be called before engine.Close()

func (*Engine) InitScript

func (engine *Engine) InitScript(script string) error

func (*Engine) Start

func (engine *Engine) Start() error

Jump to

Keyboard shortcuts

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