protocol_impl

package
v1.3.4-alpha8 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BERUniversalData       = 0
	BERApplicationData     = 1
	BERContextSpecificData = 2
	BERPrivateData         = 3

	BERInteger = 0x02
	BERString  = 0x1b
)

Variables

View Source
var NoLMResponseNTLMv1 bool

Functions

func GenSubProtocol

func GenSubProtocol(data any, key string) ([]byte, error)

func LMOWFv1

func LMOWFv1(Passwd, User, UserDom string) []byte

func LMOWFv2

func LMOWFv2(Passwd, User, UserDom string) []byte

func NTOWFv1

func NTOWFv1(Passwd, User, UserDom string) []byte

func NTOWFv2

func NTOWFv2(Passwd, User, UserDom string) []byte

func NetNTLMv1

func NetNTLMv1(nt []byte, lm []byte, serverChallenge []byte, clientChallenge []byte, Time []byte, ServerName []byte) ([]byte, []byte, []byte)

func NetNTLMv2

func NetNTLMv2(nt []byte, lm []byte, serverChallenge []byte, clientChallenge []byte, time []byte, ServerName []byte) ([]byte, []byte, []byte)

func ParseSubProtocol

func ParseSubProtocol(reader io.Reader, v any, key string) error

func UnicodeEncode

func UnicodeEncode(p string) []byte

Types

type AVPAIR

type AVPAIR struct {
	AvId  uint16
	AvLen uint16
	Value []byte
}

func ParseAVPAIRs

func ParseAVPAIRs(data []byte) (res []*AVPAIR)

type AuthenticationMessage

type AuthenticationMessage struct {
	Signature                       [8]byte
	MessageType                     uint32
	LmChallengeResponseFields       Field
	NtChallengeResponseFields       Field
	DomainNameFields                Field
	UserNameFields                  Field
	WorkstationFields               Field
	EncryptedRandomSessionKeyFields Field
	NegotiateFlags                  [4]byte
	Version                         Version
	MIC                             [16]byte
	// contains filtered or unexported fields
}

func NewAuthenticationMessage

func NewAuthenticationMessage() *AuthenticationMessage

func ParseAuthenticationMessage

func ParseAuthenticationMessage(data []byte) (*AuthenticationMessage, error)

func (*AuthenticationMessage) Marshal

func (n *AuthenticationMessage) Marshal() ([]byte, error)

func (*AuthenticationMessage) NewField

func (n *AuthenticationMessage) NewField(d []byte) Field

func (*AuthenticationMessage) SetPayload

func (n *AuthenticationMessage) SetPayload(payload []byte)

type BERElement

type BERElement struct {
	Type  *BERElementType
	Value any
}

func LoadFromMap

func LoadFromMap(d map[string]any) *BERElement

func NewBER

func NewBER(data any) (*BERElement, error)

func ParseBER

func ParseBER(r io.Reader) (*BERElement, error)

func (*BERElement) Marshal

func (b *BERElement) Marshal() ([]byte, error)

func (*BERElement) ToMap

func (b *BERElement) ToMap() map[string]any

type BERElementType

type BERElementType struct {
	Class       byte // 占前两位
	Constructed bool // 第三位
	TagNumber   byte // 后五位
}

type ChallengeMessage

type ChallengeMessage struct {
	Signature        [8]byte
	MessageType      uint32
	TargetNameFields Field
	NegotiateFlags   uint32
	ServerChallenge  [8]byte
	Reserved         [8]byte
	TargetInfoFields Field
	Version          Version
	// contains filtered or unexported fields
}

func NewChallengeMessage

func NewChallengeMessage() *ChallengeMessage

func ParseChallengeMessage

func ParseChallengeMessage(data []byte) (*ChallengeMessage, error)

func (*ChallengeMessage) Marshal

func (n *ChallengeMessage) Marshal() ([]byte, error)

func (*ChallengeMessage) NewField

func (n *ChallengeMessage) NewField(d []byte) Field

func (*ChallengeMessage) SetPayload

func (n *ChallengeMessage) SetPayload(payload []byte)

type Field

type Field struct {
	Length       uint16
	MaxLength    uint16
	BufferOffset uint32
	// contains filtered or unexported fields
}

func (Field) Value

func (f Field) Value() []byte

type NegotiateMessage

type NegotiateMessage struct {
	Signature         [8]byte
	MessageType       uint32
	NegotiateFlags    uint32
	DomainNameFields  Field
	WorkstationFields Field
	Version           Version
	// contains filtered or unexported fields
}

func NewNegotiateMessage

func NewNegotiateMessage() *NegotiateMessage

func ParseNegotiateMessage

func ParseNegotiateMessage(data []byte) (*NegotiateMessage, error)

func (*NegotiateMessage) Marshal

func (n *NegotiateMessage) Marshal() ([]byte, error)

func (*NegotiateMessage) NewField

func (n *NegotiateMessage) NewField(d []byte) Field

type TpktPacket

type TpktPacket struct {
	Version  uint8
	Reserved uint8
	TPDU     []byte
}

func NewTpktPacket

func NewTpktPacket(data []byte) *TpktPacket

func ParseTpkt

func ParseTpkt(r io.Reader) (*TpktPacket, error)

func (*TpktPacket) Marshal

func (t *TpktPacket) Marshal() ([]byte, error)

func (*TpktPacket) WriteTo

func (t *TpktPacket) WriteTo(writer io.Writer) (int, error)

type Version

type Version struct {
	ProductMajorVersion uint8
	ProductMinorVersion uint8
	ProductBuild        uint16
	Reserved            [3]byte
	NTLMRevisionCurrent uint8
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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