msrpc

package
v0.0.0-...-8d0f603 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT, BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PDURequest            = 0
	PDUPing               = 1
	PDUResponse           = 2
	PDUFault              = 3
	PDUWorking            = 4
	PDUNoCall             = 5
	PDUReject             = 6
	PDUAck                = 7
	PDUCl_Cancel          = 8
	PDUFack               = 9
	PDUCancel_Ack         = 10
	PDUBind               = 11
	PDUBind_Ack           = 12
	PDUBind_Nak           = 13
	PDUAlter_Context      = 14
	PDUAlter_Context_Resp = 15
	PDUShutdown           = 17
	PDUCo_Cancel          = 18
	PDUOrphaned           = 19
)

PDU PacketType https://pubs.opengroup.org/onlinepubs/9629399/chap12.htm

View Source
const (
	//PDUFlagReserved_01 = 0x01
	FirstFrag = 0x01
	LastFrag  = 0x02
	//PDUFlagLastFrag    = 0x02
	PDUFlagPending = 0x03
	CancelPending  = 0x04
	//PDUFlagFrag        = 0x04
	PDUFlagNoFack      = 0x08
	PDUFlagMayBe       = 0x10
	PDUFlagIdemPotent  = 0x20
	PDUFlagBroadcast   = 0x40
	PDUFlagReserved_80 = 0x80
)

PDU PacketFlags https://pubs.opengroup.org/onlinepubs/9629399/chap12.htm

View Source
const (
	RPC_VERSION       = 5
	RPC_VERSION_MINOR = 0

	RPC_TYPE_REQUEST  = 0
	RPC_TYPE_RESPONSE = 2
	RPC_TYPE_BIND     = 11
	RPC_TYPE_BIND_ACK = 12

	RPC_PACKET_FLAG_FIRST = 0x01
	RPC_PACKET_FLAG_LAST  = 0x02

	NDR_VERSION   = 2
	NDR64_VERSION = 1
)
View Source
const (
	SVCCTL_VERSION       = 2
	SVCCTL_VERSION_MINOR = 0

	SVCCTL_DLL = "svcctl"
)
View Source
const (
	RCloseServiceHandle         = 0
	RControlService             = 1
	RDeleteService              = 2
	RLockServiceDatabase        = 3
	RQueryServiceObjectSecurity = 4
	RSetServiceObjectSecurity   = 5
	RQueryServiceStatus         = 6
	RSetServiceStatus           = 7
	RUnlockServiceDatabase      = 8
	RNotifyBootConfigStatus     = 9
	RChangeServiceConfigW       = 11
	RCreateServiceW             = 12
	REnumDependentServicesW     = 13
	REnumServicesStatusW        = 14
	ROpenSCManagerW             = 15
	ROpenServiceW               = 16
	RQueryServiceConfigW        = 17
	RQueryServiceLockStatusW    = 18
	RStartServiceW              = 19
	RGetServiceDisplayNameW     = 20
	RGetServiceKeyNameW         = 21
	RChangeServiceConfigA       = 23
	RCreateServiceA             = 24
	REnumDependentServicesA     = 25
	REnumServicesStatusA        = 26
	ROpenSCManagerA             = 27
	ROpenServiceA               = 28
	RQueryServiceConfigA        = 29
	RQueryServiceLockStatusA    = 30
	RStartServiceA              = 31
	RGetServiceDisplayNameA     = 32
	RGetServiceKeyNameA         = 33
	REnumServiceGroupW          = 35
	RChangeServiceConfig2A      = 36
	RChangeServiceConfig2W      = 37
	RQueryServiceConfig2A       = 38
	RQueryServiceConfig2W       = 39
	RQueryServiceStatusEx       = 40
	REnumServicesStatusExA      = 41
	REnumServicesStatusExW      = 42
	RCreateServiceWOW64A        = 44
	RCreateServiceWOW64W        = 45
	RNotifyServiceStatusChange  = 47
	RGetNotifyResults           = 48
	RCloseNotifyHandle          = 49
	RControlServiceExA          = 50
	RControlServiceExW          = 51
	RQueryServiceConfigEx       = 56
	RCreateWowService           = 60
	ROpenSCManager2             = 64
)

opnum https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-scmr/0d7a7011-9f41-470d-ad52-8535b47ac282

View Source
const (
	SERVICE_ALL_ACCESS        = 0x000F01FF
	SC_MANAGER_CREATE_SERVICE = 0x00000002
	SC_MANAGER_CONNECT        = 0x00000001
)

access request https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-scmr/0d7a7011-9f41-470d-ad52-8535b47ac282

View Source
const (
	SERVICE_KERNEL_DRIVER       = 0x00000001
	SERVICE_FILE_SYSTEM_DRIVER  = 0x00000002
	SERVICE_WIN32_OWN_PROCESS   = 0x00000010
	SERVICE_WIN32_SHARE_PROCESS = 0x00000020
	SERVICE_INTERACTIVE_PROCESS = 0x00000100
)

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-scmr/6a8ca926-9477-4dd4-b766-692fab07227e

