Closed XiaoliChan closed 9 months ago
Thanks for the idea, I'll try to implement something similar.
I think these errors should be processed
In this screenshot, 0xC0000224
== user is required to change password at next logon
Reference:
I have added the missing status code of "password must change" and implemented a new function on the connection struct called GetTargetInfo() which returns a TargetInfo struct in commit 2c9fbb015d9815bf941f83fc2d91024b7e66d44e (Tag v.0.3.2)
Instead of deciding how and what to print in this library, I'll leave that up to the various clients to print whatever they deem relevant. GetTargetInfo() will return nil if called before a connection has been established and the SessionSetup handshake has been initiated.
Something similar to your example would be:
if session != nil {
targetInfo := session.GetTargetInfo()
if targetInfo != nil {
fmt.Println("[*] Server info")
fmt.Printf(" [->] Signing: %v\n", session.IsSigningRequired.Load())
fmt.Printf(" [->] OS Version: %s\n", targetInfo.GuessedOSVersion)
fmt.Printf(" [->] Hostname: %s\n", targetInfo.DnsComputerName)
fmt.Printf(" [->] Domain: %s\n", targetInfo.DnsDomainName)
fmt.Println()
}
}
For the NTLM info and the error exclude "Login failed", it did a nice job with release 3.2.0
It's a good idea to get NTLM info when doing enumeration![image](https://github.com/jfjallid/go-smb/assets/30458572/a4162c60-1831-4c81-9819-776fffabf2ba)
I think it can do this like impacket, for example
Reference: