dcerpc

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PacketTypeRequest  uint8 = 0
	PacketTypeResponse uint8 = 2
	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 (
	MSRPCSvcCtlPipe                = "svcctl"
	MSRPCUuidSvcCtl                = "367ABB81-9844-35F1-AD32-98F038001003"
	MSRPCSvcCtlMajorVersion uint16 = 2
	MSRPCSvcCtlMinorVersion uint16 = 0
)
View Source
const (
	SvcCtlRCloseServiceHandle   uint16 = 0
	SvcCtlRControlService       uint16 = 1
	SvcCtlRDeleteService        uint16 = 2
	SvcCtlRQueryServiceStatus   uint16 = 6
	SvcCtlRChangeServiceConfigW uint16 = 11
	SvcCtlRCreateServiceW       uint16 = 12
	SvcCtlROpenSCManagerW       uint16 = 15
	SvcCtlROpenServiceW         uint16 = 16
	SvcCtlRQueryServiceConfigW  uint16 = 17
	SvcCtlRStartServiceW        uint16 = 19
)

MS-SCMR Operations OP Codes

View Source
const (
	ServiceKernelDriver       uint32 = 0x00000001
	ServiceFileSystemDriver   uint32 = 0x00000002
	ServiceWin32OwnProcess    uint32 = 0x00000010
	ServiceWin32ShareProcess  uint32 = 0x00000020
	ServiceInteractiveProcess uint32 = 0x00000100
)

MS-SCMR (svcctl) Section 2.2.15 ServiceType merged with Section 2.2.47 dwServiceType

View Source
const (
	ServiceBootStart   uint32 = 0x00000000
	ServiceSystemStart uint32 = 0x00000001
	ServiceAutoStart   uint32 = 0x00000002
	ServiceDemandStart uint32 = 0x00000003
	ServiceDisabled    uint32 = 0x00000004
)

MS-SCMR (svcctl) Table 2.2.15 StartType

View Source
const (
	ServiceErrorIgnore   uint32 = 0x00000000
	ServiceErrorNormal   uint32 = 0x00000001
	ServiceErrorSevere   uint32 = 0x00000002
	ServiceErrorCritical uint32 = 0x00000003
)

MS-SCMR (svcctl) Table 2.2.15 ErrorControl

View Source
const (
	ServiceAllAccess           uint32 = 0x000F01FF //In addition to all access rights in this table, SERVICE_ALL_ACCESS includes Delete (DE), Read Control (RC), Write DACL (WD), and Write Owner (WO) access, as specified in ACCESS_MASK (section 2.4.3) of [MS-DTYP].
	ServiceChangeConfig        uint32 = 0x00000002 //Required to change the configuration of a service.
	ServiceEnumerateDependents uint32 = 0x00000008 //Required to enumerate the services installed on the server.
	ServiceInterrogate         uint32 = 0x00000080 //Required to request immediate status from the service.
	ServicePauseContinue       uint32 = 0x00000040 //Required to pause or continue the service.
	ServiceQueryConfig         uint32 = 0x00000001 //Required to query the service configuration.
	ServiceQueryStatus         uint32 = 0x00000004 //Required to request the service status.
	ServiceStart               uint32 = 0x00000010 //Required to start the service.
	ServiceStop                uint32 = 0x00000020 //Required to stop the service
	ServiceUserDefinedControl  uint32 = 0x00000100 //Required to specify a user-defined control code.
	ServiceSetStatus           uint32 = 0x00008000 //Required for a service to set its status.

	SCManagerLock             uint32 = 0x00000008 //Required to lock the SCM database.
	SCManagerCreateService    uint32 = 0x00000002 //Required for a service to be created.
	SCManagerEnumerateService uint32 = 0x00000004 //Required to enumerate a service.
	SCManagerConnect          uint32 = 0x00000001 //Required to connect to the SCM.
	SCManagerQueryLockStatus  uint32 = 0x00000010 //Required to query the lock status of the SCM database.
	SCManagerModifyBootConfig uint32 = 0x0020     //Required to call the RNotifyBootConfigStatus method.
)

MS-SCMR (svcctl) Table 3.1.4

View Source
const (
	ServiceContinuePending uint32 = 0x00000005
	ServicePausePending    uint32 = 0x00000006
	ServicePaused          uint32 = 0x00000007
	ServiceRunning         uint32 = 0x00000004
	ServiceStartPending    uint32 = 0x00000002
	ServiceStopPending     uint32 = 0x00000003
	ServiceStopped         uint32 = 0x00000001
)

MS-SCMR Section 2.2.47 dwCurrentState

View Source
const (
	ServiceControlContinue       uint32 = 0x00000003
	ServiceControlInterrogate    uint32 = 0x00000004
	ServiceControlNetbindadd     uint32 = 0x00000007
	ServiceControlNetbinddisable uint32 = 0x0000000A
	ServiceControlNetbindenable  uint32 = 0x00000009
	ServiceControlNetbindremove  uint32 = 0x00000008
	ServiceControlParamChange    uint32 = 0x00000006
	ServiceControlPause          uint32 = 0x00000002
	ServiceControlStop           uint32 = 0x00000001
)

MS-SCMR Section 3.1.4.2 dwControl

