Documentation
¶
Index ¶
- Variables
- func IsNotFound(err error) bool
- func IsSharingViolation(err error) bool
- type Client
- func (c *Client) Cat(file string) (string, error)
- func (c *Client) Cd(dir string) error
- func (c *Client) Close()
- func (c *Client) Connect() error
- func (c *Client) EnumerateSnapshots() ([]string, error)
- func (c *Client) Get(remoteFile, localFile string) error
- func (c *Client) GetCurrentPath() string
- func (c *Client) GetDNSHostName() string
- func (c *Client) GetDNSTreeName() string
- func (c *Client) GetSessionKey() []byte
- func (c *Client) ListShares() ([]string, error)
- func (c *Client) Ls(dir string) ([]os.FileInfo, error)
- func (c *Client) Mget(pattern string) error
- func (c *Client) Mkdir(dir string) error
- func (c *Client) OpenPipe(name string) (*smb2.File, error)
- func (c *Client) OpenPipeWithAccess(name string, access PipeAccess) (*smb2.File, error)
- func (c *Client) Put(localFile, remoteFile string) error
- func (c *Client) Rename(oldPath, newPath string) error
- func (c *Client) Rm(file string) error
- func (c *Client) Rmdir(dir string) error
- func (c *Client) Tree(root string, fn TreeWalkFunc) error
- func (c *Client) UseShare(name string) error
- type KerberosInitiator
- type PipeAccess
- type TreeWalkFunc
Constants ¶
This section is empty.
Variables ¶
var OIDKerberos = asn1.ObjectIdentifier{1, 2, 840, 113554, 1, 2, 2}
OID for Kerberos V5
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err means the SMB target file or path does not exist. The smb2 layer translates STATUS_OBJECT_NAME_NOT_FOUND and STATUS_OBJECT_PATH_NOT_FOUND to os.ErrNotExist in conn.go before wrapping, so most call sites see the sentinel rather than an *smb2.ResponseError. We accept both forms.
func IsSharingViolation ¶
IsSharingViolation reports whether err wraps STATUS_SHARING_VIOLATION. The smb2 client wraps server responses in *os.PathError → *smb2.ResponseError, so substring matching on err.Error() is unreliable.
Types ¶
type Client ¶
type Client struct {
Session *smb2.Session
Target session.Target
Creds *session.Credentials
// contains filtered or unexported fields
}
func (*Client) EnumerateSnapshots ¶
EnumerateSnapshots returns the VSS shadow-copy tokens available on the currently selected share, formatted as `@GMT-YYYY.MM.DD-HH.MM.SS`. Requires a share to be selected via UseShare. Returns an empty slice if no snapshots exist. Implements the two-call size-probe pattern from MS-SMB2 2.2.32.
func (*Client) GetCurrentPath ¶
func (*Client) GetDNSHostName ¶
GetDNSHostName returns the server's DNS hostname from the NTLM challenge.
func (*Client) GetDNSTreeName ¶
GetDNSTreeName returns the forest DNS name from the NTLM challenge.
func (*Client) GetSessionKey ¶
GetSessionKey returns the SMB session key used for signing/encryption.
func (*Client) ListShares ¶
func (*Client) OpenPipeWithAccess ¶
OpenPipeWithAccess opens a named pipe with specified access mode.
type KerberosInitiator ¶
type KerberosInitiator struct {
KrbClient *kerberos.Client
TargetSPN string
// contains filtered or unexported fields
}
func (*KerberosInitiator) AcceptSecContext ¶
func (k *KerberosInitiator) AcceptSecContext(sc []byte) ([]byte, error)
func (*KerberosInitiator) InitSecContext ¶
func (k *KerberosInitiator) InitSecContext() ([]byte, error)
func (*KerberosInitiator) OID ¶
func (k *KerberosInitiator) OID() asn1.ObjectIdentifier
func (*KerberosInitiator) SessionKey ¶
func (k *KerberosInitiator) SessionKey() []byte
func (*KerberosInitiator) Sum ¶
func (k *KerberosInitiator) Sum(b []byte) []byte
type PipeAccess ¶
type PipeAccess int
PipeAccess specifies the access mode for named pipes
const ( PipeAccessReadWrite PipeAccess = iota // Read and write (default) PipeAccessRead // Read only (for stdout/stderr) PipeAccessWrite // Write only (for stdin) )