packetinjector

package
v0.0.0-...-1d39891 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Namespace PacketInjector
	Namespace = "PacketInjector"
)

Variables

This section is empty.

Functions

func InjectionsMetadataDecoder

func InjectionsMetadataDecoder(raw json.RawMessage) (common.Getter, error)

InjectionsMetadataDecoder implements a json message raw decoder

func NewOnDemandInjectionClient

func NewOnDemandInjectionClient(g *graph.Graph, ch apiServer.Handler, agentPool ws.StructSpeakerPool, subscriberPool ws.StructSpeakerPool, etcdClient *etcd.Client) *client.OnDemandClient

NewOnDemandInjectionClient creates a new ondemand client based on API, graph and websocket

func NewOnDemandInjectionServer

func NewOnDemandInjectionServer(g *graph.Graph, pool *ws.StructClientPool) (*server.OnDemandServer, error)

NewOnDemandInjectionServer creates a new Ondemand probes server based on graph and websocket

Types

type Client

type Client struct {
	common.MasterElection
	// contains filtered or unexported fields
}

Client describes a packet injector client

type ForgedPacketGenerator

type ForgedPacketGenerator struct {
	*PacketInjectionRequest
	LayerType gopacket.LayerType
	// contains filtered or unexported fields
}

ForgedPacketGenerator is used to forge packets. It creates a gopacket.Packet with the proper layers that can be directly inserted into a socket.

func NewForgedPacketGenerator

func NewForgedPacketGenerator(pp *PacketInjectionRequest, encapType string) (*ForgedPacketGenerator, error)

NewForgedPacketGenerator returns a new generator of forged packets

func (*ForgedPacketGenerator) Close

func (f *ForgedPacketGenerator) Close()

Close the packet generator

func (*ForgedPacketGenerator) PacketSource

func (f *ForgedPacketGenerator) PacketSource() chan *Packet

PacketSource returns a channel when forged packets are pushed

type InjectionMetadata

type InjectionMetadata struct {
	PacketInjectionRequest
	ID          string
	State       string
	PacketCount int64
}

InjectionMetadata holds attributes and statistics about an injection easyjson:json gendecoder

type Injections

type Injections []*InjectionMetadata

Injections holds the injections metadata easyjson:json gendecoder

type Packet

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

Packet is defined as a gopacket and it byte representation

func (*Packet) Data

func (p *Packet) Data() []byte

Data returns the packet payload as an array of byte

type PacketForger

type PacketForger interface {
	PacketSource() chan *Packet
	Close()
}

PacketForger describes an objects that feeds a channel with packets

type PacketInjectionRequest

type PacketInjectionRequest struct {
	UUID             string
	SrcIP            net.IP           `valid:"isIP"`
	SrcMAC           net.HardwareAddr `valid:"isMAC"`
	SrcPort          uint16
	DstIP            net.IP           `valid:"isIP"`
	DstMAC           net.HardwareAddr `valid:"isMAC"`
	DstPort          uint16
	Type             string `valid:"regexp=^(icmp4|icmp6|tcp4|tcp6|udp4|udp6)$"`
	Count            uint64 `valid:"min=1"`
	ICMPID           uint16
	Interval         uint64
	Increment        bool
	IncrementPayload int64
	Payload          string
	Pcap             []byte
	TTL              uint8
}

PacketInjectionRequest describes the packet parameters to be injected easyjson:json

func (*PacketInjectionRequest) GetName

func (r *PacketInjectionRequest) GetName() string

GetName returns the name of the resource

func (*PacketInjectionRequest) ID

ID returns the id of the packet injection request

func (*PacketInjectionRequest) SetID

func (r *PacketInjectionRequest) SetID(id string)

SetID sets the id of the packet injection request

type PcapPacketGenerator

type PcapPacketGenerator struct {
	*PacketInjectionRequest
	// contains filtered or unexported fields
}

PcapPacketGenerator reads packets from a pcap file and inject it into a channel

func NewPcapPacketGenerator

func NewPcapPacketGenerator(pp *PacketInjectionRequest) (*PcapPacketGenerator, error)

NewPcapPacketGenerator returns a new pcap packet generator

func (*PcapPacketGenerator) Close

func (p *PcapPacketGenerator) Close()

Close the packet generator

func (*PcapPacketGenerator) PacketSource

func (p *PcapPacketGenerator) PacketSource() chan *Packet

PacketSource returns a channel when pcap packets are pushed

type Reply

type Reply struct {
	TrackingID string
	Error      string
}

Reply describes the reply to a packet injection request

Jump to

Keyboard shortcuts

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