View Source
const (
	ErrorSuccess                    uint32 = 0  // Successfully started the service
	ErrorFileNotFound               uint32 = 2  // The system cannot find the file specified.
	ErrorPathNotFound               uint32 = 3  // The system cannot find the path specified.
	ErrorAccessDenied               uint32 = 5  // The SERVICE_START access right had not been granted to the caller when the RPC context handle to the service record was created.
	ErrorInvalidHandle              uint32 = 6  // The handle is no longer valid.
	ErrorInvalidParameter           uint32 = 87 // A parameter that was specified is invalid.
	ErrorInsufficientBuffer         uint32 = 122
	ErrorDependentServicesRunning   uint32 = 1051
	ErrorInvalidServiceControl      uint32 = 1052
	ErrorServiceRequestTimeout      uint32 = 1053 // The process for the service was started, but it did not respond within an implementation-specific time-out.
	ErrorServiceNoThread            uint32 = 1054 // A thread could not be created for the service.
	ErrorServiceDatabaseLocked      uint32 = 1055 // The service database is locked by the call to the BlockServiceDatabase method.
	ErrorServiceAlreadyRunning      uint32 = 1056 // The ServiceStatus.dwCurrentState in the service record is not set to SERVICE_STOPPED.
	ErrorInvalidServiceAccount      uint32 = 1057 // The user account name specified in the lpServiceStartName parameter does not exist.
	ErrorServiceDisabled            uint32 = 1058 // The service cannot be started because the Start field in the service record is set to SERVICE_DISABLED.
	ErrorCircularDependency         uint32 = 1059 // A circular dependency was specified.
	ErrorServiceDoesNotExist        uint32 = 1060 // The service record with a specified display name does not exist in the SCM database
	ErrorServiceCannotAcceptControl uint32 = 1061
	ErrorServiceNotActive           uint32 = 1062
	ErrorServiceDependencyFail      uint32 = 1068 // The specified service depends on another service that has failed to start.
	ErrorServiceLogonFailed         uint32 = 1069 // The service did not start due to a logon failure.
	ErrorServiceMarkedForDelete     uint32 = 1072 // The RDeleteService method has been called for the service record identified by the hService parameter.
	ErrorServiceDependencyDeleted   uint32 = 1075 // The specified service depends on a service that does not exist or has been marked for deletion.
	ErrorDuplicateServiceName       uint32 = 1078 // The lpDisplayName matches either the ServiceName or the DisplayName of another service record in the service control manager database.
	ErrorShutdownInProgress         uint32 = 1115 // The system is shutting down.
)

MS-SCMR Response codes from multiple sections: 3.1.4.2, 3.1.4.11, 3.1.4.17, 3.1.4.19

View Source
const (
	MSRPCUuidSrvSvc                = "4B324FC8-1670-01D3-1278-5A47BF6EE188"
	MSRPCSrvSvcPipe                = "srvsvc"
	MSRPCSrvSvcMajorVersion uint16 = 3
	MSRPCSrvSvcMinorVersion uint16 = 0
)
View Source
const (
	SrvSvcOpNetrSessionEnum  uint16 = 12
	SrvSvcOpNetShareEnumAll  uint16 = 15
	SrvSvcOpNetServerGetInfo uint16 = 21
)

MSRPC Server Service (srvsvc) Operations

View Source
const (
	StypeDisktree    uint32 = 0x00000000 // Disk drive
	StypePrintq      uint32 = 0x00000001 // Print queue
	StypeDevice      uint32 = 0x00000002 // Communication device
	StypeIPC         uint32 = 0x00000003 // Interprocess communication (IPC)
	StypeClusterFS   uint32 = 0x02000000 // A cluster share
	StypeClusterSOFS uint32 = 0x04000000 // A Scale-Out cluster share
	StypeClusterDFS  uint32 = 0x08000000 // A DFS share in a cluster
	StypeSpecial     uint32 = 0x80000000 // Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer to administrative shares such as C$, D$, E$, and so forth.
	StypeTemporary   uint32 = 0x40000000 // A temporary share that is not persisted for creation each time the file server initializes.
)
View Source
const (
	SRVSErrorFileNotFound        uint32 = 2
	SRVSErrorAccessDenied        uint32 = 5
	SRVSErrorNotSupported        uint32 = 50
	SRVSErrorDupName             uint32 = 52
	SRVSErrorInvalidParameter    uint32 = 87
	SRVSErrorInvalidLevel        uint32 = 124
	SRVSErrorMoreData            uint32 = 234
	SRVSErrorServiceDoesNotExist uint32 = 1060
	SRVSErrorInvalidDomainName   uint32 = 1212
	SRVSNERRUnknownDevDir        uint32 = 2116
	SRVSNERRRedirectedPath       uint32 = 2117
	SRVSNERRDuplicateShare       uint32 = 2118
	SRVSNERRBufTooSmall          uint32 = 2123
	SRVSNERRUserNotFound         uint32 = 2221
	SRVSNERRNetNameNotFound      uint32 = 2310
	SRVSNERRDeviceNotShared      uint32 = 2311
	SRVSNERRClientNameNotFound   uint32 = 2312
	SRVSNERRInvalidComputer      uint32 = 2351
)

MS-SRVS Response codes from 2.2.2.10 Common Error Codes

View Source
const (
	ServiceNoChange uint32 = 0xffffffff
)

MS-SCMR Section 3.1.4.11 RChangeServiceConfigW

Variables

