minor tweaks for ntlmv1

This commit is contained in:
Matthew Kanwisher 2013-04-15 17:55:10 -04:00
parent 413d3231d7
commit c71d542d90
4 changed files with 13 additions and 4 deletions

View File

@ -71,6 +71,8 @@ func CreateServerSession(version Version, mode Mode) (n ServerSession, err error
type ServerSession interface { type ServerSession interface {
SetUserInfo(username string, password string, domain string) SetUserInfo(username string, password string, domain string)
GetUserInfo() (string, string, string)
SetMode(mode Mode) SetMode(mode Mode)
SetServerChallenge(challege []byte) SetServerChallenge(challege []byte)

View File

@ -3,10 +3,9 @@ package ntlm
import ( import (
"bytes" "bytes"
// l4g "code.google.com/p/log4go" l4g "code.google.com/p/log4go"
rc4P "crypto/rc4" rc4P "crypto/rc4"
"errors" "errors"
"fmt"
"ntlm/messages" "ntlm/messages"
"strings" "strings"
) )
@ -25,6 +24,10 @@ func (n *V1Session) SetUserInfo(username string, password string, domain string)
n.userDomain = domain n.userDomain = domain
} }
func (n *V1Session) GetUserInfo() (string, string, string) {
return n.user, n.password, n.userDomain
}
func (n *V1Session) SetMode(mode Mode) { func (n *V1Session) SetMode(mode Mode) {
n.mode = mode n.mode = mode
} }
@ -166,7 +169,7 @@ func (n *V1ServerSession) ProcessAuthenticateMessage(am *messages.Authenticate)
// They should always be correct (I hope) // They should always be correct (I hope)
n.user = am.UserName.String() n.user = am.UserName.String()
n.userDomain = am.DomainName.String() n.userDomain = am.DomainName.String()
fmt.Printf("(ProcessAuthenticateMessage)NTLM v1 User %s Domain %s \n", n.user, n.userDomain) l4g.Info("(ProcessAuthenticateMessage)NTLM v1 User %s Domain %s", n.user, n.userDomain)
err = n.fetchResponseKeys() err = n.fetchResponseKeys()
if err != nil { if err != nil {

View File

@ -26,6 +26,10 @@ func (n *V2Session) SetUserInfo(username string, password string, domain string)
n.userDomain = domain n.userDomain = domain
} }
func (n *V2Session) GetUserInfo() (string, string, string) {
return n.user, n.password, n.userDomain
}
func (n *V2Session) SetMode(mode Mode) { func (n *V2Session) SetMode(mode Mode) {
n.mode = mode n.mode = mode
} }

View File

@ -47,7 +47,7 @@ func main() {
// Message parsed correctly as NTLMv1 so assume the session is v1 and reset the server session // Message parsed correctly as NTLMv1 so assume the session is v1 and reset the server session
newContext, err := ntlm.CreateServerSession(ntlm.Version1, ntlm.ConnectionlessMode) newContext, err := ntlm.CreateServerSession(ntlm.Version1, ntlm.ConnectionlessMode)
newContext.SetUserInfo("050045.rmwatest@reuters.com", "Welcome1", "") newContext.SetUserInfo(server.GetUserInfo())
if err != nil { if err != nil {
fmt.Println("Could not create NTLMv1 session") fmt.Println("Could not create NTLMv1 session")
return return