dcerpc

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 11 Imported by: 3

Documentation

Overview

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	PacketTypeRequest  uint8 = 0
	PacketTypeResponse uint8 = 2
	PacketTypeBind     uint8 = 11
	PacketTypeBindAck  uint8 = 12
)

MSRPC Packet Types

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 (
	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 (
	ServiceNoChange uint32 = 0xffffffff
)

MS-SCMR Section 3.1.4.11 RChangeServiceConfigW

View Source
const (
	SrvSvcOpNetShareEnumAll uint16 = 15
)

MSRPC Server Service (srvsvc) Operations

Variables

View Source
var (
	MSRPCSvcCtlPipe                = "svcctl"
	MSRPCUuidSvcCtl                = "367ABB81-9844-35F1-AD32-98F038001003"
	MSRPCSvcCtlMajorVersion uint16 = 2
	MSRPCSvcCtlMinorVersion uint16 = 0
	MSRPCUuidSrvSvc                = "4B324FC8-1670-01D3-1278-5A47BF6EE188"
	MSRPCSrvSvcMajorVersion uint16 = 3
	MSRPCSrvSvcMinorVersion uint16 = 0
	MSRPCUuidNdr                   = "8a885d04-1ceb-11c9-9fe8-08002b104860" // NDR Transfer Syntax version 2.0

	ContextItemLen    = 44
	ContextResItemLen = 24
)
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 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

This section is empty.

Types

type BindReq

type BindReq struct {
	Header          // 16 Bytes
	MaxSendFragSize uint16
	MaxRecvFragSize uint16
	Association     uint32
	CtxCount        byte   `smb:"count:Context"`
	Reserved        byte   // Alignment
	Reserved2       uint16 // Alignment
	Context         *ContextItems
}

func NewBindReq

func NewBindReq(callId uint32, interface_uuid string, majorVersion, minorVersion uint16, transfer_uuid string) (*BindReq, error)

type BindRes

type BindRes struct {
	Header          // 16 Bytes
	MaxSendFragSize uint16
	MaxRecvFragSize uint16
	Association     uint32
	SecAddrLen      uint16 `smb:"len:SecAddr"`
	SecAddr         []byte
	Align           []byte `smb:"align:4"`
	CtxCount        byte   `smb:"count:Context"`
	Reserved        byte   // Alignment
	Reserved2       uint16 // Alignment
	Context         *ContextResItems
}

func NewBindRes

func NewBindRes() BindRes

type ContextItem

type ContextItem struct {
	Id               uint16
	Count            byte
	Reserved         byte
	AbstractUUID     []byte `smb:"fixed:16"`
	BindMajorVersion uint16
	BindMinVersion   uint16
	TransferUUID     []byte `smb:"fixed:16"`
	TransferVersion  uint32
}

func (*ContextItem) MarshalBinary

func (self *ContextItem) MarshalBinary(meta *encoder.Metadata) ([]byte, error)

func (*ContextItem) UnmarshalBinary

func (self *ContextItem) UnmarshalBinary(buf []byte, meta *encoder.Metadata) error

type ContextItems

type ContextItems []ContextItem

func (*ContextItems) MarshalBinary

func (s *ContextItems) MarshalBinary(meta *encoder.Metadata) ([]byte, error)

func (*ContextItems) UnmarshalBinary

func (s *ContextItems) UnmarshalBinary(buf []byte, meta *encoder.Metadata) error

type ContextResItem

type ContextResItem struct {
	Result          uint32 // Perhaps only uint16 with 2 bytes padding after?
	TransferUUID    []byte `smb:"fixed:16"`
	TransferVersion uint32
}

type ContextResItems

type ContextResItems []ContextResItem

func (*ContextResItems) MarshalBinary

func (s *ContextResItems) MarshalBinary(meta *encoder.Metadata) ([]byte, error)

func (*ContextResItems) UnmarshalBinary

func (s *ContextResItems) UnmarshalBinary(buf []byte, meta *encoder.Metadata) error
type Header struct {
	MajorVersion   byte
	MinorVersion   byte
	Type           byte
	Flags          byte
	Representation uint32
	FragLength     uint16
	AuthLength     uint16
	CallId         uint32
}

type Level

type Level struct {
	Lvl uint32
}

type NetShare

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

type NetShareCtr

type NetShareCtr struct {
	Ctr     uint32 // Type of Ctr struct in Pointer
	Pointer interface{}
}

type NetShareCtr1

type NetShareCtr1 struct {
	Count   uint32
	Info    NetShareInfo1
	Pointer []ShareInfo1
}

type NetShareEnumAllRequest

type NetShareEnumAllRequest struct {
	ServerName *UnicodeStr
	Level
	NetShareCtr
	MaxBuffer uint32
	ResumeHandle
}

func NewNetShareEnumAllRequest

func NewNetShareEnumAllRequest(serverName string) *NetShareEnumAllRequest

func (*NetShareEnumAllRequest) MarshalBinary

func (s *NetShareEnumAllRequest) MarshalBinary(meta *encoder.Metadata) ([]byte, error)

func (*NetShareEnumAllRequest) UnmarshalBinary

func (s *NetShareEnumAllRequest) UnmarshalBinary(buf []byte, meta *encoder.Metadata) error

type NetShareEnumAllResponse

type NetShareEnumAllResponse struct {
	Level        uint32
	NetShareCtr  *NetShareCtr
	TotalEntries uint32
	*ResumeHandle
	WindowsError uint32
}

func (*NetShareEnumAllResponse) MarshalBinary

func (s *NetShareEnumAllResponse) MarshalBinary(meta *encoder.Metadata) ([]byte, error)

func (*NetShareEnumAllResponse) UnmarshalBinary

func (s *NetShareEnumAllResponse) UnmarshalBinary(buf []byte, meta *encoder.Metadata) error

type NetShareInfo1

type NetShareInfo1 struct {
	ReferentId uint32
	MaxCount   uint32
}

type QueryServiceConfigW

type QueryServiceConfigW struct {
	ServiceType   uint32
	StartType     uint32
	ErrorControl  uint32
	ArrayMaxSizes []uint32 `smb:"count:6"` // The data after this is a complex structure
	// and I simplify parsing here by ignoring the preceeding array max counts before each array
	// item since this seems to be a Structure containing a Conformant and variying array.
	BinaryPathName   UnicodeStr
	LoadOrderGroup   UnicodeStr
	TagId            uint32
	Dependencies     UnicodeStr
	ServiceStartName UnicodeStr
	DisplayName      UnicodeStr
}

MS-SCMR Section 2.2.15

type RChangeServiceConfigWRequest

type RChangeServiceConfigWRequest struct {
	ServiceHandle    []byte `smb:"fixed:20"`
	ServiceType      uint32
	StartType        uint32
	ErrorControl     uint32
	BinaryPathName   *UnicodeStr
	LoadOrderGroup   *UnicodeStr
	TagId            uint32
	Dependencies     *UnicodeStr // Not sure this is the correct type
	DependSize       uint32
	ServiceStartName *UnicodeStr
	Password         *UnicodeStr // Not sure this is the correct type
	PwSize           uint32
	DisplayName      *UnicodeStr
}

NOTE If A value is empty e.g. NULL, that is represented by 4 null bytes e.g., Don't specifying a BinaryPathName? Just put 0x00 0x00 0x00 0x00 as a null pointer

type RChangeServiceConfigWResponse

type RChangeServiceConfigWResponse struct {
	TagId      uint32
	ReturnCode uint32
}

type RCloseServiceHandleReq

type RCloseServiceHandleReq struct {
	ServiceHandle []byte `smb:"fixed:20"`
}

type RCloseServiceHandleRes

type RCloseServiceHandleRes struct {
	ContextHandle []byte `smb:"fixed:20"`
	ReturnCode    uint32
}

type RControlServiceRequest

type RControlServiceRequest struct {
	ServiceHandle []byte `smb:"fixed:20"`
	Control       uint32
}

type RControlServiceResponse

type RControlServiceResponse struct {
	ServiceStatus
	ReturnValue uint32
}

type RCreateServiceRequest added in v0.2.0

type RCreateServiceRequest struct {
	SCContextHandle  []byte `smb:"fixed:20"`
	ServiceName      *UnicodeStr
	DisplayName      *UnicodeStr
	DesiredAccess    uint32
	ServiceType      uint32
	StartType        uint32
	ErrorControl     uint32
	BinaryPathName   *UnicodeStr
	LoadOrderGroup   *UnicodeStr
	TagId            uint32
	Dependencies     *UnicodeStr
	DependSize       uint32
	ServiceStartName *UnicodeStr
	Password         *UnicodeStr
	PwSize           uint32
}

type RCreateServiceResponse added in v0.2.0

type RCreateServiceResponse struct {
	TagId         uint32
	ContextHandle []byte `smb:"fixed:20"`
	ReturnCode    uint32
}

type RDeleteServiceRequest added in v0.2.0

type RDeleteServiceRequest struct {
	ServiceHandle []byte `smb:"fixed:20"`
}

type RDeleteServiceResponse added in v0.2.0

type RDeleteServiceResponse struct {
	ReturnCode uint32
}

type ROpenSCManagerWRequest

type ROpenSCManagerWRequest struct {
	MachineName   UnicodeStr
	DatabaseName  UnicodeStr
	DesiredAccess uint32
}

type ROpenSCManagerWResponse

type ROpenSCManagerWResponse struct {
	ContextHandle []byte `smb:"fixed:20"`
	ReturnCode    uint32
}

type ROpenServiceWRequest

type ROpenServiceWRequest struct {
	SCContextHandle []byte `smb:"fixed:20"`
	ServiceName     *UnicodeStr
	DesiredAccess   uint32
}

type ROpenServiceWResponse

type ROpenServiceWResponse struct {
	ContextHandle []byte `smb:"fixed:20"`
	ReturnCode    uint32
}

type RQueryServiceConfigWRequest

type RQueryServiceConfigWRequest struct {
	ServiceHandle []byte `smb:"fixed:20"`
	BufSize       uint32
}

type RQueryServiceConfigWResponse

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

func (*RQueryServiceConfigWResponse) MarshalBinary

func (self *RQueryServiceConfigWResponse) MarshalBinary(meta *encoder.Metadata) ([]byte, error)

func (*RQueryServiceConfigWResponse) UnmarshalBinary

func (self *RQueryServiceConfigWResponse) UnmarshalBinary(buf []byte, meta *encoder.Metadata) error

type RQueryServiceStatusRequest

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

type RQueryServiceStatusResponse

type RQueryServiceStatusResponse struct {
	ServiceStatus
	ReturnCode uint32
}

type RStartServiceWRequest

type RStartServiceWRequest struct {
	ServiceHandle []byte `smb:"fixed:20"`
	Argc          uint32 `smb:"count:Argv"`
	Argv          []UnicodeStr
}

func (*RStartServiceWRequest) MarshalBinary added in v0.2.8

func (s *RStartServiceWRequest) MarshalBinary(meta *encoder.Metadata) ([]byte, error)

func (*RStartServiceWRequest) UnmarshalBinary added in v0.2.8

func (self *RStartServiceWRequest) UnmarshalBinary(buf []byte, meta *encoder.Metadata) error

type RequestReq

type RequestReq struct {
	Header    // 16 bytes
	AllocHint uint32
	ContextId uint16
	Opnum     uint16
	Buffer    []byte // Always start at an 8-byte boundary
}

func NewRequestReq

func NewRequestReq(callId uint32, op uint16) (*RequestReq, error)

type RequestRes

type RequestRes struct {
	Header             // 16 bytes
	AllocHint   uint32 `smb:"len:Buffer"` // Not sure this field is guaranteed to contain buffer length
	ContextId   uint16
	CancelCount byte
	Reserved    byte
	Buffer      []byte // Always start at an 8-byte boundary
}

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, 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, 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) 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
}

type ShareInfo1

type ShareInfo1 struct {
	Name    *UnicodeStr
	Type    uint32
	Comment *UnicodeStr
}

type ShareName

type ShareName struct {
	UnicodeStr
}

type TotalEntries

type TotalEntries struct {
	Padd []byte `smb:"align:4"`
	Lvl  uint32
}

type UnicodeStr

type UnicodeStr struct {
	ReferentIdPtr uint32 `smb:"omitempty:0"`
	MaxCount      uint32
	Offset        uint32 // Defaults to 0
	ActualCount   uint32
	EncodedString []byte //utf16le encoded string
	Padd          []byte `smb:"align:4"`
}

func NewUnicodeStr

func NewUnicodeStr(referentId uint32, s string) *UnicodeStr

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