View Source
var ErrorControlStatusMap = map[uint32]string{
	ServiceErrorIgnore:   "SERVICE_ERROR_IGNORE",
	ServiceErrorNormal:   "SERVICE_ERROR_NORMAL",
	ServiceErrorSevere:   "SERIVCE_ERROR_SEVERE",
	ServiceErrorCritical: "SERVICE_ERROR_CRITICAL",
}
View Source
var (
	MSRPCUuidNdr = "8a885d04-1ceb-11c9-9fe8-08002b104860" // NDR Transfer Syntax version 2.0

)
View Source
var SRVSResponseCodeMap = map[uint32]error{
	SRVSErrorFileNotFound:        fmt.Errorf("The system cannot find the file specified"),
	SRVSErrorAccessDenied:        fmt.Errorf("The user does not have access to the requested information"),
	SRVSErrorNotSupported:        fmt.Errorf("The server does not support branch cache"),
	SRVSErrorDupName:             fmt.Errorf("A duplicate name exists on the network"),
	SRVSErrorInvalidParameter:    fmt.Errorf("One or more of the specified parameters is invalid"),
	SRVSErrorInvalidLevel:        fmt.Errorf("The value that is specified for the level parameter is invalid"),
	SRVSErrorMoreData:            fmt.Errorf("More entries are available. Specify a large enough buffer to receive all entries"),
	SRVSErrorServiceDoesNotExist: fmt.Errorf("The branch cache component does not exist as an installed service"),
	SRVSErrorInvalidDomainName:   fmt.Errorf("The format of the specified NetBIOS name of a domain is invalid"),
	SRVSNERRUnknownDevDir:        fmt.Errorf("The device or directory does not exist"),
	SRVSNERRRedirectedPath:       fmt.Errorf("The operation is not valid for a redirected resource. The specified device name is assigned to a shared resource"),
	SRVSNERRDuplicateShare:       fmt.Errorf("The share name is already in use on this server"),
	SRVSNERRBufTooSmall:          fmt.Errorf("The client request succeeded. More entries are available. The buffer size that is specified by PreferedMaximumLength was too small to fit even a single entry"),
	SRVSNERRUserNotFound:         fmt.Errorf("The user name could not be found"),
	SRVSNERRNetNameNotFound:      fmt.Errorf("The share name does not exist"),
	SRVSNERRDeviceNotShared:      fmt.Errorf("The device is not shared"),
	SRVSNERRClientNameNotFound:   fmt.Errorf("A session does not exist with the computer name"),
	SRVSNERRInvalidComputer:      fmt.Errorf("The computer name is not valid"),
}
View Source
var ServiceResponseCodeMap = map[uint32]error{
	ErrorSuccess:                    fmt.Errorf("Successfully started the service"),
	ErrorFileNotFound:               fmt.Errorf("The system cannot find the file specified."),
	ErrorPathNotFound:               fmt.Errorf("The system cannot find the path specified."),
	ErrorAccessDenied:               fmt.Errorf("ERROR_ACCESS_DENIED"),
	ErrorInvalidHandle:              fmt.Errorf("The handle is no longer valid."),
	ErrorInvalidParameter:           fmt.Errorf("A parameter that was specified is invalid."),
	ErrorInsufficientBuffer:         fmt.Errorf("ERROR_INSUFFICIENT_BUFFER"),
	ErrorDependentServicesRunning:   fmt.Errorf("ERROR_DEPENDENT_SERVICES_RUNNING"),
	ErrorInvalidServiceControl:      fmt.Errorf("ERROR_INVALID_SERVICE_CONTROL"),
	ErrorServiceRequestTimeout:      fmt.Errorf("Error service request timeout"),
	ErrorServiceNoThread:            fmt.Errorf("A thread could not be created for the service."),
	ErrorServiceDatabaseLocked:      fmt.Errorf("The service database is locked by the call to the BlockServiceDatabase method."),
	ErrorServiceAlreadyRunning:      fmt.Errorf("Service already running!"),
	ErrorInvalidServiceAccount:      fmt.Errorf("ERROR_INVALID_SERVICE_ACCOUNT"),
	ErrorServiceDisabled:            fmt.Errorf("ERROR_SERVICE_DISABLED"),
	ErrorCircularDependency:         fmt.Errorf("ERROR_CIRCULAR_DEPENDENCY"),
	ErrorServiceDoesNotExist:        fmt.Errorf("ERROR_SERVICE_DOES_NOT_EXIST"),
	ErrorServiceCannotAcceptControl: fmt.Errorf("ERROR_SERVICE_CANNOT_ACCEPT_CONTROL"),
	ErrorServiceNotActive:           fmt.Errorf("ERROR_SERVICE_NOT_ACTIVE"),
	ErrorServiceDependencyFail:      fmt.Errorf("The specified service depends on another service that has failed to start."),
	ErrorServiceLogonFailed:         fmt.Errorf("The service did not start due to a logon failure."),
	ErrorServiceMarkedForDelete:     fmt.Errorf("Service marked for delete."),
	ErrorServiceDependencyDeleted:   fmt.Errorf("The specified service depends on a service that does not exist or has been marked for deletion."),
	ErrorDuplicateServiceName:       fmt.Errorf("ERROR_DUPLICATE_SERVICE_NAME"),
	ErrorShutdownInProgress:         fmt.Errorf("The system is shutting down."),
}
View Source
var ServiceStatusMap = map[uint32]string{
	ServiceContinuePending: "SERVICE_CONTINUE_PENDING",
	ServicePausePending:    "SERVICE_PAUSE_PENDING",
	ServicePaused:          "SERVICE_PAUSED",
	ServiceRunning:         "SERVICE_RUNNING",
	ServiceStartPending:    "SERVICE_START_PENDING",
	ServiceStopPending:     "SERVICE_STOP_PENDING",
	ServiceStopped:         "SERVICE_STOPPED",
}
View Source
var ServiceTypeStatusMap = map[uint32]string{
	ServiceKernelDriver:       "SERVICE_KERNEL_DRIVER",
	ServiceFileSystemDriver:   "SERVICE_FILE_SYSTEM_DRIVER",
	ServiceWin32OwnProcess:    "SERIVCE_WIN32_OWN_PROCESS",
	ServiceWin32ShareProcess:  "SERVICE_WIN32_SHARE_PROCESS",
	ServiceInteractiveProcess: "SERVICE_INTERACTIVE_PROCESS",
}
View Source
var ShareTypeMap = map[uint32]string{
	StypeDisktree:    "Disk Drive",
	StypePrintq:      "Print Queue",
	StypeDevice:      "Communication Device",
	StypeIPC:         "IPC",
	StypeClusterFS:   "Cluster Share",
	StypeClusterSOFS: "Scale-Out cluster share",
	StypeClusterDFS:  "DFS Share in cluster",
	StypeSpecial:     "Hidden",
	StypeTemporary:   "Temp",
}
View Source
var StartTypeStatusMap = map[uint32]string{
	ServiceBootStart:   "SERVICE_BOOT_START",
	ServiceSystemStart: "SERVICE_SYSTEM_START",
	ServiceAutoStart:   "SERIVCE_AUTO_START",
	ServiceDemandStart: "SERVICE_DEMAND_START",
	ServiceDisabled:    "SERVICE_DISABLED",
}

