Generated from Manticore v1.1.6 • 388 packages. View on pkg.go.dev

mssrvs

import "github.com/TheManticoreProject/Manticore/network/dcerpc/ms-protocols/ms-srvs"

Package mssrvs implements high-level MS-SRVS (Server Service Remote Protocol) workflows over the srvsvc DCE/RPC interface (4b324fc8-1670-01d3-1278-5a47bf6ee188 v3.0), carried over the \srvsvc named pipe on the IPC$ tree.

It is the protocol layer above the interface: callers hold a connected and authenticated SMB v1 client and call the convenience methods here (ListShares, ListSessions, GetServerInfo), which bind to srvsvc, issue the underlying NetrShareEnum / NetrSessionEnum / NetrServerGetInfo calls, and project the NDR containers and unions into friendly Go structs. The smbclient-ng tool’s shares / who / info commands are the intended consumers.

References:

  • [MS-SRVS] 3.1.4.8 NetrShareEnum, 3.1.4.6 NetrSessionEnum, 3.1.4.17 NetrServerGetInfo
  • [MS-RPCE] DCE/RPC over SMB named pipes

Index

Constants

MaxPreferredLength is passed as the preferred maximum reply length of the Netr*Enum calls. 0xFFFFFFFF asks the server to return every entry in a single response, so no resume-handle paging is needed; this matches common client enumeration usage.

const MaxPreferredLength uint32 = 0xFFFFFFFF

type Client

Client exposes MS-SRVS workflows over an established SMB session. The supplied dialer MUST be backed by a client that is connected, authenticated, and tree-connected to IPC$ before any method is called.

MS-SRVS is stateless: srvsvc calls are mutually independent, so the client binds a fresh \srvsvc pipe per workflow (a fault on one cannot desync the next) rather than holding a persistent association. It therefore satisfies msproto.Protocol but not msproto.Session.

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

func New

func New(dialer PipeDialer) *Client

New returns an MS-SRVS client over the given pipe dialer (typically a *network/smb/client.Client).

func (*Client) Close

func (c *Client) Close() error

Close releases resources held by the client. MS-SRVS holds no persistent association — each workflow binds and tears down its own pipe — so there is nothing to release and Close is a no-op that always returns nil. It exists to satisfy msproto.Protocol.

func (*Client) GetServerInfo

func (c *Client) GetServerInfo() (*ServerInfo, error)

GetServerInfo queries the server’s configuration via NetrServerGetInfo at info level 101 ([MS-SRVS] 3.1.4.17). It binds a fresh \srvsvc pipe for the call.

func (*Client) Interface

func (c *Client) Interface() syntax.SyntaxID

Interface reports the DCE/RPC abstract syntax MS-SRVS speaks (srvsvc v3.0).

func (*Client) ListSessions

func (c *Client) ListSessions() ([]SessionInfo, error)

ListSessions enumerates the active sessions on the server via NetrSessionEnum at info level 10 ([MS-SRVS] 3.1.4.6). It binds a fresh \srvsvc pipe for the call. The server typically requires administrative rights to enumerate sessions.

func (*Client) ListShares

func (c *Client) ListShares() ([]ShareInfo, error)

ListShares enumerates the shares exported by the server via NetrShareEnum at info level 1 ([MS-SRVS] 3.1.4.8). It binds a fresh \srvsvc pipe for the call.

type PipeDialer

PipeDialer is the SMB capability MS-SRVS needs: opening a named-pipe transport over an established session. It is an alias of msproto.PipeDialer, shared with the other named-pipe protocols; network/smb/client.Client satisfies it.

type PipeDialer = msproto.PipeDialer

type ServerInfo

ServerInfo is the configuration of a server: platform id, name, OS version, SV_TYPE_* flags, and comment ([MS-SRVS] 2.2.4.41 SERVER_INFO_101).

type ServerInfo struct {
    PlatformID   uint32
    Name         string
    VersionMajor uint32
    VersionMinor uint32
    Type         uint32
    Comment      string
}

type SessionInfo

SessionInfo is an active session on the server: the connecting client’s name, the authenticated user, and the active/idle times in seconds ([MS-SRVS] 2.2.4.15 SESSION_INFO_10).

type SessionInfo struct {
    ClientName string
    UserName   string
    ActiveSecs uint32
    IdleSecs   uint32
}

type ShareInfo

ShareInfo is a shared resource exported by the server: its name, STYPE_* type flags, and comment ([MS-SRVS] 2.2.4.23 SHARE_INFO_1). Type carries the raw STYPE_* value, including the STYPE_SPECIAL (0x80000000) and STYPE_TEMPORARY (0x40000000) high bits.

type ShareInfo struct {
    Name    string
    Type    uint32
    Comment string
}