Documentation ¶
Index ¶
- Constants
- func NewPcapSniffer(options *PcapSnifferOptions) types.PacketSource
- type BadgerSupervisor
- type Connection
- func (c *Connection) AppendToClientStreamRing(reassembly *types.Reassembly)
- func (c *Connection) Close()
- func (c *Connection) GetClientStreamRing() *types.Ring
- func (c *Connection) GetConnectionHash() types.ConnectionHash
- func (c *Connection) GetLastSeen() time.Time
- func (c *Connection) ReceivePacket(p *types.PacketManifest)
- func (c *Connection) SetClientFlow(flow *types.TcpIpFlow)
- func (c *Connection) SetPacketLogger(logger types.PacketLogger)
- func (c *Connection) SetServerFlow(flow *types.TcpIpFlow)
- func (c *Connection) SetState(state uint8)
- func (c *Connection) Start()
- func (c *Connection) Stop()
- type ConnectionFactory
- type ConnectionInterface
- type ConnectionOptions
- type Inquisitor
- func (i *Inquisitor) CloseAllConnections() int
- func (i *Inquisitor) CloseOlderThan(t time.Time) int
- func (i *Inquisitor) CloseRequest(conn ConnectionInterface)
- func (i *Inquisitor) Connections() []ConnectionInterface
- func (i *Inquisitor) GetObservedConnectionsChan(count int) chan bool
- func (i *Inquisitor) ReceivePacket(p *types.PacketManifest)
- func (i *Inquisitor) Start()
- func (i *Inquisitor) Stop()
- type InquisitorOptions
- type OrderedCoalesce
- type PacketDispatcher
- type PageReplaceRequest
- type PageRequest
- type Pager
- type PcapSniffer
- type PcapSnifferOptions
- type TimedRawPacket
Constants ¶
const ( // Stop looking for handshake hijack after several // packets have traversed the connection after entering // into TCP_DATA_TRANSFER state FIRST_FEW_PACKETS = 12 // TCP states TCP_UNKNOWN = 0 TCP_CONNECTION_REQUEST = 1 TCP_CONNECTION_ESTABLISHED = 2 TCP_DATA_TRANSFER = 3 TCP_CONNECTION_CLOSING = 4 TCP_INVALID = 5 TCP_CLOSED = 6 // initiating TCP closing finite state machine TCP_FIN_WAIT1 = 0 TCP_FIN_WAIT2 = 1 TCP_TIME_WAIT = 2 TCP_CLOSING = 3 // initiated TCP closing finite state machine TCP_CLOSE_WAIT = 0 TCP_LAST_ACK = 1 )
Variables ¶
This section is empty.
Functions ¶
func NewPcapSniffer ¶
func NewPcapSniffer(options *PcapSnifferOptions) types.PacketSource
NewPcapSniffer creates a new PcapSniffer struct
Types ¶
type BadgerSupervisor ¶
type BadgerSupervisor struct {
// contains filtered or unexported fields
}
func NewBadgerSupervisor ¶
func NewBadgerSupervisor(snifferOptions *PcapSnifferOptions, inquisitorOptions *InquisitorOptions, snifferFactoryFunc func(*PcapSnifferOptions) types.PacketSource, connectionFactory *ConnectionFactory, packetLoggerFactoryFunc func(string, *types.TcpIpFlow) types.PacketLogger) *BadgerSupervisor
func (BadgerSupervisor) GetDispatcher ¶
func (b BadgerSupervisor) GetDispatcher() PacketDispatcher
func (BadgerSupervisor) GetSniffer ¶
func (b BadgerSupervisor) GetSniffer() types.PacketSource
func (BadgerSupervisor) Run ¶
func (b BadgerSupervisor) Run()
func (BadgerSupervisor) Stopped ¶
func (b BadgerSupervisor) Stopped()
type Connection ¶
type Connection struct { ConnectionOptions ClientStreamRing *types.Ring ServerStreamRing *types.Ring ClientCoalesce *OrderedCoalesce ServerCoalesce *OrderedCoalesce PacketLogger types.PacketLogger // contains filtered or unexported fields }
Connection is used to track client and server flows for a given TCP connection. We implement a basic TCP finite state machine and track state in order to detect hanshake hijack and other TCP attacks such as segment veto and sloppy injection.
func NewRealConnection ¶
func NewRealConnection(options *ConnectionOptions) *Connection
func (*Connection) AppendToClientStreamRing ¶
func (c *Connection) AppendToClientStreamRing(reassembly *types.Reassembly)
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) GetClientStreamRing ¶
func (c *Connection) GetClientStreamRing() *types.Ring
func (*Connection) GetConnectionHash ¶
func (c *Connection) GetConnectionHash() types.ConnectionHash
func (*Connection) GetLastSeen ¶
func (c *Connection) GetLastSeen() time.Time
GetLastSeen returns the lastSeen timestamp after grabbing the lock
func (*Connection) ReceivePacket ¶
func (c *Connection) ReceivePacket(p *types.PacketManifest)
func (*Connection) SetClientFlow ¶
func (c *Connection) SetClientFlow(flow *types.TcpIpFlow)
func (*Connection) SetPacketLogger ¶
func (c *Connection) SetPacketLogger(logger types.PacketLogger)
func (*Connection) SetServerFlow ¶
func (c *Connection) SetServerFlow(flow *types.TcpIpFlow)
func (*Connection) SetState ¶
func (c *Connection) SetState(state uint8)
func (*Connection) Start ¶
func (c *Connection) Start()
Start is used to start the packet receiving goroutine for this connection... closeRequestChanListening shall be set to false for many of the TCP FSM unit tests.
func (*Connection) Stop ¶
func (c *Connection) Stop()
stop frees up all resources used by the connection
type ConnectionFactory ¶
type ConnectionFactory struct { CreateConnectionFunc func(*ConnectionOptions) ConnectionInterface // contains filtered or unexported fields }
func (ConnectionFactory) Build ¶
func (f ConnectionFactory) Build() ConnectionInterface
type ConnectionInterface ¶
type ConnectionInterface interface { Start() Close() Stop() SetPacketLogger(types.PacketLogger) GetConnectionHash() types.ConnectionHash ReceivePacket(*types.PacketManifest) GetLastSeen() time.Time }
func NewConnection ¶
func NewConnection(options *ConnectionOptions) ConnectionInterface
NewConnection returns a new Connection struct
type ConnectionOptions ¶
type Inquisitor ¶
type Inquisitor struct { InquisitorOptions PacketLoggerFactoryFunc func(string, *types.TcpIpFlow) types.PacketLogger // contains filtered or unexported fields }
Inquisitor sets up the connection pool and is an abstraction layer for dealing with incoming packets weather they be from a pcap file or directly off the wire.
func NewInquisitor ¶
func NewInquisitor(options *InquisitorOptions, connectionFactory *ConnectionFactory, packetLoggerFactoryFunc func(string, *types.TcpIpFlow) types.PacketLogger) *Inquisitor
NewInquisitor creates a new Inquisitor struct
func (*Inquisitor) CloseAllConnections ¶
func (i *Inquisitor) CloseAllConnections() int
CloseAllConnections closes all connections in the pool.
func (*Inquisitor) CloseOlderThan ¶
func (i *Inquisitor) CloseOlderThan(t time.Time) int
CloseOlderThan takes a Time argument and closes all the connections that have not received packet since that specified time
func (*Inquisitor) CloseRequest ¶
func (i *Inquisitor) CloseRequest(conn ConnectionInterface)
func (*Inquisitor) Connections ¶
func (i *Inquisitor) Connections() []ConnectionInterface
connectionsLocked returns a slice of Connection pointers.
func (*Inquisitor) GetObservedConnectionsChan ¶
func (i *Inquisitor) GetObservedConnectionsChan(count int) chan bool
func (*Inquisitor) ReceivePacket ¶
func (i *Inquisitor) ReceivePacket(p *types.PacketManifest)
type InquisitorOptions ¶
type InquisitorOptions struct { BufferedPerConnection int BufferedTotal int LogDir string LogPackets bool TcpIdleTimeout time.Duration MaxRingPackets int Logger types.Logger DetectHijack bool DetectInjection bool DetectCoalesceInjection bool MaxConcurrentConnections int }
InquisitorOptions are user set parameters for specifying the details of how to proceed with honey_bager's TCP connection monitoring. More parameters should soon be added here!
type OrderedCoalesce ¶
type OrderedCoalesce struct { // MaxBufferedPagesTotal is an upper limit on the total number of pages to // buffer while waiting for out-of-order packets. Once this limit is // reached, the assembler will degrade to flushing every connection it // gets a packet for. If <= 0, this is ignored. MaxBufferedPagesTotal int // MaxBufferedPagesPerConnection is an upper limit on the number of pages // buffered for a single flow. Should this limit be reached for a // particular flow, the smallest sequence number will be flushed, along // with any contiguous data. If <= 0, this is ignored. MaxBufferedPagesPerFlow int ConnectionClose func() Flow *types.TcpIpFlow StreamRing *types.Ring DetectCoalesceInjection bool // contains filtered or unexported fields }
func NewOrderedCoalesce ¶
func (*OrderedCoalesce) Close ¶
func (o *OrderedCoalesce) Close()
Close returns all used pages to the page cache via the Pager
type PacketDispatcher ¶
type PacketDispatcher interface { CloseRequest(ConnectionInterface) ReceivePacket(*types.PacketManifest) GetObservedConnectionsChan(int) chan bool Connections() []ConnectionInterface }
type PageReplaceRequest ¶
type PageRequest ¶
PageRequest is used to request a page from the Pager The new page will be sent on the ResponseChan and have it's timestamp set to Timestamp.
type Pager ¶
type Pager struct {
// contains filtered or unexported fields
}
Pager is used to synchronize access to our pagecache among many goroutines. No locks are used here. Instead, we use channels to send page points between goroutines.
func NewPager ¶
func NewPager() *Pager
NewPager creates a new Pager struct with an initialized pagecache and channels with which to access it.
func (*Pager) Next ¶
Next takes a timestamp argument and constructs a PageRequest, sends it to pager's requestPageChan, waits to receive a page pointer on the response channel and then returns it.
func (*Pager) Replace ¶
func (p *Pager) Replace(pagePtr *page)
Replace takes a page pointer argument and appends it to the pagecache's free list
func (*Pager) ReplaceAllFrom ¶
func (p *Pager) ReplaceAllFrom(pagePtr *page)
ReplaceAllFrom shall perform the Replace operation for all subsequently linked pages
func (*Pager) Start ¶
func (p *Pager) Start()
Start causes our Pager to start it's own goroutine to process pagecache requests over channels.
type PcapSniffer ¶
type PcapSniffer struct { PcapSnifferOptions // contains filtered or unexported fields }
PcapSniffer sets up the connection pool and is an abstraction layer for dealing with incoming packets weather they be from a pcap file or directly off the wire.
func (*PcapSniffer) GetStartedChan ¶
func (i *PcapSniffer) GetStartedChan() chan bool
func (*PcapSniffer) SetSupervisor ¶
func (i *PcapSniffer) SetSupervisor(supervisor types.Supervisor)
func (*PcapSniffer) Start ¶
func (i *PcapSniffer) Start()
Start... starts the TCP attack inquisition!
func (*PcapSniffer) Stop ¶
func (i *PcapSniffer) Stop()
type PcapSnifferOptions ¶
type PcapSnifferOptions struct { Interface string Filename string WireDuration time.Duration Filter string Snaplen int Dispatcher PacketDispatcher Supervisor types.Supervisor }
type TimedRawPacket struct { Timestamp time.Time RawPacket []byte }
PcapSnifferOptions are user set parameters for specifying how to receive packets.
type TimedRawPacket ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/google/gopacket
Package gopacket provides packet decoding for the Go language.
|
Package gopacket provides packet decoding for the Go language. |
_workspace/src/github.com/google/gopacket/afpacket
Package afpacket provides Go bindings for MMap'd AF_PACKET socket reading.
|
Package afpacket provides Go bindings for MMap'd AF_PACKET socket reading. |
_workspace/src/github.com/google/gopacket/bytediff
Package bytediff provides a simple diff utility for looking at differences in byte slices.
|
Package bytediff provides a simple diff utility for looking at differences in byte slices. |
_workspace/src/github.com/google/gopacket/dumpcommand
Package dumpcommand implements a run function for pfdump and pcapdump with many similar flags/features to tcpdump.
|
Package dumpcommand implements a run function for pfdump and pcapdump with many similar flags/features to tcpdump. |
_workspace/src/github.com/google/gopacket/examples/arpscan
arpscan implements ARP scanning of all interfaces' local networks using gopacket and its subpackages.
|
arpscan implements ARP scanning of all interfaces' local networks using gopacket and its subpackages. |
_workspace/src/github.com/google/gopacket/examples/bidirectional
This binary provides an example of connecting up bidirectional streams from the unidirectional streams provided by gopacket/tcpassembly.
|
This binary provides an example of connecting up bidirectional streams from the unidirectional streams provided by gopacket/tcpassembly. |
_workspace/src/github.com/google/gopacket/examples/bytediff
This binary shows how to display byte differences to users via the bytediff library.
|
This binary shows how to display byte differences to users via the bytediff library. |
_workspace/src/github.com/google/gopacket/examples/httpassembly
This binary provides sample code for using the gopacket TCP assembler and TCP stream reader.
|
This binary provides sample code for using the gopacket TCP assembler and TCP stream reader. |
_workspace/src/github.com/google/gopacket/examples/pcapdump
The pcapdump binary implements a tcpdump-like command line tool with gopacket using pcap as a backend data collection mechanism.
|
The pcapdump binary implements a tcpdump-like command line tool with gopacket using pcap as a backend data collection mechanism. |
_workspace/src/github.com/google/gopacket/examples/pfdump
The pfdump binary implements a tcpdump-like command line tool with gopacket using pfring as a backend data collection mechanism.
|
The pfdump binary implements a tcpdump-like command line tool with gopacket using pfring as a backend data collection mechanism. |
_workspace/src/github.com/google/gopacket/examples/statsassembly
This binary provides sample code for using the gopacket TCP assembler raw, without the help of the tcpreader library.
|
This binary provides sample code for using the gopacket TCP assembler raw, without the help of the tcpreader library. |
_workspace/src/github.com/google/gopacket/examples/synscan
synscan implements a TCP syn scanner on top of pcap.
|
synscan implements a TCP syn scanner on top of pcap. |
_workspace/src/github.com/google/gopacket/examples/util
Package util provides shared utilities for all gopacket examples.
|
Package util provides shared utilities for all gopacket examples. |
_workspace/src/github.com/google/gopacket/layers
Package layers provides decoding layers for many common protocols.
|
Package layers provides decoding layers for many common protocols. |
_workspace/src/github.com/google/gopacket/macs
Package macs provides an in-memory mapping of all valid Ethernet MAC address prefixes to their associated organization.
|
Package macs provides an in-memory mapping of all valid Ethernet MAC address prefixes to their associated organization. |
_workspace/src/github.com/google/gopacket/pcap
Package pcap allows users of gopacket to read packets off the wire or from pcap files.
|
Package pcap allows users of gopacket to read packets off the wire or from pcap files. |
_workspace/src/github.com/google/gopacket/pcap/gopacket_benchmark
This benchmark reads in file <tempdir>/gopacket_benchmark.pcap and measures the time it takes to decode all packets from that file.
|
This benchmark reads in file <tempdir>/gopacket_benchmark.pcap and measures the time it takes to decode all packets from that file. |
_workspace/src/github.com/google/gopacket/pcapgo
Package pcapgo provides some native PCAP support, not requiring C libpcap to be installed.
|
Package pcapgo provides some native PCAP support, not requiring C libpcap to be installed. |
_workspace/src/github.com/google/gopacket/pfring
Package pfring wraps the PF_RING C library for Go.
|
Package pfring wraps the PF_RING C library for Go. |
_workspace/src/github.com/google/gopacket/routing
Package routing provides a very basic but mostly functional implementation of a routing table for IPv4/IPv6 addresses.
|
Package routing provides a very basic but mostly functional implementation of a routing table for IPv4/IPv6 addresses. |
_workspace/src/github.com/google/gopacket/tcpassembly
Package tcpassembly provides TCP stream re-assembly.
|
Package tcpassembly provides TCP stream re-assembly. |
_workspace/src/github.com/google/gopacket/tcpassembly/tcpreader
Package tcpreader provides an implementation for tcpassembly.Stream which presents the caller with an io.Reader for easy processing.
|
Package tcpreader provides an implementation for tcpassembly.Stream which presents the caller with an io.Reader for easy processing. |
cmd
|
|
Honeybadger types package
|
Honeybadger types package |