Functions

func FromUnicode added in v0.4.0

func FromUnicode(buf []byte) ([]byte, error)

func FromUnicodeString added in v0.4.0

func FromUnicodeString(buf []byte) (res string, err error)

func ToUnicode added in v0.4.0

func ToUnicode(input string) []byte

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 added in v0.4.0

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

func (*BindReq) UnmarshalBinary added in v0.4.0

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 added in v0.4.0

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

func (*BindRes) UnmarshalBinary added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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

func (*ContextList) UnmarshalBinary added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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

func (*Header) UnmarshalBinary added in v0.4.0

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

type NetServerGetInfoRequest added in v0.3.8

type NetServerGetInfoRequest struct {
	ServerName string
	Level      uint32
}

NET_API_STATUS NetrServerGetInfo ( [in,string,unique] SRVSVC_HANDLE ServerName, [in] DWORD Level, [out, switch_is(Level)] LPSERVER_INFO InfoStruct );

func NewNetServerGetInfoRequest added in v0.3.8

func NewNetServerGetInfoRequest(serverName string, level int) *NetServerGetInfoRequest

func (*NetServerGetInfoRequest) MarshalBinary added in v0.3.8

func (self *NetServerGetInfoRequest) MarshalBinary() ([]byte, error)

func (*NetServerGetInfoRequest) UnmarshalBinary added in v0.3.8

func (self *NetServerGetInfoRequest) UnmarshalBinary(buf []byte) error

type NetServerGetInfoResponse added in v0.3.8

type NetServerGetInfoResponse struct {
	Info         *NetServerInfo
	WindowsError uint32
}

func (*NetServerGetInfoResponse) MarshalBinary added in v0.3.8

func (self *NetServerGetInfoResponse) MarshalBinary() ([]byte, error)

func (*NetServerGetInfoResponse) UnmarshalBinary added in v0.3.8

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

type NetServerInfo added in v0.3.8

type NetServerInfo struct {
	Level   uint32
	Pointer interface{}
}

type NetServerInfo100 added in v0.3.8

type NetServerInfo100 struct {
	PlatformId uint32
	Name       string
}

type NetServerInfo101 added in v0.3.8

type NetServerInfo101 struct {
	NetServerInfo100
	VersionMajor uint32
	VersionMinor uint32
	SvType       uint32
	Comment      string
}

type NetServerInfo102 added in v0.3.8

type NetServerInfo102 struct {
	NetServerInfo101
	Users    uint32
	Disc     int32
	Hidden   uint32
	Announce uint32
	Anndelta uint32
	Licences uint32
	Userpath string
}

type NetSessionEnumRequest added in v0.3.8

type NetSessionEnumRequest struct {
	ServerName         string
	ClientName         string
	UserName           string
	Info               SessionEnum
	PreferredMaxLength uint32
	ResumeHandle       uint32 // Ptr to dword
}

NET_API_STATUS NetrSessionEnum ( [in,string,unique] SRVSVC_HANDLE ServerName, [in,string,unique] WCHAR * ClientName, [in,string,unique] WCHAR * UserName, [in,out] PSESSION_ENUM_STRUCT InfoStruct, [in] DWORD PreferedMaximumLength, [out] DWORD * TotalEntries, [in,out,unique] DWORD * ResumeHandle );

func NewNetSessionEnumRequest added in v0.3.8

func NewNetSessionEnumRequest(clientName, userName string, level uint32) *NetSessionEnumRequest

