minor tweaks for ntlmv1
This commit is contained in:
		
							parent
							
								
									413d3231d7
								
							
						
					
					
						commit
						c71d542d90
					
				| @ -71,6 +71,8 @@ func CreateServerSession(version Version, mode Mode) (n ServerSession, err error | ||||
| 
 | ||||
| type ServerSession interface { | ||||
| 	SetUserInfo(username string, password string, domain string) | ||||
| 	GetUserInfo() (string, string, string) | ||||
| 
 | ||||
| 	SetMode(mode Mode) | ||||
| 	SetServerChallenge(challege []byte) | ||||
| 
 | ||||
|  | ||||
| @ -3,10 +3,9 @@ package ntlm | ||||
| 
 | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	//	l4g "code.google.com/p/log4go" | ||||
| 	l4g "code.google.com/p/log4go" | ||||
| 	rc4P "crypto/rc4" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"ntlm/messages" | ||||
| 	"strings" | ||||
| ) | ||||
| @ -25,6 +24,10 @@ func (n *V1Session) SetUserInfo(username string, password string, domain string) | ||||
| 	n.userDomain = domain | ||||
| } | ||||
| 
 | ||||
| func (n *V1Session) GetUserInfo() (string, string, string) { | ||||
| 	return n.user, n.password, n.userDomain | ||||
| } | ||||
| 
 | ||||
| func (n *V1Session) SetMode(mode Mode) { | ||||
| 	n.mode = mode | ||||
| } | ||||
| @ -166,7 +169,7 @@ func (n *V1ServerSession) ProcessAuthenticateMessage(am *messages.Authenticate) | ||||
| 	// They should always be correct (I hope) | ||||
| 	n.user = am.UserName.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() | ||||
| 	if err != nil { | ||||
|  | ||||
| @ -26,6 +26,10 @@ func (n *V2Session) SetUserInfo(username string, password string, domain string) | ||||
| 	n.userDomain = domain | ||||
| } | ||||
| 
 | ||||
| func (n *V2Session) GetUserInfo() (string, string, string) { | ||||
| 	return n.user, n.password, n.userDomain | ||||
| } | ||||
| 
 | ||||
| func (n *V2Session) SetMode(mode Mode) { | ||||
| 	n.mode = mode | ||||
| } | ||||
|  | ||||
| @ -47,7 +47,7 @@ func main() { | ||||
| 
 | ||||
| 		// 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.SetUserInfo("050045.rmwatest@reuters.com", "Welcome1", "") | ||||
| 		newContext.SetUserInfo(server.GetUserInfo()) | ||||
| 		if err != nil { | ||||
| 			fmt.Println("Could not create NTLMv1 session") | ||||
| 			return | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user