add debugging

This commit is contained in:
2025-03-17 08:42:11 +11:00
parent 5c0509ce5a
commit f1ae4c4171
7 changed files with 186 additions and 132 deletions

View File

@@ -3,6 +3,7 @@ package ntlmssp
import (
"bytes"
"crypto/rand"
"encoding/base64"
"encoding/binary"
"errors"
"time"
@@ -78,13 +79,17 @@ func (m authenicateMessage) MarshalBinary() ([]byte, error) {
return b.Bytes(), nil
}
//ProcessChallenge crafts an AUTHENTICATE message in response to the CHALLENGE message
//that was received from the server
// ProcessChallenge crafts an AUTHENTICATE message in response to the CHALLENGE message
// that was received from the server
func ProcessChallenge(challengeMessageData []byte, user, password string) ([]byte, error) {
if user == "" && password == "" {
return nil, errors.New("Anonymous authentication not supported")
}
// debugging
PrintDebug("Received NTLM Type 2 Challenge: %s", base64.StdEncoding.EncodeToString(challengeMessageData))
DecodeNTLMMessage(challengeMessageData)
var cm challengeMessage
if err := cm.UnmarshalBinary(challengeMessageData); err != nil {
return nil, err