func (*NetSessionEnumRequest) MarshalBinary added in v0.3.8

func (self *NetSessionEnumRequest) MarshalBinary() (res []byte, err error)

func (*NetSessionEnumRequest) UnmarshalBinary added in v0.3.8

func (self *NetSessionEnumRequest) UnmarshalBinary(buf []byte) error

type NetSessionEnumResponse added in v0.3.8

type NetSessionEnumResponse struct {
	Info         SessionEnum
	TotalEntries uint32 // Ptr to dword
	ResumeHandle uint32 // Ptr to dword
	WindowsError uint32
}

func (*NetSessionEnumResponse) MarshalBinary added in v0.3.8

func (self *NetSessionEnumResponse) MarshalBinary() ([]byte, error)

func (*NetSessionEnumResponse) UnmarshalBinary added in v0.3.8

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

type NetSessionInfo0 added in v0.3.8

type NetSessionInfo0 struct {
	Cname string
}

Could this be done in a better way? Perhaps with an interface?

type NetSessionInfo1 added in v0.3.8

type NetSessionInfo1 struct {
	NetSessionInfo0
	Username  string
	NumOpens  uint32
	Time      uint32
	IdleTime  uint32
	UserFlags uint32 // Must be a combination of one or more of the values that are defined in 2.2.2.3
}

type NetSessionInfo10 added in v0.3.8

type NetSessionInfo10 struct {
	NetSessionInfo0
	Username string
	Time     uint32
	IdleTime uint32
}

type NetSessionInfo2 added in v0.3.8

type NetSessionInfo2 struct {
	NetSessionInfo1
	ClType string
}

type NetSessionInfo502 added in v0.3.8

type NetSessionInfo502 struct {
	NetSessionInfo2
	Transport string
}

type NetShare

type NetShare struct {
	Name    string
	Comment string
	Type    string
	TypeId  uint32
	Hidden  bool
}

Returned to clients calling the NetShareEnumAll request

type NetShareEnum added in v0.4.0

type NetShareEnum struct {
	Level     uint32
	ShareInfo any
}
typedef struct _SHARE_ENUM_STRUCT {
  DWORD Level;
  [switch_is(Level)] SHARE_ENUM_UNION ShareInfo;
} SHARE_ENUM_STRUCT,

*PSHARE_ENUM_STRUCT, *LPSHARE_ENUM_STRUCT;

type NetShareEnumAllRequest

type NetShareEnumAllRequest struct {
	ServerName   string
	InfoStruct   *NetShareEnum
	MaxBuffer    uint32
	ResumeHandle uint32
}

func NewNetShareEnumAllRequest

func NewNetShareEnumAllRequest(serverName string) *NetShareEnumAllRequest

func (*NetShareEnumAllRequest) MarshalBinary

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

func (*NetShareEnumAllRequest) UnmarshalBinary

func (s *NetShareEnumAllRequest) UnmarshalBinary(buf []byte) error

type NetShareEnumAllResponse

type NetShareEnumAllResponse struct {
	InfoStruct   *NetShareEnum
	TotalEntries uint32
	ResumeHandle uint32
	WindowsError uint32
}

func (*NetShareEnumAllResponse) MarshalBinary

func (s *NetShareEnumAllResponse) MarshalBinary() ([]byte, error)

func (*NetShareEnumAllResponse) UnmarshalBinary

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

type QueryServiceConfigW

type QueryServiceConfigW struct {
	ServiceType      uint32
	StartType        uint32
	ErrorControl     uint32
	BinaryPathName   string
	LoadOrderGroup   string
	TagId            uint32
	Dependencies     string // Array?
	ServiceStartName string
	DisplayName      string
}

MS-SCMR Section 2.2.15

typedef struct _QUERY_SERVICE_CONFIGW { DWORD dwServiceType; DWORD dwStartType; DWORD dwErrorControl; [string,range(0, 8 * 1024)] LPWSTR lpBinaryPathName; [string,range(0, 8 * 1024)] LPWSTR lpLoadOrderGroup; DWORD dwTagId; [string,range(0, 8 * 1024)] LPWSTR lpDependencies; [string,range(0, 8 * 1024)] LPWSTR lpServiceStartName; [string,range(0, 8 * 1024)] LPWSTR lpDisplayName; } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW;

type RChangeServiceConfigWReq added in v0.4.0

type RChangeServiceConfigWReq struct {
	ServiceHandle    []byte
	ServiceType      uint32
	StartType        uint32
	ErrorControl     uint32
	BinaryPathName   string
	LoadOrderGroup   string
	TagId            uint32
	Dependencies     string
	DependSize       uint32
	ServiceStartName string
	// RPC over SMB requires password encryption with session key
	// So have to encrypt the password before calling the marshal function
	Password    []byte // []byte instead of string to support encryption
	PwSize      uint32
	DisplayName string
}

DWORD RChangeServiceConfigW(

[in] SC_RPC_HANDLE hService,
[in] DWORD dwServiceType,
[in] DWORD dwStartType,
[in] DWORD dwErrorControl,
[in, string, unique, range(0, SC_MAX_PATH_LENGTH)]
    wchar_t* lpBinaryPathName,
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)]
    wchar_t* lpLoadOrderGroup,
[in, out, unique] LPDWORD lpdwTagId,
[in, unique, size_is(dwDependSize)]
    LPBYTE lpDependencies,
