packet

package
v0.0.0-...-1848e1e Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ARPScanHost

func ARPScanHost(iface string, targetIP string) (string, error)

func CraftPacket

func CraftPacket(layers ...gopacket.Layer) ([]byte, error)

Types

type ARP

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

func ARPLayer

func ARPLayer() *ARP

func (*ARP) Layer

func (a *ARP) Layer() *golayers.ARP

func (*ARP) SetDstIP

func (a *ARP) SetDstIP(ip string)

func (*ARP) SetDstMac

func (a *ARP) SetDstMac(address string)

func (*ARP) SetReply

func (a *ARP) SetReply()

func (*ARP) SetRequest

func (a *ARP) SetRequest()

func (*ARP) SetSrcIP

func (a *ARP) SetSrcIP(ip string)

func (*ARP) SetSrcMac

func (a *ARP) SetSrcMac(address string)

type DHCP

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

func DHCPLayer

func DHCPLayer() *DHCP

func (*DHCP) AddOption

func (d *DHCP) AddOption(optType string, data interface{})

func (*DHCP) Layer

func (d *DHCP) Layer() *golayers.DHCPv4

func (*DHCP) SetDstIP

func (d *DHCP) SetDstIP(ipStr string) error

func (*DHCP) SetDstMac

func (d *DHCP) SetDstMac(macStr string) error

func (*DHCP) SetMsgType

func (d *DHCP) SetMsgType(msgType string)

func (*DHCP) SetNextServerIP

func (d *DHCP) SetNextServerIP(serverIP string)

func (*DHCP) SetReply

func (d *DHCP) SetReply()

func (*DHCP) SetRequest

func (d *DHCP) SetRequest()

func (*DHCP) SetSrcIP

func (d *DHCP) SetSrcIP(ipStr string) error

func (*DHCP) SetType

func (d *DHCP) SetType(linkType golayers.LinkType)

func (*DHCP) SetXid

func (d *DHCP) SetXid(xid uint32)

type DNS

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

func DNSLayer

func DNSLayer() *DNS

func (*DNS) AddAnswer

func (dns *DNS) AddAnswer(name string, ipStr string)

func (*DNS) AddQuestion

func (dns *DNS) AddQuestion(name string)

func (*DNS) Layer

func (dns *DNS) Layer() *golayers.DNS

type Dot1Q

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

func Dot1QLayer

func Dot1QLayer() *Dot1Q

Dot1QLayer Create a new Dot1Q layer with default values

func (*Dot1Q) Layer

func (dot1q *Dot1Q) Layer() *golayers.Dot1Q

Layer Get the underlying gopacket Dot1Q layer

func (*Dot1Q) SetDEI

func (dot1q *Dot1Q) SetDEI(dei bool)

SetDEI Set Drop Eligible Indicator (DEI)

func (*Dot1Q) SetPriority

func (dot1q *Dot1Q) SetPriority(pcp uint8) error

SetPriority Set Priority Code Point (PCP)

func (*Dot1Q) SetType

func (dot1q *Dot1Q) SetType(etherType golayers.EthernetType)

SetType Set the Type field

func (*Dot1Q) SetVLANIdentifier

func (dot1q *Dot1Q) SetVLANIdentifier(id uint16) error

SetVLANIdentifier Set the VLAN identifier

type Dot3

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

func Dot3Layer

func Dot3Layer() *Dot3

NewDot3Layer creates a new Dot3 layer

func (*Dot3) Layer

func (d *Dot3) Layer() *protocols.Dot3

Layer returns the underlying Dot3 layer

func (*Dot3) SetDstMAC

func (d *Dot3) SetDstMAC(macStr string) error

SetDstMAC sets the destination MAC address

func (*Dot3) SetLength

func (d *Dot3) SetLength(length uint16)

SetLength sets the length

func (*Dot3) SetSrcMAC

func (d *Dot3) SetSrcMAC(macStr string) error

SetSrcMAC sets the source MAC address

type Ethernet

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

func EthernetLayer

func EthernetLayer() *Ethernet

func (*Ethernet) Layer

func (e *Ethernet) Layer() *golayers.Ethernet

func (*Ethernet) SetDstMAC

func (e *Ethernet) SetDstMAC(macStr string) error

func (*Ethernet) SetEthernetType

func (e *Ethernet) SetEthernetType(ethType golayers.EthernetType)

