mstypes

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2018 License: Apache-2.0 Imports: 9 Imported by: 113

Documentation

Overview

Package mstypes implements representations of Microsoft types

Index

Constants

View Source
const (
	CompressionFormatNone       uint16 = 0
	CompressionFormatLZNT1      uint16 = 2
	CompressionFormatXPress     uint16 = 3
	CompressionFormatXPressHuff uint16 = 4
)

Compression format assigned numbers.

View Source
const (
	ClaimTypeIDInt64    uint16 = 1
	ClaimTypeIDUInt64   uint16 = 2
	ClaimTypeIDString   uint16 = 3
	ClaimsTypeIDBoolean uint16 = 6
)

Claim Type assigned numbers

View Source
const (
	SEGroupMandatory        = 31
	SEGroupEnabledByDefault = 30
	SEGroupEnabled          = 29
	SEGroupOwner            = 28
	SEGroupResource         = 2
)

Attributes of a security group membership and can be combined by using the bitwise OR operation. They are used by an access check mechanism to specify whether the membership is to be used in an access check decision.

View Source
const (
	SizeBool   = 1
	SizeChar   = 1
	SizeUint8  = 1
	SizeUint16 = 2
	SizeUint32 = 4
	SizeUint64 = 8
	SizeEnum   = 2
	SizeSingle = 4
	SizeDouble = 8
	SizePtr    = 4
)

Byte sizes of primitive types

View Source
const ClaimsSourceTypeAD uint16 = 1

ClaimsSourceTypeAD https://msdn.microsoft.com/en-us/library/hh553809.aspx

Variables

This section is empty.

Functions

func SetFlag

func SetFlag(a *uint32, i uint)

SetFlag sets a flag in a uint32 attribute value.

Types

type ClaimEntry

type ClaimEntry struct {
	ID         string           `ndr:"pointer,conformant,varying"`
	Type       uint16           `ndr:"unionTag"`
	TypeInt64  ClaimTypeInt64   `ndr:"unionField"`
	TypeUInt64 ClaimTypeUInt64  `ndr:"unionField"`
	TypeString ClaimTypeString  `ndr:"unionField"`
	TypeBool   ClaimTypeBoolean `ndr:"unionField"`
}

ClaimEntry is a NDR union that implements https://msdn.microsoft.com/en-us/library/hh536374.aspx

func (ClaimEntry) SwitchFunc

func (u ClaimEntry) SwitchFunc(_ interface{}) string

SwitchFunc is the ClaimEntry union field selection function

type ClaimTypeBoolean

type ClaimTypeBoolean struct {
	ValueCount uint32
	Value      []bool `ndr:"pointer,conformant"`
}

ClaimTypeBoolean is a claim of type bool

type ClaimTypeInt64

type ClaimTypeInt64 struct {
	ValueCount uint32
	Value      []int64 `ndr:"pointer,conformant"`
}

ClaimTypeInt64 is a claim of type int64

type ClaimTypeString

type ClaimTypeString struct {
	ValueCount uint32
	Value      []LPWSTR `ndr:"pointer,conformant"`
}

ClaimTypeString is a claim of type string

type ClaimTypeUInt64

type ClaimTypeUInt64 struct {
	ValueCount uint32
	Value      []uint64 `ndr:"pointer,conformant"`
}

ClaimTypeUInt64 is a claim of type uint64

type ClaimsArray

type ClaimsArray struct {
	ClaimsSourceType uint16
	ClaimsCount      uint32
	ClaimEntries     []ClaimEntry `ndr:"pointer,conformant"`
}

ClaimsArray implements https://msdn.microsoft.com/en-us/library/hh536458.aspx

type ClaimsBlob

type ClaimsBlob struct {
	Size        uint32
	EncodedBlob EncodedBlob
}

ClaimsBlob implements https://msdn.microsoft.com/en-us/library/hh554119.aspx

type ClaimsSet

type ClaimsSet struct {
	ClaimsArrayCount  uint32
	ClaimsArrays      []ClaimsArray `ndr:"pointer,conformant"`
	ReservedType      uint16
	ReservedFieldSize uint32
	ReservedField     []byte `ndr:"pointer,conformant"`
}

ClaimsSet implements https://msdn.microsoft.com/en-us/library/hh554122.aspx

type ClaimsSetMetadata

type ClaimsSetMetadata struct {
	ClaimsSetSize             uint32
	ClaimsSetBytes            []byte `ndr:"pointer,conformant"`
	CompressionFormat         uint16 // Enum see constants for options
	UncompressedClaimsSetSize uint32
	ReservedType              uint16
	ReservedFieldSize         uint32
	ReservedField             []byte `ndr:"pointer,conformant"`
}

ClaimsSetMetadata implements https://msdn.microsoft.com/en-us/library/hh554073.aspx

func (*ClaimsSetMetadata) ClaimsSet

func (m *ClaimsSetMetadata) ClaimsSet() (c ClaimsSet, err error)

ClaimsSet reads the ClaimsSet type from the NDR encoded ClaimsSetBytes in the ClaimsSetMetadata

type CypherBlock

type CypherBlock struct {
	Data [8]byte // size = 8
}

CypherBlock implements https://msdn.microsoft.com/en-us/library/cc237040.aspx

type DomainGroupMembership

type DomainGroupMembership struct {
	DomainID   RPCSID `ndr:"pointer"`
	GroupCount uint32
	GroupIDs   []GroupMembership `ndr:"pointer,conformant"` // Size is value of GroupCount
}