[in, range(0, SC_MAX_DEPEND_SIZE)]
    DWORD dwDependSize,
[in, string, unique, range(0, SC_MAX_ACCOUNT_NAME_LENGTH)]
    wchar_t* lpServiceStartName,
[in, unique, size_is(dwPwSize)]
    LPBYTE lpPassword,
[in, range(0, SC_MAX_PWD_SIZE)]
    DWORD dwPwSize,
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)]
    wchar_t* lpDisplayName

);

func (*RChangeServiceConfigWReq) MarshalBinary added in v0.4.0

func (self *RChangeServiceConfigWReq) MarshalBinary() (res []byte, err error)

func (*RChangeServiceConfigWReq) UnmarshalBinary added in v0.4.0

func (self *RChangeServiceConfigWReq) UnmarshalBinary(buf []byte) error

type RChangeServiceConfigWRes added in v0.4.0

type RChangeServiceConfigWRes struct {
	TagId      uint32
	ReturnCode uint32
}

func (*RChangeServiceConfigWRes) MarshalBinary added in v0.4.0

func (self *RChangeServiceConfigWRes) MarshalBinary() ([]byte, error)

func (*RChangeServiceConfigWRes) UnmarshalBinary added in v0.4.0

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

type RCloseServiceHandleReq

type RCloseServiceHandleReq struct {
	ServiceHandle []byte
}

func (*RCloseServiceHandleReq) MarshalBinary added in v0.4.0

func (self *RCloseServiceHandleReq) MarshalBinary() (res []byte, err error)

func (*RCloseServiceHandleReq) UnmarshalBinary added in v0.4.0

func (self *RCloseServiceHandleReq) UnmarshalBinary(buf []byte) error

type RCloseServiceHandleRes

type RCloseServiceHandleRes struct {
	ContextHandle []byte
	ReturnCode    uint32
}

func (*RCloseServiceHandleRes) MarshalBinary added in v0.4.0

func (self *RCloseServiceHandleRes) MarshalBinary() ([]byte, error)

func (*RCloseServiceHandleRes) UnmarshalBinary added in v0.4.0

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

type RControlServiceReq added in v0.4.0

type RControlServiceReq struct {
	ServiceHandle []byte
	Control       uint32
}

func (*RControlServiceReq) MarshalBinary added in v0.4.0

func (self *RControlServiceReq) MarshalBinary() (res []byte, err error)

func (*RControlServiceReq) UnmarshalBinary added in v0.4.0

func (self *RControlServiceReq) UnmarshalBinary(buf []byte) error

type RControlServiceRes added in v0.4.0

type RControlServiceRes struct {
	ServiceStatus *ServiceStatus
	ReturnValue   uint32
}

func (*RControlServiceRes) MarshalBinary added in v0.4.0

func (self *RControlServiceRes) MarshalBinary() ([]byte, error)

func (*RControlServiceRes) UnmarshalBinary added in v0.4.0

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

type RCreateServiceWReq added in v0.4.0

type RCreateServiceWReq struct {
	SCContextHandle  []byte
	ServiceName      string
	DisplayName      string
	DesiredAccess    uint32
	ServiceType      uint32
	StartType        uint32
	ErrorControl     uint32
	BinaryPathName   string
	LoadOrderGroup   string
	TagId            uint32
	Dependencies     string
	DependSize       uint32
	ServiceStartName string
	Password         []byte
	PwSize           uint32
}

DWORD RCreateServiceW(

[in] SC_RPC_HANDLE hSCManager,
[in, string, range(0, SC_MAX_NAME_LENGTH)]
    wchar_t* lpServiceName,
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)]
    wchar_t* lpDisplayName,
[in] DWORD dwDesiredAccess,
[in] DWORD dwServiceType,
[in] DWORD dwStartType,
[in] DWORD dwErrorControl,
[in, string, range(0, SC_MAX_PATH_LENGTH)]
    wchar_t* lpBinaryPathName,
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)]
    wchar_t* lpLoadOrderGroup,
[in, out, unique] LPDWORD lpdwTagId,
[in, unique, size_is(dwDependSize)]
    LPBYTE lpDependencies,
[in, range(0, SC_MAX_DEPEND_SIZE)]
    DWORD dwDependSize,
[in, string, unique, range(0, SC_MAX_ACCOUNT_NAME_LENGTH)]
    wchar_t* lpServiceStartName,
[in, unique, size_is(dwPwSize)]
    LPBYTE lpPassword,
[in, range(0, SC_MAX_PWD_SIZE)]
    DWORD dwPwSize,
[out] LPSC_RPC_HANDLE lpServiceHandle

);

func (*RCreateServiceWReq) MarshalBinary added in v0.4.0

func (self *RCreateServiceWReq) MarshalBinary() (res []byte, err error)

func (*RCreateServiceWReq) UnmarshalBinary added in v0.4.0

func (self *RCreateServiceWReq) UnmarshalBinary(buf []byte) error

type RCreateServiceWRes added in v0.4.0

type RCreateServiceWRes struct {
	TagId         uint32
	ContextHandle []byte
	ReturnCode    uint32
}

func (*RCreateServiceWRes) MarshalBinary added in v0.4.0

func (self *RCreateServiceWRes) MarshalBinary() ([]byte, error)

func (*RCreateServiceWRes) UnmarshalBinary added in v0.4.0

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