func (*Ethernet) SetSrcMAC

func (e *Ethernet) SetSrcMAC(macStr string) error

type ICMPv4

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

func ICMPv4Layer

func ICMPv4Layer() *ICMPv4

func (*ICMPv4) Layer

func (icmp *ICMPv4) Layer() *golayers.ICMPv4

func (*ICMPv4) SetChecksum

func (icmp *ICMPv4) SetChecksum(CheckSum uint16)

func (*ICMPv4) SetID

func (icmp *ICMPv4) SetID(ID uint16)

func (*ICMPv4) SetTypeCode

func (icmp *ICMPv4) SetTypeCode(TypeCode golayers.ICMPv4TypeCode)

type IPv4

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

func IPv4Layer

func IPv4Layer() *IPv4

func (*IPv4) Layer

func (ip *IPv4) Layer() *golayers.IPv4

func (*IPv4) SetDstIP

func (ip *IPv4) SetDstIP(ipStr string) error

func (*IPv4) SetProtocol

func (ip *IPv4) SetProtocol(protocol golayers.IPProtocol)

func (*IPv4) SetSrcIP

func (ip *IPv4) SetSrcIP(ipStr string) error

type IPv6

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

func IPv6Layer

func IPv6Layer() *IPv6

func (*IPv6) Layer

func (ipv6 *IPv6) Layer() *golayers.IPv6

func (*IPv6) SetDstIP

func (ipv6 *IPv6) SetDstIP(ipStr string) error

func (*IPv6) SetSrcIP

func (ipv6 *IPv6) SetSrcIP(ipStr string) error

type LLC

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

func LLCLayer

func LLCLayer() *LLC

func (*LLC) Layer

func (l *LLC) Layer() *layers.LLC

func (*LLC) SetControl

func (l *LLC) SetControl(control uint16)

func (*LLC) SetDSAP

func (l *LLC) SetDSAP(dsap uint8)

func (*LLC) SetSSAP

func (l *LLC) SetSSAP(ssap uint8)

type RIP

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

func RIPLayer

func RIPLayer() *RIP

func (*RIP) AddEntry

func (r *RIP) AddEntry(aFI uint16, routeTag uint16, ipAddress, subnetMask, nextHop net.IP, metric uint32) error

func (*RIP) Layer

func (r *RIP) Layer() *protocols.RIPPacket

func (*RIP) SetCommand

func (r *RIP) SetCommand(command uint8)

func (*RIP) SetVersion

func (r *RIP) SetVersion(version uint8)

type STP

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

func STPLayer

func STPLayer() *STP

func (*STP) Layer

func (stp *STP) Layer() *layers.STP

func (*STP) SetBridgeID

func (stp *STP) SetBridgeID(bridgeID uint16)

func (*STP) SetBridgeMacStr

func (stp *STP) SetBridgeMacStr(bridgeMac string)

SetBridgeMacStr set Bridge Mac from a string

func (*STP) SetBridgePriority

func (stp *STP) SetBridgePriority(priority uint16)

func (*STP) SetRootBridgeID

func (stp *STP) SetRootBridgeID(rootBridgeID uint16)

func (*STP) SetRootBridgeMacStr

func (stp *STP) SetRootBridgeMacStr(rootMac string)

SetRootBridgeMacStr set Root Mac from a string

func (*STP) SetRootBridgePriority

func (stp *STP) SetRootBridgePriority(priority uint16)

type TCP

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

func TCPLayer

func TCPLayer() *TCP

func (*TCP) Layer

func (tcp *TCP) Layer() *golayers.TCP

func (*TCP) SetAck

func (tcp *TCP) SetAck()

func (*TCP) SetDstPort

func (tcp *TCP) SetDstPort(portStr string) error

func (*TCP) SetSrcPort

func (tcp *TCP) SetSrcPort(portStr string) error

func (*TCP) SetSyn

func (tcp *TCP) SetSyn()

type UDP

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

func UDPLayer

func UDPLayer() *UDP

func (*UDP) Layer

func (udp *UDP) Layer() *golayers.UDP

func (*UDP) SetDstPort

func (udp *UDP) SetDstPort(portStr string) error

func (*UDP) SetSrcPort

func (udp *UDP) SetSrcPort(portStr string) error

Jump to

Keyboard shortcuts

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