added test for usimg the username and domain from the authenticate packet

This commit is contained in:
Conor Hunt 2013-03-11 16:31:42 -04:00
parent 452979e4c9
commit ff027624e9

View File

@ -2,6 +2,7 @@ package ntlm
import (
"bytes"
"encoding/base64"
"encoding/hex"
"ntlm/messages"
"strings"
@ -156,6 +157,24 @@ func TestNTLMv2(t *testing.T) {
// }
}
func TestNTLMv2WithDomain(t *testing.T) {
authenticateMessage := "TlRMTVNTUAADAAAAGAAYALYAAADSANIAzgAAADQANABIAAAAIAAgAHwAAAAaABoAnAAAABAAEACgAQAAVYKQQgUCzg4AAAAPYQByAHIAYQB5ADEAMgAuAG0AcwBnAHQAcwB0AC4AcgBlAHUAdABlAHIAcwAuAGMAbwBtAHUAcwBlAHIAcwB0AHIAZQBzAHMAMQAwADAAMAAwADgATgBZAEMAVgBBADEAMgBTADIAQwBNAFMAQQBPYrLjU4h0YlWZeEoNvTJtBQMnnJuAeUwsP+vGmAHNRBpgZ+4ChQLqAQEAAAAAAACPFEIFjx7OAQUDJ5ybgHlMAAAAAAIADgBSAEUAVQBUAEUAUgBTAAEAHABVAEsAQgBQAC0AQwBCAFQAUgBNAEYARQAwADYABAAWAFIAZQB1AHQAZQByAHMALgBuAGUAdAADADQAdQBrAGIAcAAtAGMAYgB0AHIAbQBmAGUAMAA2AC4AUgBlAHUAdABlAHIAcwAuAG4AZQB0AAUAFgBSAGUAdQB0AGUAcgBzAC4AbgBlAHQAAAAAAAAAAAANuvnqD3K88ZpjkLleL0NW"
server := new(V2ServerSession)
server.SetUserInfo("blahblah", "Welcome1", "blahblah")
authenticateData, _ := base64.StdEncoding.DecodeString(authenticateMessage)
a, _ := messages.ParseAuthenticateMessage(authenticateData, 2)
serverChallenge, _ := hex.DecodeString("3d74b2d04ebe1eb3")
server.SetServerChallenge(serverChallenge)
err := server.ProcessAuthenticateMessage(a)
if err != nil {
t.Error("Could not process authenticate message: %s\n", err)
}
}
func TestWindowsTimeConversion(t *testing.T) {
// From http://davenport.sourceforge.net/ntlm.html#theType3Message
// Next, the blob is constructed. The timestamp is the most tedious part of this; looking at the clock on my desk,