package pacimport ()const (// NTLMSupCredLMOWF indicates that the LM OWF member is present and valid.NTLMSupCredLMOWFuint32 = 31// NTLMSupCredNTOWF indicates that the NT OWF member is present and valid.NTLMSupCredNTOWFuint32 = 30)// NTLMSupplementalCred implements https://msdn.microsoft.com/en-us/library/cc237949.aspxtypeNTLMSupplementalCredstruct { Version uint32// A 32-bit unsigned integer that defines the credential version.This field MUST be 0x00000000. Flags uint32 LMPassword []byte// A 16-element array of unsigned 8-bit integers that define the LM OWF. The LMPassword member MUST be ignored if the L flag is not set in the Flags member. NTPassword []byte// A 16-element array of unsigned 8-bit integers that define the NT OWF. The NTPassword member MUST be ignored if the N flag is not set in the Flags member.}// Unmarshal converts the bytes provided into a NTLMSupplementalCred.func ( *NTLMSupplementalCred) ( []byte) ( error) { := mstypes.NewReader(bytes.NewReader()) .Version, = .Uint32()if != nil {return }if .Version != 0 { = errors.New("NTLMSupplementalCred version is not zero")return } .Flags, = .Uint32()if != nil {return }ifisFlagSet(.Flags, NTLMSupCredLMOWF) { .LMPassword, = .ReadBytes(16)if != nil {return } }ifisFlagSet(.Flags, NTLMSupCredNTOWF) { .NTPassword, = .ReadBytes(16)if != nil {return } }return}// isFlagSet tests if a flag is set in the uint32 little endian flagfunc isFlagSet( uint32, uint32) bool {//Which byte? := int( / 8)//Which bit in byte := uint(7 - (int() - 8*)) := make([]byte, 4)binary.LittleEndian.PutUint32(, )if []&(1<<) != 0 {returntrue }returnfalse}// SECPKGSupplementalCred implements https://msdn.microsoft.com/en-us/library/cc237956.aspxtypeSECPKGSupplementalCredstruct { PackageName mstypes.RPCUnicodeString CredentialSize uint32 Credentials []uint8`ndr:"pointer,conformant"`// Is a ptr. Size is the value of CredentialSize}// Unmarshal converts the bytes provided into a SECPKGSupplementalCred.func ( *SECPKGSupplementalCred) ( []byte) ( error) { := ndr.NewDecoder(bytes.NewReader()) = .Decode()if != nil { = fmt.Errorf("error unmarshaling SECPKGSupplementalCred: %v", ) }return}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.