ntlm

package
v0.0.0-...-014ce7a Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NtLmNegotiate    = 0x00000001
	NtLmChallenge    = 0x00000002
	NtLmAuthenticate = 0x00000003
)
View Source
const (
	NTLMSSP_NEGOTIATE_UNICODE = 1 << iota
	NTLM_NEGOTIATE_OEM
	NTLMSSP_REQUEST_TARGET

	NTLMSSP_NEGOTIATE_SIGN
	NTLMSSP_NEGOTIATE_SEAL
	NTLMSSP_NEGOTIATE_DATAGRAM
	NTLMSSP_NEGOTIATE_LM_KEY

	NTLMSSP_NEGOTIATE_NTLM

	NTLMSSP_ANONYMOUS
	NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED
	NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED

	NTLMSSP_NEGOTIATE_ALWAYS_SIGN
	NTLMSSP_TARGET_TYPE_DOMAIN
	NTLMSSP_TARGET_TYPE_SERVER

	NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
	NTLMSSP_NEGOTIATE_IDENTIFY

	NTLMSSP_REQUEST_NON_NT_SESSION_KEY
	NTLMSSP_NEGOTIATE_TARGET_INFO

	NTLMSSP_NEGOTIATE_VERSION

	NTLMSSP_NEGOTIATE_128
	NTLMSSP_NEGOTIATE_KEY_EXCH
	NTLMSSP_NEGOTIATE_56
)
View Source
const (
	WINDOWS_MAJOR_VERSION_5  = 0x05
	WINDOWS_MAJOR_VERSION_6  = 0x06
	WINDOWS_MAJOR_VERSION_10 = 0x0a
)
View Source
const (
	WINDOWS_MINOR_VERSION_0 = 0x00
	WINDOWS_MINOR_VERSION_1 = 0x01
	WINDOWS_MINOR_VERSION_2 = 0x02
	WINDOWS_MINOR_VERSION_3 = 0x03
)
View Source
const (
	NTLMSSP_REVISION_W2K3 = 0x0f
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AvPair

type AvPair struct {
	AvID  AvPairType // AV_PAIR type identifier
	Value []byte     // Data
}

AvPair represents an attribute-value pair in the Target Information block.

type AvPairType

type AvPairType uint16
const (
	MsvAvEOL             AvPairType = iota
	MsvAvNbComputerName  AvPairType = 1
	MsvAvNbDomainName    AvPairType = 2
	MsvAvDnsComputerName AvPairType = 3
	MsvAvDnsDomainName   AvPairType = 4
	MsvAvDnsTreeName     AvPairType = 5
	MsvAvFlags           AvPairType = 6
	MsvAvTimestamp       AvPairType = 7
	MsvAvSingleHost      AvPairType = 8
	MsvAvTargetName      AvPairType = 9
	MsvAvChannelBindings AvPairType = 10
)

type Client

type Client struct {
	User        string
	Password    string
	Hash        []byte
	Domain      string // e.g "WORKGROUP", "MicrosoftAccount"
	Workstation string // e.g "localhost", "HOME-PC"

	TargetSPN string // SPN ::= "service/hostname[:port]"; e.g "cifs/remotehost:1020"
	// contains filtered or unexported fields
}

NTLM v2 client

func (*Client) Authenticate

func (c *Client) Authenticate(cmsg []byte) (amsg []byte, err error)

func (*Client) Negotiate

func (c *Client) Negotiate() (nmsg []byte, err error)

func (*Client) Session

func (c *Client) Session() *Session

type InfoMap

type InfoMap struct {
	NbComputerName  string
	NbDomainName    string
	DnsComputerName string
	DnsDomainName   string
	DnsTreeName     string
}

type Server

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

NTLM v2 server

func NewServer

func NewServer(targetName, nbName, nbDomain, dnsName, dnsDomain string) *Server

func (*Server) AddAccount

func (s *Server) AddAccount(user, password string)

func (*Server) AllowGuest

func (s *Server) AllowGuest()

func (*Server) Authenticate

func (s *Server) Authenticate(amsg []byte) (err error)

func (*Server) Challenge

func (s *Server) Challenge(nmsg []byte) (cmsg []byte, err error)

func (*Server) Session

func (s *Server) Session() *Session

type Session

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

func (*Session) CheckSum

func (s *Session) CheckSum(sum, plaintext []byte, seqNum uint32) (bool, uint32)

func (*Session) InfoMap

func (s *Session) InfoMap() *InfoMap

TODO export to somewhere

func (*Session) Overhead

func (s *Session) Overhead() int

func (*Session) Seal

func (s *Session) Seal(dst, plaintext []byte, seqNum uint32) ([]byte, uint32)

func (*Session) SessionKey

func (s *Session) SessionKey() []byte

func (*Session) Sum

func (s *Session) Sum(plaintext []byte, seqNum uint32) ([]byte, uint32)

func (*Session) Unseal

func (s *Session) Unseal(dst, ciphertext []byte, seqNum uint32) ([]byte, uint32, error)

func (*Session) User

func (s *Session) User() string

type TargetInfo

type TargetInfo []AvPair

TargetInfo represents the Target Information block.

func (*TargetInfo) Encode

func (t *TargetInfo) Encode(dst []byte)

func (*TargetInfo) Size

func (t *TargetInfo) Size() int

Jump to

Keyboard shortcuts

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