Documentation
¶
Index ¶
- Constants
- func InjectPackets(pp *PacketInjectionParams, g *graph.Graph, chnl *channels) (string, error)
- type Client
- func (pc *Client) InjectPackets(host string, pp *PacketInjectionParams) (string, error)
- func (pc *Client) OnStartAsMaster()
- func (pc *Client) OnStartAsSlave()
- func (pc *Client) OnSwitchToMaster()
- func (pc *Client) OnSwitchToSlave()
- func (pc *Client) Start()
- func (pc *Client) Stop()
- func (pc *Client) StopInjection(host string, uuid string) error
- type ForgedPacketGenerator
- type Packet
- type PacketForger
- type PacketInjectionParams
- type PacketInjector
- type PcapPacketGenerator
- type Reply
- type Server
Constants ¶
const (
// Namespace Packet_Injector
Namespace = "Packet_Injector"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { common.MasterElection // contains filtered or unexported fields }
Client describes a packet injector client
func NewClient ¶
func NewClient(pool ws.StructSpeakerPool, etcdClient *etcd.Client, piHandler *apiServer.PacketInjectorAPI, g *graph.Graph) *Client
NewClient returns a new packet injector client
type ForgedPacketGenerator ¶
type ForgedPacketGenerator struct { *PacketInjectionParams // 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 *PacketInjectionParams, srcNode *graph.Node) (*ForgedPacketGenerator, error)
NewForgedPacketGenerator returns a new generator of forged packets
func (*ForgedPacketGenerator) PacketSource ¶
func (f *ForgedPacketGenerator) PacketSource() chan *Packet
PacketSource returns a channel when forged packets are pushed
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet is defined as a gopacket and it byte representation
type PacketForger ¶
type PacketForger interface {
PacketSource() chan *Packet
}
PacketForger describes an objects that feeds a channel with packets
type PacketInjectionParams ¶
type PacketInjectionParams struct { UUID string SrcNodeID graph.Identifier `valid:"nonzero"` SrcIP string SrcMAC string SrcPort int64 `valid:"min=0"` DstIP string DstMAC string DstPort int64 `valid:"min=0"` Type string `valid:"regexp=^(icmp4|icmp6|tcp4|tcp6|udp4|udp6)$"` Count int64 `valid:"min=1"` ID int64 `valid:"min=0"` Interval int64 `valid:"min=0"` Increment bool IncrementPayload int64 Payload string Pcap []byte }
PacketInjectionParams describes the packet parameters to be injected
type PacketInjector ¶
type PacketInjector struct {
// contains filtered or unexported fields
}
PacketInjector injects packets coming from a packet forget intoto a raw socket
func NewPacketInjector ¶
NewPacketInjector returns a new packet injector into one interface
func (*PacketInjector) Close ¶
func (p *PacketInjector) Close()
Close the packet injector and its socket
func (*PacketInjector) Write ¶
func (p *PacketInjector) Write(data []byte)
Write injects data into the raw socket
type PcapPacketGenerator ¶
type PcapPacketGenerator struct {
// contains filtered or unexported fields
}
PcapPacketGenerator reads packets from a pcap file and inject it into a channel
func NewPcapPacketGenerator ¶
func NewPcapPacketGenerator(pcap []byte) (*PcapPacketGenerator, error)
NewPcapPacketGenerator returns a new pcap packet generator
func (*PcapPacketGenerator) PacketSource ¶
func (p *PcapPacketGenerator) PacketSource() chan *Packet
PacketSource returns a channel when pcap packets are pushed
type Reply ¶
Reply describes the reply to a packet injection request
Source Files
¶
- client.go
- forge.go
- inject_packet.go
- pcap.go
- server.go