packets

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package packets searches for a string in a TCP/UDP packet

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonTCPUDPPacket  = errors.New("not a tcp or a UDP packet")
	ErrEmptyStringMatch = errors.New("empty string can not be matched against the packet data")
	ErrNilPacket        = errors.New("nil packet sent for matching")
)

Sentinel errors for various scenarios

Functions

This section is empty.

Types

type PacketData

type PacketData interface {
	LayerPayload() []byte
}

PacketData is an interface that defines the methods required to process TCP or UDP layer

type StringPacketFinder

type StringPacketFinder interface {
	FindStringInTCPOrUDPPacket(
		ctx context.Context,
		gp gopacket.Packet,
		searchString string,
	) (bool, error)
}

StringPacketFinder - Searches for a string in a TCP or UDP packet

type StringSearchService

type StringSearchService struct {
	Log *zap.SugaredLogger
}

StringSearchService - Exposes the Packet capture service

func NewStringSearchService added in v1.1.4

func NewStringSearchService(log *zap.SugaredLogger) *StringSearchService

NewStringSearchService - returns a new instance of the StringSearchService

func (*StringSearchService) FindStringInTCPOrUDPPacket

func (svc *StringSearchService) FindStringInTCPOrUDPPacket(
	ctx context.Context,
	gp gopacket.Packet,
	searchString string,
) (bool, error)

FindStringInTCPOrUDPPacket - processes TCP or UDP packets and checks if the data payload contains a string

Jump to

Keyboard shortcuts

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