type RDeleteServiceReq added in v0.4.0

type RDeleteServiceReq struct {
	ServiceHandle []byte
}

func (*RDeleteServiceReq) MarshalBinary added in v0.4.0

func (self *RDeleteServiceReq) MarshalBinary() (res []byte, err error)

func (*RDeleteServiceReq) UnmarshalBinary added in v0.4.0

func (self *RDeleteServiceReq) UnmarshalBinary(buf []byte) error

type ROpenSCManagerWReq added in v0.4.0

type ROpenSCManagerWReq struct {
	MachineName   string
	DatabaseName  string
	DesiredAccess uint32
}

DWORD ROpenSCManagerW(

[in, string, unique, range(0, SC_MAX_COMPUTER_NAME_LENGTH)]
SVCCTL_HANDLEW lpMachineName,
[in, string, unique, range(0, SC_MAX_NAME_LENGTH)]
wchar_t* lpDatabaseName,
[in] DWORD dwDesiredAccess,
[out] LPSC_RPC_HANDLE lpScHandle

);

func (*ROpenSCManagerWReq) MarshalBinary added in v0.4.0

func (self *ROpenSCManagerWReq) MarshalBinary() (res []byte, err error)

func (*ROpenSCManagerWReq) UnmarshalBinary added in v0.4.0

func (self *ROpenSCManagerWReq) UnmarshalBinary(buf []byte) error

type ROpenSCManagerWRes added in v0.4.0

type ROpenSCManagerWRes struct {
	ContextHandle [20]byte
	ReturnCode    uint32
}

func (*ROpenSCManagerWRes) MarshalBinary added in v0.4.0

func (self *ROpenSCManagerWRes) MarshalBinary() ([]byte, error)

func (*ROpenSCManagerWRes) UnmarshalBinary added in v0.4.0

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

type ROpenServiceWReq added in v0.4.0

type ROpenServiceWReq struct {
	SCContextHandle []byte
	ServiceName     string
	DesiredAccess   uint32
}

DWORD ROpenServiceW(

[in] SC_RPC_HANDLE hSCManager,
[in, string, range(0, SC_MAX_NAME_LENGTH)]
wchar_t* lpServiceName,
[in] DWORD dwDesiredAccess,
[out] LPSC_RPC_HANDLE lpServiceHandle

);

func (*ROpenServiceWReq) MarshalBinary added in v0.4.0

func (self *ROpenServiceWReq) MarshalBinary() (res []byte, err error)

func (*ROpenServiceWReq) UnmarshalBinary added in v0.4.0

func (self *ROpenServiceWReq) UnmarshalBinary(buf []byte) error

type ROpenServiceWRes added in v0.4.0

type ROpenServiceWRes struct {
	ContextHandle []byte
	ReturnCode    uint32
}

func (*ROpenServiceWRes) MarshalBinary added in v0.4.0

func (self *ROpenServiceWRes) MarshalBinary() ([]byte, error)

func (*ROpenServiceWRes) UnmarshalBinary added in v0.4.0

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

type RQueryServiceConfigWReq added in v0.4.0

type RQueryServiceConfigWReq struct {
	ServiceHandle []byte
	BufSize       uint32
}

DWORD RQueryServiceConfigW(

[in] SC_RPC_HANDLE hService,
[out] LPQUERY_SERVICE_CONFIGW lpServiceConfig,
[in, range(0, 1024*8)] DWORD cbBufSize,
[out] LPBOUNDED_DWORD_8K pcbBytesNeeded

);

func (*RQueryServiceConfigWReq) MarshalBinary added in v0.4.0

func (self *RQueryServiceConfigWReq) MarshalBinary() (res []byte, err error)

func (*RQueryServiceConfigWReq) UnmarshalBinary added in v0.4.0

func (self *RQueryServiceConfigWReq) UnmarshalBinary(buf []byte) error

type RQueryServiceConfigWRes added in v0.4.0

type RQueryServiceConfigWRes struct {
	ServiceConfig *QueryServiceConfigW
	BytesNeeded   uint32
	ErrorCode     uint32
}

func (*RQueryServiceConfigWRes) MarshalBinary added in v0.4.0

func (self *RQueryServiceConfigWRes) MarshalBinary() ([]byte, error)

func (*RQueryServiceConfigWRes) UnmarshalBinary added in v0.4.0

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

type RQueryServiceStatusReq added in v0.4.0

type RQueryServiceStatusReq struct {
	ContextHandle []byte
}

func (*RQueryServiceStatusReq) MarshalBinary added in v0.4.0

func (self *RQueryServiceStatusReq) MarshalBinary() (res []byte, err error)

func (*RQueryServiceStatusReq) UnmarshalBinary added in v0.4.0

func (self *RQueryServiceStatusReq) UnmarshalBinary(buf []byte) error

type RQueryServiceStatusRes added in v0.4.0

type RQueryServiceStatusRes struct {
	ServiceStatus *ServiceStatus
	ReturnCode    uint32
}

DWORD RQueryServiceStatus(

[in] SC_RPC_HANDLE hService,
[out] LPSERVICE_STATUS lpServiceStatus

);

func (*RQueryServiceStatusRes) MarshalBinary added in v0.4.0

func (self *RQueryServiceStatusRes) MarshalBinary() ([]byte, error)

func (*RQueryServiceStatusRes) UnmarshalBinary added in v0.4.0

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

