Documentation ¶
Index ¶
- Constants
- Variables
- func HMACMD5(key, data []byte) []byte
- func NTLMHash(password string, flag NegotiateFlag) []byte
- func NTLMV2Hash(username, password, domain string, flag NegotiateFlag) []byte
- func NTProof(ntlmV2Hash []byte, serverChallenge []byte, blob []byte) []byte
- func NtlmV2Response(ntProofStr []byte, blob []byte) []byte
- func Serialize(sz Serializable) []byte
- func SerializeBytesToBase64(b []byte) string
- type AuthenticateMessage
- type Authenticator
- type AvPair
- type AvPairs
- type Blob
- type ChallengeMessage
- type Client
- type NegotiateFlag
- type NegotiateMessage
- type Negotiator
- type Sealer
- type SecurityBuffer
- type Serializable
- type Session
- func (s *Session) Authenticate(cm string) (string, error)
- func (s *Session) GetState() State
- func (s *Session) GetTargetInfo(cm ChallengeMessage) []byte
- func (s *Session) GetWorkStationName() string
- func (s *Session) Negotiate() (string, error)
- func (s *Session) ProcessChallengeMessage(ps []byte) (AuthenticateMessage, error)
- func (s *Session) Seal([]byte) ([]byte, error)
- func (s *Session) Sign([]byte) ([]byte, error)
- type SignedSealedNegotiatingAuthenticator
- type Signer
- type State
- type Uint16LE
- type Uint32LE
- type Uint64LE
Constants ¶
View Source
const ( ClientToServerSigning = "session key to client-to-server signing key magic constant\000" ServerToClientSigning = "session key to server-to-client signing key magic constant\000" ClientToServerSealing = "session key to client-to-server sealing key magic constant\000" ServerToClientSealing = "session key to server-to-client sealing key magic constant\000" )
View Source
const NTLMSig = "NTLMSSP\000"
View Source
const TimeOffset = Uint64LE(116444736000000000)
Variables ¶
View Source
var DefaultFlags = map[uint32]NegotiateFlag{ 0x01: NegotiateUnicode | NegotiateOEM | NegotiateRequestTarget | NegotiateNTLM | NegotiateAlwaysSign | NegotiateNTLMV2Key, 0x02: NegotiateUnicode, 0x03: NegotiateUnicode | NegotiateRequestTarget | NegotiateNTLM | NegotiateAlwaysSign | NegotiateNTLMV2Key, }
View Source
var ErrHeadersNotFound = fmt.Errorf("NTLM Headers not found")
View Source
var ErrMalformedHeader = fmt.Errorf("Malformed NTLM Headers")
View Source
var MalformedBytesError = fmt.Errorf("Malformed bytes")
Functions ¶
func NTLMHash ¶
func NTLMHash(password string, flag NegotiateFlag) []byte
func NTLMV2Hash ¶
func NTLMV2Hash(username, password, domain string, flag NegotiateFlag) []byte
func NtlmV2Response ¶
func Serialize ¶
func Serialize(sz Serializable) []byte
func SerializeBytesToBase64 ¶
Types ¶
type AuthenticateMessage ¶
type AuthenticateMessage struct { Signature string Type Uint32LE LMResponse SecurityBuffer NTLMResponse SecurityBuffer Domain SecurityBuffer User SecurityBuffer WorkStation SecurityBuffer SessionKey SecurityBuffer Flag NegotiateFlag }
func NewAuthenticateMessage ¶
func NewAuthenticateMessage() AuthenticateMessage
func (AuthenticateMessage) WriteBytesToBuffer ¶
func (am AuthenticateMessage) WriteBytesToBuffer(buf *bytes.Buffer)
type Authenticator ¶
type AvPair ¶
func (AvPair) WriteBytesToBuffer ¶
type Blob ¶
type Blob struct { Signature Uint32LE Reserved Uint32LE Timestamp Uint64LE Challenge []byte Unknown Uint32LE TargetInfo []byte Unknown2 Uint32LE }
func NewBlobWithChallenge ¶
func (Blob) WriteBytesToBuffer ¶
type ChallengeMessage ¶
type ChallengeMessage struct { Signature string Type Uint32LE TargetName SecurityBuffer Flag NegotiateFlag ServerChallenge []byte Reserved Uint64LE TargetInfo SecurityBuffer // contains filtered or unexported fields }
func ParseChallengeMessage ¶
func ParseChallengeMessage(p []byte) (ChallengeMessage, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Authenticate ¶
func (*Client) SendMessage ¶
type NegotiateFlag ¶
type NegotiateFlag Uint32LE
const ( NegotiateUnicode NegotiateFlag = 0x00000001 NegotiateOEM NegotiateFlag = 0x00000002 NegotiateRequestTarget NegotiateFlag = 0x00000004 NegotiateMBZ9 NegotiateFlag = 0x00000008 NegotiateSign NegotiateFlag = 0x00000010 NegotiateSeal NegotiateFlag = 0x00000020 NegotiateDatagram NegotiateFlag = 0x00000040 NegotiateNetware NegotiateFlag = 0x00000100 NegotiateNTLM NegotiateFlag = 0x00000200 NegotiateNTOnly NegotiateFlag = 0x00000400 NegotiateMBZ7 NegotiateFlag = 0x00000800 NegotiateDomainSupplied NegotiateFlag = 0x00001000 NegotiateWorkstationSupplied NegotiateFlag = 0x00002000 NegotiateLocalCall NegotiateFlag = 0x00004000 NegotiateAlwaysSign NegotiateFlag = 0x00008000 NegotiateTargetTypeDomain NegotiateFlag = 0x00010000 NegotiateNTLMV2Key NegotiateFlag = 0x00080000 NegotiateTargetInfo NegotiateFlag = 0x00800000 NegotiateKey128 NegotiateFlag = 0x20000000 NegotiateKeyExchange NegotiateFlag = 0x40000000 NegotiateKey56 NegotiateFlag = 0x80000000 )
func ParseNegotiateFlag ¶
func ParseNegotiateFlag(p []byte) (NegotiateFlag, error)
func (NegotiateFlag) String ¶
func (n NegotiateFlag) String() string
func (NegotiateFlag) WriteBytesToBuffer ¶
func (n NegotiateFlag) WriteBytesToBuffer(buf *bytes.Buffer)
type NegotiateMessage ¶
type NegotiateMessage struct { Signature string Type Uint32LE Flag NegotiateFlag Domain SecurityBuffer WorkStation SecurityBuffer OSVersion Uint32LE // contains filtered or unexported fields }
func NewNegotiateMessage ¶
func NewNegotiateMessage(domain string, workstation string) NegotiateMessage
func ParseNegotiateMessage ¶
func ParseNegotiateMessage(p []byte) (NegotiateMessage, error)
func (NegotiateMessage) WriteBytesToBuffer ¶
func (nm NegotiateMessage) WriteBytesToBuffer(buf *bytes.Buffer)
type Negotiator ¶
type SecurityBuffer ¶
func ParseSecurityBuffer ¶
func ParseSecurityBuffer(p []byte) (SecurityBuffer, error)
func (SecurityBuffer) WriteBytesToBuffer ¶
func (sb SecurityBuffer) WriteBytesToBuffer(buf *bytes.Buffer, payload *bytes.Buffer)
type Serializable ¶
type Session ¶
type Session struct { State State // contains filtered or unexported fields }
func NewSession ¶
func (*Session) GetTargetInfo ¶
func (s *Session) GetTargetInfo(cm ChallengeMessage) []byte
func (*Session) GetWorkStationName ¶
func (*Session) ProcessChallengeMessage ¶
func (s *Session) ProcessChallengeMessage(ps []byte) (AuthenticateMessage, error)
type SignedSealedNegotiatingAuthenticator ¶
type SignedSealedNegotiatingAuthenticator interface { GetState() State Negotiator Authenticator Signer Sealer }
type Uint16LE ¶
type Uint16LE uint16
const ( MsvAvEol Uint16LE = 0x00 MsvAvNbComputerName Uint16LE = 0x01 MsvAvNbDomainName Uint16LE = 0x02 MsvAvDNSComputerName Uint16LE = 0x03 MsvAvDNSDomainName Uint16LE = 0x04 MsvAvDNSTreeName Uint16LE = 0x05 MsvAvFlags Uint16LE = 0x06 MsvAvTimestamp Uint16LE = 0x07 MsvAvSingleHost Uint16LE = 0x08 MsvAvTargetName Uint16LE = 0x09 MsvAvChannelBindings Uint16LE = 0x0A )
func ParseUint16LE ¶
func (Uint16LE) WriteBytesToBuffer ¶
Click to show internal directories.
Click to hide internal directories.