DomainGroupMembership implements https://msdn.microsoft.com/en-us/library/hh536344.aspx DomainId: A SID structure that contains the SID for the domain.This member is used in conjunction with the GroupIds members to create group SIDs for the device. GroupCount: A 32-bit unsigned integer that contains the number of groups within the domain to which the account belongs. GroupIds: A pointer to a list of GROUP_MEMBERSHIP structures that contain the groups to which the account belongs in the domain. The number of groups in this list MUST be equal to GroupCount.

type EncodedBlob

type EncodedBlob []byte

EncodedBlob are the bytes of the encoded Claims

func (EncodedBlob) Size

func (b EncodedBlob) Size(c interface{}) int

Size returns the size of the bytes of the encoded Claims

type FileTime

type FileTime struct {
	LowDateTime  uint32
	HighDateTime uint32
}

FileTime implements the Microsoft FILETIME type https://msdn.microsoft.com/en-us/library/cc230324.aspx

func GetFileTime

func GetFileTime(t time.Time) FileTime

GetFileTime returns a FileTime type from the provided Golang Time type.

func (FileTime) MSEpoch

func (ft FileTime) MSEpoch() int64

MSEpoch returns the FileTime as a Microsoft epoch, the number of 100 nano second periods elapsed from January 1, 1601 UTC.

func (FileTime) Time

func (ft FileTime) Time() time.Time

Time return a golang Time type from the FileTime

func (FileTime) Unix

func (ft FileTime) Unix() int64

Unix returns the FileTime as a Unix time, the number of seconds elapsed since January 1, 1970 UTC.

type GroupMembership

type GroupMembership struct {
	RelativeID uint32
	Attributes uint32
}

GroupMembership implements https://msdn.microsoft.com/en-us/library/cc237945.aspx RelativeID : A 32-bit unsigned integer that contains the RID of a particular group. The possible values for the Attributes flags are identical to those specified in KERB_SID_AND_ATTRIBUTES

type KerbSidAndAttributes

type KerbSidAndAttributes struct {
	SID        RPCSID `ndr:"pointer"` // A pointer to an RPC_SID structure.
	Attributes uint32
}

KerbSidAndAttributes implements https://msdn.microsoft.com/en-us/library/cc237947.aspx

type LPWSTR

type LPWSTR struct {
	Value string `ndr:"pointer,conformant,varying"`
}

LPWSTR implements https://msdn.microsoft.com/en-us/library/cc230355.aspx

func (*LPWSTR) String

func (s *LPWSTR) String() string

type RPCSID

type RPCSID struct {
	Revision            uint8    // An 8-bit unsigned integer that specifies the revision level of the SID. This value MUST be set to 0x01.
	SubAuthorityCount   uint8    // An 8-bit unsigned integer that specifies the number of elements in the SubAuthority array. The maximum number of elements allowed is 15.
	IdentifierAuthority [6]byte  // An RPC_SID_IDENTIFIER_AUTHORITY structure that indicates the authority under which the SID was created. It describes the entity that created the SID. The Identifier Authority value {0,0,0,0,0,5} denotes SIDs created by the NT SID authority.
	SubAuthority        []uint32 `ndr:"conformant"` // A variable length array of unsigned 32-bit integers that uniquely identifies a principal relative to the IdentifierAuthority. Its length is determined by SubAuthorityCount.
}

RPCSID implements https://msdn.microsoft.com/en-us/library/cc230364.aspx

func (*RPCSID) String

func (s *RPCSID) String() string

String returns the string representation of the RPC_SID.

type RPCUnicodeString

type RPCUnicodeString struct {
	Length        uint16 // The length, in bytes, of the string pointed to by the Buffer member, not including the terminating null character if any. The length MUST be a multiple of 2. The length SHOULD equal the entire size of the Buffer, in which case there is no terminating null character. Any method that accesses this structure MUST use the Length specified instead of relying on the presence or absence of a null character.
	MaximumLength uint16 // The maximum size, in bytes, of the string pointed to by Buffer. The size MUST be a multiple of 2. If not, the size MUST be decremented by 1 prior to use. This value MUST not be less than Length.
	Value         string `ndr:"pointer,conformant,varying"`
}

RPCUnicodeString implements https://msdn.microsoft.com/en-us/library/cc230365.aspx

func (*RPCUnicodeString) String

func (r *RPCUnicodeString) String() string

String returns the RPCUnicodeString string value

type Reader added in v1.1.0

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads simple byte stream data into a Go representations

func NewReader added in v1.1.0

func NewReader(r io.Reader) *Reader

NewReader creates a new instance of a simple Reader.

func (*Reader) FileTime added in v1.1.0

func (r *Reader) FileTime() (f FileTime, err error)

func (*Reader) Read added in v1.1.0

func (r *Reader) Read(p []byte) (n int, err error)

func (*Reader) ReadBytes added in v1.1.0

func (r *Reader) ReadBytes(n int) ([]byte, error)

readBytes returns a number of bytes from the NDR byte stream.

func (*Reader) UTF16String added in v1.1.0

func (r *Reader) UTF16String(n int) (str string, err error)

UTF16String returns a string that is UTF16 encoded in a byte slice. n is the number of bytes representing the string

func (*Reader) Uint16 added in v1.1.0

func (r *Reader) Uint16() (uint16, error)

func (*Reader) Uint32 added in v1.1.0

func (r *Reader) Uint32() (uint32, error)

func (*Reader) Uint64 added in v1.1.0

func (r *Reader) Uint64() (uint64, error)

func (*Reader) Uint8 added in v1.1.0

func (r *Reader) Uint8() (uint8, error)

type UserSessionKey

type UserSessionKey struct {
	CypherBlock [2]CypherBlock // size = 2
}

UserSessionKey implements https://msdn.microsoft.com/en-us/library/cc237080.aspx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL