net_sniff

package
v0.0.0-...-5f331bc Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPRequest

type HTTPRequest struct {
	Method      string      `json:"method"`
	Proto       string      `json:"proto"`
	Host        string      `json:"host"`
	URL         string      `json:"url:"`
	Headers     http.Header `json:"headers"`
	ContentType string      `json:"content_type"`
	Body        []byte      `json:"body"`
}

func (HTTPRequest) IsType

func (r HTTPRequest) IsType(ctype string) bool

type HTTPResponse

type HTTPResponse struct {
	Protocol         string      `json:"protocol"`
	Status           string      `json:"status"`
	StatusCode       int         `json:"status_code"`
	Headers          http.Header `json:"headers"`
	Body             []byte      `json:"body"`
	ContentLength    int64       `json:"content_length"`
	ContentType      string      `json:"content_type"`
	TransferEncoding []string    `json:"transfer_encoding"`
}

func (HTTPResponse) IsType

func (r HTTPResponse) IsType(ctype string) bool

type List

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

Chain definition

type Node

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

Due to the fact that there may be overlapping packets in the order of arrival. We need to create a paradigm where queries are stored while waiting for their response.

We do this via a chained list, stopping the source port and TCP payload of the query then place it in a list.

When we receive a response, we retrieve its destination port, go through the list and if its port matches, we retrieve the value, and delete its node from the list

Node definition

type SniffData

type SniffData map[string]interface{}

type Sniffer

type Sniffer struct {
	session.SessionModule
	Stats *SnifferStats
	Ctx   *SnifferContext
	// contains filtered or unexported fields
}

func NewSniffer

func NewSniffer(s *session.Session) *Sniffer

func (Sniffer) Author

func (mod Sniffer) Author() string

func (*Sniffer) Configure

func (mod *Sniffer) Configure() error

func (Sniffer) Description

func (mod Sniffer) Description() string

func (*Sniffer) GetContext

func (mod *Sniffer) GetContext() (error, *SnifferContext)

func (Sniffer) Name

func (mod Sniffer) Name() string

func (*Sniffer) Start

func (mod *Sniffer) Start() error

func (*Sniffer) StartFuzzing

func (mod *Sniffer) StartFuzzing() error

func (*Sniffer) Stop

func (mod *Sniffer) Stop() error

func (*Sniffer) StopFuzzing

func (mod *Sniffer) StopFuzzing() error

type SnifferContext

type SnifferContext struct {
	Handle       *pcap.Handle
	Source       string
	DumpLocal    bool
	Verbose      bool
	Filter       string
	Expression   string
	Compiled     *regexp.Regexp
	Output       string
	OutputFile   *os.File
	OutputWriter *pcapgo.Writer
}

func NewSnifferContext

func NewSnifferContext() *SnifferContext

func (*SnifferContext) Close

func (c *SnifferContext) Close()

func (*SnifferContext) Log

func (c *SnifferContext) Log(sess *session.Session)

type SnifferEvent

type SnifferEvent struct {
	PacketTime  time.Time   `json:"time"`
	Protocol    string      `json:"protocol"`
	Source      string      `json:"from"`
	Destination string      `json:"to"`
	Message     string      `json:"message"`
	Data        interface{} `json:"data"`
}

func NewSnifferEvent

func NewSnifferEvent(t time.Time, proto string, src string, dst string, data interface{}, format string, args ...interface{}) SnifferEvent

func (SnifferEvent) Push

func (e SnifferEvent) Push()

type SnifferStats

type SnifferStats struct {
	NumLocal    uint64
	NumMatched  uint64
	NumDumped   uint64
	NumWrote    uint64
	Started     time.Time
	FirstPacket time.Time
	LastPacket  time.Time
}

func NewSnifferStats

func NewSnifferStats() *SnifferStats

func (*SnifferStats) Print

func (s *SnifferStats) Print() error

Jump to

Keyboard shortcuts

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