type RStartServiceWReq added in v0.4.0

type RStartServiceWReq struct {
	ServiceHandle []byte
	Argc          uint32
	Argv          []string
}

func (*RStartServiceWReq) MarshalBinary added in v0.4.0

func (s *RStartServiceWReq) MarshalBinary() (res []byte, err error)

func (*RStartServiceWReq) UnmarshalBinary added in v0.4.0

func (self *RStartServiceWReq) UnmarshalBinary(buf []byte) 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 added in v0.4.0

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

func (*RequestReq) UnmarshalBinary added in v0.4.0

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 added in v0.4.0

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

func (*RequestRes) UnmarshalBinary added in v0.4.0

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

type ResumeHandle

type ResumeHandle struct {
	ReferentId uint32
	Handle     uint32
}

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) ChangeServiceConfig

func (sb *ServiceBind) ChangeServiceConfig(
	serviceName string,
	serviceType, startType, errorControl uint32,
	binaryPathName, serviceStartName, password, displayName string) (err error)

func (*ServiceBind) CloseServiceHandle

func (sb *ServiceBind) CloseServiceHandle(serviceHandle []byte)

func (*ServiceBind) ControlService

func (sb *ServiceBind) ControlService(serviceName string, control uint32) (err error)

func (*ServiceBind) CreateService added in v0.2.0

func (sb *ServiceBind) CreateService(
	serviceName string,
	serviceType, startType, errorControl uint32,
	binaryPathName, serviceStartName, password, displayName string, startService bool) (err error)

func (*ServiceBind) DeleteService added in v0.2.0

func (sb *ServiceBind) DeleteService(serviceName string) (err error)

func (*ServiceBind) GetServiceConfig

func (sb *ServiceBind) GetServiceConfig(serviceName string) (config ServiceConfig, err error)

func (*ServiceBind) GetServiceStatus

func (sb *ServiceBind) GetServiceStatus(serviceName string) (status uint32, err error)

func (*ServiceBind) MakeIoCtlRequest

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

func (*ServiceBind) NetServerGetInfo added in v0.3.8

func (sb *ServiceBind) NetServerGetInfo(host string, level int) (res *NetServerInfo, err error)

Send a NetServerGetInfo request to the server. Level can be 100, 101, or 102

func (*ServiceBind) NetSessionEnum added in v0.3.8

func (sb *ServiceBind) NetSessionEnum(clientName, username string, level int) (res *SessionEnum, err error)

Send a NetSessionEnum request to the server. Level can be 0, 1, 2, 10 or 502 But so far only level 0, 10 and 502 are implemented

func (*ServiceBind) NetShareEnumAll

func (sb *ServiceBind) NetShareEnumAll(host string) (res []NetShare, err error)

func (*ServiceBind) StartService

func (sb *ServiceBind) StartService(serviceName string, args []string) (err error)

type ServiceConfig

type ServiceConfig struct {
	ServiceType      string
	StartType        string
	ErrorControl     string
	BinaryPathName   string
	LoadOrderGroup   string
	TagId            uint32
	Dependencies     string
	ServiceStartName string
	DisplayName      string
}

type ServiceStatus

type ServiceStatus struct {
	ServiceType             uint32
	CurrentState            uint32
	ControlsAccepted        uint32
	Win32ExitCode           uint32
	ServiceSpecificExitCode uint32
	CheckPoint              uint32
	WaitHint                uint32
}
typedef struct {
    DWORD dwServiceType;
    DWORD dwCurrentState;
    DWORD dwControlsAccepted;
    DWORD dwWin32ExitCode;
    DWORD dwServiceSpecificExitCode;
    DWORD dwCheckPoint;
    DWORD dwWaitHint;
} SERVICE_STATUS,

*LPSERVICE_STATUS;

type SessionEnum added in v0.3.8

type SessionEnum struct {
	Level       uint32
	SessionInfo interface{}
}

type SessionInfoContainer0 added in v0.3.8

type SessionInfoContainer0 struct {
	EntriesRead uint32
	Buffer      []NetSessionInfo0
}

Could this be done in a better way? Perhaps with an interface?

type SessionInfoContainer1 added in v0.3.8

type SessionInfoContainer1 struct {
	EntriesRead uint32
	Buffer      []NetSessionInfo1
}

type SessionInfoContainer10 added in v0.3.8

type SessionInfoContainer10 struct {
	EntriesRead uint32
	Buffer      []NetSessionInfo10
}

type SessionInfoContainer2 added in v0.3.8

type SessionInfoContainer2 struct {
	EntriesRead uint32
	Buffer      []NetSessionInfo2
}

type SessionInfoContainer502 added in v0.3.8

type SessionInfoContainer502 struct {
	EntriesRead uint32
	Buffer      []NetSessionInfo502
}

type ShareInfo1

type ShareInfo1 struct {
	Name    string
	Type    uint32
	Comment string
}

type ShareInfoContainer1 added in v0.4.0

type ShareInfoContainer1 struct {
	EntriesRead uint32
	Buffer      []ShareInfo1
}
typedef struct _SHARE_INFO_1_CONTAINER {
  DWORD EntriesRead;
  [size_is(EntriesRead)] LPSHARE_INFO_1 Buffer;
} SHARE_INFO_1_CONTAINER;

type SyntaxId added in v0.4.0

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