rename Authenticate/Challenge/Negotiate to *Message
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Authenticate struct {
|
||||
type AuthenticateMessage struct {
|
||||
// sig - 8 bytes
|
||||
Signature []byte
|
||||
// message type - 4 bytes
|
||||
@@ -53,8 +53,8 @@ type Authenticate struct {
|
||||
Payload []byte
|
||||
}
|
||||
|
||||
func ParseAuthenticateMessage(body []byte, ntlmVersion int) (*Authenticate, error) {
|
||||
am := new(Authenticate)
|
||||
func ParseAuthenticateMessage(body []byte, ntlmVersion int) (*AuthenticateMessage, error) {
|
||||
am := new(AuthenticateMessage)
|
||||
|
||||
am.Signature = body[0:8]
|
||||
if !bytes.Equal(am.Signature, []byte("NTLMSSP\x00")) {
|
||||
@@ -155,7 +155,7 @@ func ParseAuthenticateMessage(body []byte, ntlmVersion int) (*Authenticate, erro
|
||||
return am, nil
|
||||
}
|
||||
|
||||
func (a *Authenticate) ClientChallenge() (response []byte) {
|
||||
func (a *AuthenticateMessage) ClientChallenge() (response []byte) {
|
||||
if a.NtlmV2Response != nil {
|
||||
response = a.NtlmV2Response.NtlmV2ClientChallenge.ChallengeFromClient
|
||||
} else if a.NtlmV1Response != nil && NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY.IsSet(a.NegotiateFlags) {
|
||||
@@ -165,7 +165,7 @@ func (a *Authenticate) ClientChallenge() (response []byte) {
|
||||
return response
|
||||
}
|
||||
|
||||
func (a *Authenticate) getLowestPayloadOffset() int {
|
||||
func (a *AuthenticateMessage) getLowestPayloadOffset() int {
|
||||
payloadStructs := [...]*PayloadStruct{a.LmChallengeResponse, a.NtChallengeResponseFields, a.DomainName, a.UserName, a.Workstation, a.EncryptedRandomSessionKey}
|
||||
|
||||
// Find the lowest offset value
|
||||
@@ -180,7 +180,7 @@ func (a *Authenticate) getLowestPayloadOffset() int {
|
||||
return lowest
|
||||
}
|
||||
|
||||
func (a *Authenticate) Bytes() []byte {
|
||||
func (a *AuthenticateMessage) Bytes() []byte {
|
||||
payloadLen := int(a.LmChallengeResponse.Len + a.NtChallengeResponseFields.Len + a.DomainName.Len + a.UserName.Len + a.Workstation.Len + a.EncryptedRandomSessionKey.Len)
|
||||
messageLen := 8 + 4 + 6*8 + 4 + 8 + 16
|
||||
payloadOffset := uint32(messageLen)
|
||||
@@ -241,7 +241,7 @@ func (a *Authenticate) Bytes() []byte {
|
||||
return buffer.Bytes()
|
||||
}
|
||||
|
||||
func (a *Authenticate) String() string {
|
||||
func (a *AuthenticateMessage) String() string {
|
||||
var buffer bytes.Buffer
|
||||
|
||||
buffer.WriteString("Authenticate NTLM Message\n")
|
||||
|
||||
Reference in New Issue
Block a user