dcerpc

package
v0.0.0-...-09996d0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorSuccess         uint32 = 0x00000000
	ErrorAccessDenied    uint32 = 0x00000005
	ErrorContextMismatch uint32 = 0x1c00001a
)
View Source
const (
	PacketTypeRequest  uint8 = 0
	PacketTypeResponse uint8 = 2
	PacketTypeFault    uint8 = 3
	PacketTypeBind     uint8 = 11
	PacketTypeBindAck  uint8 = 12
)

MSRPC Packet Types

View Source
const (
	PfcFirstFrag     uint8 = 0x1
	PfcLastFrag      uint8 = 0x2
	PfcPendingCancel uint8 = 0x4 // Cancel was pending at sender
	PfcReserved      uint8 = 0x8
	PfcConcMpx       uint8 = 0x10 // Support concurrent multiplexing of a single connection
	PfcDidNotExecute uint8 = 0x20
	PfcMaybe         uint8 = 0x40
	PfcObjectUUID    uint8 = 0x80
)

C706 Section 12.6.3.1 PFC Flags

View Source
const PDUHeaderCommonSize int = 16

MSRPC Packet header common fields

Variables

View Source
var (
	MSRPCUuidNdr = "8a885d04-1ceb-11c9-9fe8-08002b104860" // NDR Transfer Syntax version 2.0

)

Functions

func EncryptSecretDes

func EncryptSecretDes(key, input []byte) (ciphertext []byte, err error)

MS-LSAD 5.1.2 and 5.1.3 combined

Types

type BindReq

type BindReq struct {
	Header          // 16 Bytes
	MaxSendFragSize uint16
	MaxRecvFragSize uint16
	Association     uint32      // A value of 0 means a request for a new Association group
	ContextList     ContextList // p_cont_list_t

}

C706 Section 12.6.4.3

func (*BindReq) MarshalBinary

func (self *BindReq) MarshalBinary() (ret []byte, err error)

func (*BindReq) UnmarshalBinary

func (self *BindReq) UnmarshalBinary(buf []byte) (err error)

type BindRes

type BindRes struct {
	Header          // 16 Bytes
	MaxSendFragSize uint16
	MaxRecvFragSize uint16
	Association     uint32
	SecAddrLen      uint16
	SecAddr         []byte
	ResultList      ContextResList
}

C706 Section 12.6.4.4 (bind_ack)

func (*BindRes) MarshalBinary

func (self *BindRes) MarshalBinary() (ret []byte, err error)

func (*BindRes) UnmarshalBinary

func (self *BindRes) UnmarshalBinary(buf []byte) (err error)

type ContextItem

type ContextItem struct {
	Id             uint16
	Count          byte // Determined by number of items in TransferSyntax list
	Reserved       byte // Alignment
	AbstractSyntax SyntaxId
	TransferSyntax []SyntaxId
}

C706 Section 12.6.3.1

typedef struct {
  p_context_id_t p_cont_id;
  u_int8 n_transfer_syn;               // number of items
  u_int8 reserved;                     // alignment pad, m.b.z.
  p_syntax_id_t abstract_syntax;       // transfer syntax list
  p_syntax_id_t [size_is(n_transfer_syn)] transfer_syntaxes[];
} p_cont_elem_t;

func (*ContextItem) MarshalBinary

func (self *ContextItem) MarshalBinary() (ret []byte, err error)

func (*ContextItem) UnmarshalBinary

func (self *ContextItem) UnmarshalBinary(buf []byte) (err error)

type ContextList

type ContextList struct {
	Count     byte
	Reserved  byte   // Alignment
	Reserved2 uint16 // Alignment
	Items     []ContextItem
}

C706 Section 12.6.3.1

typedef struct {
  u_int8 n_context_elem;               // number of items
  u_int8 reserved;                     // alignment pad, m.b.z.
  u_short reserved2;                   // alignment pad, m.b.z.
  p_cont_elem_t [size_is(n_cont_elem)] p_cont_elem[];
} p_cont_list_t;

