dcerpc

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 11 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 (
	SrvSvcOpNetrSessionEnum  uint16 = 12
	SrvSvcOpNetShareEnumAll  uint16 = 15
	SrvSvcOpNetServerGetInfo uint16 = 21
)

MSRPC Server Service (srvsvc) Operations

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 (
	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 (
	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 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

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

type NetServerGetInfoRequest struct {
	ServerName *UnicodeStr
	Level      uint32
}

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(meta *encoder.Metadata) ([]byte, error)

func (*NetServerGetInfoRequest) UnmarshalBinary added in v0.3.8

func (self *NetServerGetInfoRequest) UnmarshalBinary(buf []byte, meta *encoder.Metadata) 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(meta *encoder.Metadata) ([]byte, error)

func (*NetServerGetInfoResponse) UnmarshalBinary added in v0.3.8

func (self *NetServerGetInfoResponse) UnmarshalBinary(buf []byte, meta *encoder.Metadata) 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 {
	// contains filtered or unexported fields
}

type NetServerInfo101 added in v0.3.8

type NetServerInfo101 struct {
	NetServerInfo100
	// contains filtered or unexported fields
}

type NetServerInfo102 added in v0.3.8

type NetServerInfo102 struct {
	NetServerInfo101
	// contains filtered or unexported fields
}

type NetSessionEnumRequest added in v0.3.8

type NetSessionEnumRequest struct {
	ServerName         *UnicodeStr
	ClientName         *UnicodeStr
	UserName           *UnicodeStr
	Info               SessionEnum
	PreferredMaxLength uint32
	ResumeHandle       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(meta *encoder.Metadata) ([]byte, error)

func (*NetSessionEnumRequest) UnmarshalBinary added in v0.3.8

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

type NetSessionEnumResponse added in v0.3.8

type NetSessionEnumResponse struct {
	Info         SessionEnum
	TotalEntries uint32
	ResumeHandle ResumeHandle
	WindowsError uint32
}

Annoying to unmarshal because of NDR synax where lots and lots of ReferentId Ptrs are part of the serialized data, and elements of the structs are NOT serialized in order.

func (*NetSessionEnumResponse) MarshalBinary added in v0.3.8

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

func (*NetSessionEnumResponse) UnmarshalBinary added in v0.3.8

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

type NetSessionInfo0 added in v0.3.8

type NetSessionInfo0 struct {
	Cname *UnicodeStr
}

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

type NetSessionInfo1 added in v0.3.8

type NetSessionInfo1 struct {
	NetSessionInfo0
	Username  *UnicodeStr
	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 *UnicodeStr
	Time     uint32
	IdleTime uint32
}

type NetSessionInfo2 added in v0.3.8

type NetSessionInfo2 struct {
	NetSessionInfo1
	ClType *UnicodeStr
}

type NetSessionInfo502 added in v0.3.8

type NetSessionInfo502 struct {
	NetSessionInfo2
	Transport *UnicodeStr
}

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

type ServerInfo100 struct {
	PlatformId uint32
	Name       string
}

type ServerInfo101 added in v0.3.8

type ServerInfo101 struct {
	ServerInfo100
	VersionMajor uint32
	VersionMinor uint32
	SvType       uint32
	Comment      string
}

type ServerInfo102 added in v0.3.8

type ServerInfo102 struct {
	ServerInfo101
	Users    uint32
	Disc     int32
	Hidden   bool
	Announce uint32
	Anndelta uint32
	Licences uint32
	Userpath string
}

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

type SessionEnum added in v0.3.8

type SessionEnum struct {
	Level       uint32
	SessionInfo interface{}
}

type SessionInfo0 added in v0.3.8

type SessionInfo0 struct {
	Cname string
}

type SessionInfo1 added in v0.3.8

type SessionInfo1 struct {
	SessionInfo0
	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 SessionInfo10 added in v0.3.8

type SessionInfo10 struct {
	SessionInfo0
	Username string
	Time     uint32
	IdleTime uint32
}

type SessionInfo2 added in v0.3.8

type SessionInfo2 struct {
	SessionInfo1
	ClType string
}

type SessionInfo502 added in v0.3.8

type SessionInfo502 struct {
	SessionInfo2
	Transport string
}

type SessionInfoContainer added in v0.3.8

type SessionInfoContainer struct {
	EntriesRead uint32
	Buffer      []interface{}
}

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

type SessionInfoContainer0 added in v0.3.8

type SessionInfoContainer0 struct {
	EntriesRead uint32
	Buffer      []NetSessionInfo0
}

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    *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

func (*UnicodeStr) MarshalBinary added in v0.3.8

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

func (*UnicodeStr) UnmarshalBinary added in v0.3.8

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

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