packets

package
v0.0.0-...-1254741 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LCPCodeConfigRequest    = LCPCode(0x01)
	LCPCodeConfigAck        = LCPCode(0x02)
	LCPCodeConfigNak        = LCPCode(0x03)
	LCPCodeConfigReject     = LCPCode(0x04)
	LCPCodeTerminateRequest = LCPCode(0x05)
	LCPCodeTerminateAck     = LCPCode(0x06)
	LCPCodeCodeReject       = LCPCode(0x07)
	LCPCodeProtocolReject   = LCPCode(0x08)
	LCPCodeEchoRequest      = LCPCode(0x09)
	LCPCodeEchoReplyt       = LCPCode(0x0a)
	LCPCodeDiscardRequest   = LCPCode(0x0b)
	LCPCodeReserved         = LCPCode(0x0c)

	LCPCodeNames = map[LCPCode]string{
		LCPCodeConfigRequest:    "LCPCodeConfigRequest",
		LCPCodeConfigAck:        "LCPCodeConfigAck",
		LCPCodeConfigNak:        "LCPCodeConfigNak",
		LCPCodeConfigReject:     "LCPCodeConfigReject",
		LCPCodeTerminateRequest: "LCPCodeTerminateRequest",
		LCPCodeTerminateAck:     "LCPCodeTerminateAck",
		LCPCodeCodeReject:       "LCPCodeCodeReject",
		LCPCodeProtocolReject:   "LCPCodeProtocolReject",
		LCPCodeEchoRequest:      "LCPCodeEchoRequest",
		LCPCodeEchoReplyt:       "LCPCodeEchoReplyt",
		LCPCodeDiscardRequest:   "LCPCodeDiscardRequest",
		LCPCodeReserved:         "LCPCodeReserved",
	}
)
View Source
var (
	PAPCodeRequest = PAPCode(0x01)
	PAPCodeAck     = PAPCode(0x02)
	PAPCodeNak     = PAPCode(0x03)
	PAPCodeNames   = map[PAPCode]string{
		PAPCodeRequest: "PAPAuthenticateRequest",
		PAPCodeAck:     "PAPAuthenticateAck",
		PAPCodeNak:     "PAPAuthenticateNak",
	}
)
View Source
var (
	MaxReceiveUnitType                = LCPTLVType(0x01)
	AsyncControlCharacterType         = LCPTLVType(0x02)
	AuthenticationProtocolType        = LCPTLVType(0x03)
	QualityProtocolType               = LCPTLVType(0x04)
	MagicNumberType                   = LCPTLVType(0x05)
	RESERVEDType                      = LCPTLVType(0x06)
	ProtocolFieldCompressionType      = LCPTLVType(0x07)
	AddressAndControlFieldCompression = LCPTLVType(0x08)

	LCPTLVTypeNames = map[LCPTLVType]string{
		MaxReceiveUnitType:                "MaxReceiveUnitType",
		AsyncControlCharacterType:         "AsyncControlCharacterType",
		AuthenticationProtocolType:        "AuthenticationProtocolType",
		QualityProtocolType:               "QualityProtocolType",
		MagicNumberType:                   "MagicNumberType",
		RESERVEDType:                      "RESERVEDType",
		ProtocolFieldCompressionType:      "ProtocolFieldCompressionType",
		AddressAndControlFieldCompression: "AddressAndControlFieldCompression",
	}
)
View Source
var (
	PPPTypeLCP  = layers.PPPType(0xc021)
	PPPTypePAP  = layers.PPPType(0xc023)
	PPPTypeCHAP = layers.PPPType(0xc223)

	PPPTypeNames = map[layers.PPPType]string{
		PPPTypePAP:  "PAP",
		PPPTypeCHAP: "CHAP",
	}
)
View Source
var (
	ServiceNameType = PPPoETLVType(0x0101)
	ACNameType      = PPPoETLVType(0x0102)
	HostUniqType    = PPPoETLVType(0x0103)
	ACCookieType    = PPPoETLVType(0x0104)

	PPPoETLVNames = map[PPPoETLVType]string{
		ServiceNameType: "Service-Name",
		ACNameType:      "AC-Name",
		HostUniqType:    "Host-Uniq",
		ACCookieType:    "AC-Cookie",
	}
)
View Source
var PPPoECodeNames = map[layers.PPPoECode]string{
	layers.PPPoECodePADI:    "PADI",
	layers.PPPoECodePADO:    "PADO",
	layers.PPPoECodePADR:    "PADR",
	layers.PPPoECodePADS:    "PADS",
	layers.PPPoECodePADT:    "PADT",
	layers.PPPoECodeSession: "Session",
}

Functions

func BruteForcwPassword

func BruteForcwPassword(device string, user string)

func CreateTLVBytes

func CreateTLVBytes(typeInt TLVType, valueBytes []byte) []byte

func PAPLoginSession

func PAPLoginSession(device string, mac net.HardwareAddr, user string, pwd string, result chan PAP)

func SendPADI

func SendPADI(pcapHandle *pcap.Handle, srcMAC net.HardwareAddr, hostUniq uint32)

func SendPADR

func SendPADR(pcapHandle *pcap.Handle, srcMAC net.HardwareAddr, dstMAC net.HardwareAddr, PADOPack PPPoE) error

Types

type LCP

type LCP struct {
	Code       LCPCode
	Identifier uint8
	TLVMap     map[LCPTLVType][]byte
	Data       []byte
}

func PareseLCP

func PareseLCP(payload []byte) (*LCP, error)

func (*LCP) Encode

func (lcp *LCP) Encode() ([]byte, error)

func (*LCP) Send

func (lcp *LCP) Send(pcapHandle *pcap.Handle, srcMAC net.HardwareAddr, dstMAC net.HardwareAddr, sessionid uint16) error

func (*LCP) String

func (lcp *LCP) String() string

type LCPCode

type LCPCode uint8

type LCPTLVType

type LCPTLVType uint8

type PAP

type PAP struct {
	Code       PAPCode
	Identifier uint8
	Username   string
	Password   string
	Message    string
	Data       []byte
}

func ParesePAP

func ParesePAP(payload []byte) (*PAP, error)

func (*PAP) Encode

func (pap *PAP) Encode() ([]byte, error)

func (*PAP) Send

func (pap *PAP) Send(pcapHandle *pcap.Handle, srcMAC net.HardwareAddr, dstMAC net.HardwareAddr, sessionid uint16) error

func (*PAP) String

func (pap *PAP) String() string

type PAPCode

type PAPCode uint8

type PAPLoginSessionArg

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

type PPPoE

type PPPoE struct {
	Packet layers.PPPoE
	TLVMap map[PPPoETLVType][]byte
}

func DecodePPPoePacket

func DecodePPPoePacket(packet gopacket.Packet) (*PPPoE, error)

func (*PPPoE) ParseTLV

func (p *PPPoE) ParseTLV() error

func (*PPPoE) String

func (p *PPPoE) String() string

type PPPoETLVType

type PPPoETLVType TLVType

type TLVType

type TLVType uint16

Jump to

Keyboard shortcuts

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