View Source
const (
	SERVICE_BOOT_START   = 0x00000000
	SERVICE_SYSTEM_START = 0x00000001
	SERVICE_AUTO_START   = 0x00000002
	SERVICE_DEMAND_START = 0x00000003
	SERVICE_DISABLED     = 0x00000004
)

Service Start Type

View Source
const (
	SERVICE_ERROR_IGNORE   = 0x00000000
	SERVICE_ERROR_NORMAL   = 0x00000001
	SERVICE_ERROR_SEVERE   = 0x00000002
	SERVICE_ERROR_CRITICAL = 0x00000003
)

Service Error Control

View Source
const (
	SRVSVC_VERSION       = 3
	SRVSVC_VERSION_MINOR = 0

	OP_NET_SHARE_ENUM = 15
)

Variables

View Source
var (
	// NDR v1: 8a885d04-1ceb-11c9-9fe8-08002b104860
	NDR_UUID = []byte("045d888aeb1cc9119fe808002b104860")

	// NDR64 v1: 71710533-beba-4937-8319-b5dbef9ccc36
	NDR64_UUID = []byte("33057171babe37498319b5dbef9ccc36")
)
View Source
var SRVSVC_UUID = []byte("c84f324b7016d30112785a47bf6ee188")
View Source
var SVCCTL_UUID = []byte("81bb7a364498f135ad3298f038001003")

Functions

This section is empty.

Types

type BindAckDecoder

type BindAckDecoder []byte

func (BindAckDecoder) CallId

func (c BindAckDecoder) CallId() uint32

func (BindAckDecoder) IsInvalid

func (c BindAckDecoder) IsInvalid() bool

func (BindAckDecoder) PacketType

func (c BindAckDecoder) PacketType() uint8

func (BindAckDecoder) Version

func (c BindAckDecoder) Version() uint8

func (BindAckDecoder) VersionMinor

func (c BindAckDecoder) VersionMinor() uint8

type CreateService

type CreateService struct {
	CallId         uint32
	ServiceName    string
	DisplayName    string
	BinaryPathName string
	ContextHandle  []byte `smb:"fixed:20"`
}

func (*CreateService) Encode

func (r *CreateService) Encode(b []byte)

func (*CreateService) Size

func (r *CreateService) Size() int

type CreateServiceRequest

type CreateServiceRequest struct {
	ContextHandle       []byte `smb:"fixed:20"`
	ServiceName         SCRpcHandle
	Reserved1           uint16
	DisplayName         SVCCTLHandle
	Reserved2           uint16
	AccessMask          uint32
	ServiceType         uint32
	ServiceStartType    uint32
	ServiceErrorControl uint32
	BinaryPathName      SCRpcHandle
	NULLPointer         uint32
	TagId               uint32
	NULLPointer2        uint32
	DependSize          uint32
	NULLPointer3        uint32
	NULLPointer4        uint32
	PasswordSize        uint32
}

type CreateServiceResponse

type CreateServiceResponse struct {
	RpcHeaderStruct
	AllocHint     uint32
	ContextId     uint16
	CancelCount   uint8
	Reserved      uint8
	TagId         uint32
	ContextHandle []byte `smb:"fixed:20"`
	ReturnCode    uint32
}

type DeleteService

type DeleteService struct {
	ContextHandle []byte
	CallId        uint32
}

func (*DeleteService) Encode

func (r *DeleteService) Encode(b []byte)

func (*DeleteService) Size

func (r *DeleteService) Size() int

type DeleteServiceRequest

type DeleteServiceRequest struct {
	ContextHandle []byte `smb:"fixed:20"`
}

type DeleteServiceResponse

type DeleteServiceResponse struct {
	RpcHeaderStruct
	AllocHint   uint32
	ContextId   uint16
	CancelCount uint8
	Reserved    uint8
	ReturnCode  uint32
}

type NetShareEnumAllRequest

type NetShareEnumAllRequest struct {
	CallId     uint32
	ServerName string
	Level      uint32
}

func NewNetShareEnumAllRequest

func NewNetShareEnumAllRequest(callid uint32, srvname string) *NetShareEnumAllRequest

func (*NetShareEnumAllRequest) Encode

func (r *NetShareEnumAllRequest) Encode(b []byte)

func (*NetShareEnumAllRequest) Size

func (r *NetShareEnumAllRequest) Size() int

type NetShareEnumAllResponseDecoder

type NetShareEnumAllResponseDecoder []byte

func (NetShareEnumAllResponseDecoder) Buffer

func (c NetShareEnumAllResponseDecoder) Buffer() []byte

func (NetShareEnumAllResponseDecoder) CallId

func (NetShareEnumAllResponseDecoder) IsIncomplete

func (c NetShareEnumAllResponseDecoder) IsIncomplete() bool

func (NetShareEnumAllResponseDecoder) IsInvalid

func (c NetShareEnumAllResponseDecoder) IsInvalid() bool