func (*ContextList) MarshalBinary

func (self *ContextList) MarshalBinary() (ret []byte, err error)

func (*ContextList) UnmarshalBinary

func (self *ContextList) UnmarshalBinary(buf []byte) (err error)

type ContextResItem

type ContextResItem struct {
	Result         resultType
	Reason         providerReason
	TransferSyntax SyntaxId
}

C706 12.6.3.1

typedef struct {
  p_cont_def_result_t result;
  p_provider_reason_t reason; // only relevant if result != acceptance
  p_syntax_id_t transfer_syntax; // tr syntax selected 0 if result not accepted
} p_result_t;

type ContextResList

type ContextResList struct {
	Results   byte   // Count of ContextResItem list
	Reserved  byte   // Alignment
	Reserved2 uint16 // Alignment
	Items     []ContextResItem
}

C706 12.6.3.1

typedef struct {
  u_int8 n_results;        // count
  u_int8 reserved;         // alignment pad, m.b.z.
  u_int16 reserved2;       // alignment pad, m.b.z.
  p_result_t [size_is(n_results)] p_results[];
} p_result_list_t;

func (*ContextResList) UnmarshalBinary

func (self *ContextResList) UnmarshalBinary(buf []byte) (err error)
type Header struct {
	MajorVersion   byte // rpc_vers
	MinorVersion   byte // rpc_vers_minor
	Type           byte
	Flags          byte
	Representation uint32 // NDR data representation
	FragLength     uint16
	AuthLength     uint16
	CallId         uint32
}

Defined in C706 (DCE 1.1: Remote Procedure Call) section 12.6.3.1 as "common fields"

func (*Header) MarshalBinary

func (self *Header) MarshalBinary() (ret []byte, err error)

func (*Header) UnmarshalBinary

func (self *Header) UnmarshalBinary(buf []byte) (err error)

type RequestReq

type RequestReq struct {
	Header // 16 bytes
	// AllocHint is an optional field useful for hinting required space when
	// sending fragmented requests
	AllocHint uint32
	ContextId uint16 // Data representation
	Opnum     uint16
	// Optional field object uuid_t
	// Only present if PfcObjectUUID is set in the header flags
	Buffer []byte
}

C706 Section 12.6.4.9

func (*RequestReq) MarshalBinary

func (self *RequestReq) MarshalBinary() (ret []byte, err error)

func (*RequestReq) UnmarshalBinary

func (self *RequestReq) UnmarshalBinary(buf []byte) (err error)

type RequestRes

type RequestRes struct {
	Header // 16 bytes
	// This optional field AllocHint is used to hint about how much
	// contiguous space to allocate for fragmented requests.
	AllocHint   uint32
	ContextId   uint16
	CancelCount byte
	Reserved    byte
	Buffer      []byte
}

C706 Section 12.6.4.10

func (*RequestRes) MarshalBinary

func (self *RequestRes) MarshalBinary() (ret []byte, err error)

func (*RequestRes) UnmarshalBinary

func (self *RequestRes) UnmarshalBinary(buf []byte) (err error)

type ServiceBind

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

func Bind

func Bind(f *smb.File, interface_uuid string, majorVersion, minorVersion uint16, transfer_uuid string) (bind *ServiceBind, err error)

func (*ServiceBind) GetSessionKey

func (sb *ServiceBind) GetSessionKey() (sessionKey []byte)

func (*ServiceBind) MakeIoCtlRequest

func (sb *ServiceBind) MakeIoCtlRequest(opcode uint16, innerBuf []byte) (result []byte, err error)

type SyntaxId

type SyntaxId struct {
	UUID []byte // 16 bytes
	// Major version is encoded in the 16 least significant bits
	// Minor version is encoded in the 16 most significant bits
	Version uint32
}

Directories

Path Synopsis
MIT License
MIT License

Jump to

Keyboard shortcuts

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