func (NetShareEnumAllResponseDecoder) ShareNameList

func (c NetShareEnumAllResponseDecoder) ShareNameList() []string

type NetrShareEnumRequest

type NetrShareEnumRequest struct {
	ServerName struct {
		ReferentID uint32
		MaxCount   uint32
		Offset     uint32
		Count      uint32
		Name       []byte
	}
	Level        uint32
	Ctr          uint32
	ReferentID   uint32
	CountCtr1    uint32
	PointerCtr1  uint32
	MaxBuffer    uint32
	ResumeHandle uint32
}

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-srvs/c4a98e7b-d416-439c-97bd-4d9f52f8ba52

type OpenSCManager

type OpenSCManager struct {
	CallId     uint32
	ServerName string
}

func (*OpenSCManager) Encode

func (r *OpenSCManager) Encode(b []byte)

func (*OpenSCManager) Size

func (r *OpenSCManager) Size() int

type OpenSCManagerResponse

type OpenSCManagerResponse struct {
	RpcHeaderStruct
	AllocHint     uint32
	ContextId     uint16
	CancelCount   uint8
	Reserved      uint8
	ContextHandle []byte `smb:"fixed:20"`
	ReturnCode    uint32
}

type OpenService

type OpenService struct {
	CallId        uint32
	ServiceName   string
	ContextHandle []byte `smb:"fixed:20"`
}

func (*OpenService) Encode

func (r *OpenService) Encode(b []byte)

func (*OpenService) Size

func (r *OpenService) Size() int

type OpenServiceRequest

type OpenServiceRequest struct {
	ContextHandle []byte `smb:"fixed:20"`
	ServiceName   SCRpcHandle
	Reserved      uint16
	AccessMask    uint32
}

type OpenServiceResponse

type OpenServiceResponse struct {
	RpcHeaderStruct
	AllocHint     uint32
	ContextId     uint16
	CancelCount   uint8
	Reserved      uint8
	ContextHandle []byte `smb:"fixed:20"`
	ReturnCode    uint32
}

type OpenedPipe

type OpenedPipe int
const (
	SRVSVC OpenedPipe = iota
	NTSVCS
)

type RpcBindRequest

type RpcBindRequest struct {
	RpcHeaderStruct
	MaxSendFrag  uint16
	MaxRecvFrag  uint16
	AssocGroup   uint32
	ContextCount uint32
	RpcBindRequestContextEntry
}

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rpce/a6b7b03c-4ac5-4c25-8c52-f2bec872ac97

func NewRpcBindRequestHeader

func NewRpcBindRequestHeader(callid uint32, op OpenedPipe) *RpcBindRequest

func (*RpcBindRequest) Bytes

func (rbh *RpcBindRequest) Bytes() []byte

func (*RpcBindRequest) Encode

func (rbr *RpcBindRequest) Encode(b []byte)

func (*RpcBindRequest) Size

func (r *RpcBindRequest) Size() int

type RpcBindRequestContextEntry

type RpcBindRequestContextEntry struct {
	ContextID             uint16
	TransItemCount        uint16
	InterfaceUUID         []byte `fixed:"16"`
	InterfaceVersion      uint16
	InterfaceVersionMinor uint16
	TransferSyntaxUUID    []byte `fixed:"16"`
	TransferSyntaxVersion uint32
}

type RpcHeaderStruct

type RpcHeaderStruct struct {
	RpcVersion         uint8
	RpcVersionMinor    uint8
	PacketType         uint8
	PacketFlags        byte
	DataRepresentation []byte `smb:"fixed:4"`
	FragLength         uint16
	AuthLength         uint16
	CallId             uint32
}

type RpcRequestStruct

type RpcRequestStruct struct {
	RpcHeaderStruct
	AllocHint uint32
	ContextID uint16
	OpNum     uint16
	Payload   interface{}
}

func (*RpcRequestStruct) Bytes

func (req *RpcRequestStruct) Bytes() []byte

type SCRpcHandle

type SCRpcHandle struct {
	MaxCount    uint32
	Offset      uint32
	ActualCount uint32
	Data        []byte
}

type SVCCTLHandle

type SVCCTLHandle struct {
	ReferentId  uint32 `smb:"offset:Data"`
	MaxCount    uint32
	Offset      uint32
	ActualCount uint32
	Data        []byte
}

type StartService

type StartService struct {
	ContextHandle []byte `smb:"fixed:20"`
	CallId        uint32
}

func (*StartService) Encode

func (r *StartService) Encode(b []byte)

func (*StartService) Size

func (r *StartService) Size() int

type StartServiceRequest

type StartServiceRequest struct {
	ContextHandle []byte `smb:"fixed:20"`
	Argc          uint32
	Argv          []byte `smb:"fixed:4"`
}

type StartServiceResponse

type StartServiceResponse struct {
	RpcHeaderStruct
	AllocHint   uint32
	ContextId   uint16
	CancelCount uint8
	Reserved    uint8
	StubData    uint32
}

Jump to

Keyboard shortcuts

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