Documentation ¶
Index ¶
- Constants
- Variables
- type CancelReq
- type ChangeNotifyReq
- type ChangeNotifyRes
- type CloseReq
- type CloseRes
- type CreateReq
- type CreateRes
- type EchoReq
- type EchoRes
- type FileID
- type FlushReq
- type FlushRes
- type Header
- type IoctlReq
- type IoctlRes
- type LeaseBreakAck
- type LeaseBreakNotification
- type LeaseBreakRes
- type LockElement
- type LockReq
- type LockRes
- type LogoffReq
- type LogoffRes
- type NegotiateContext
- type NegotiateReq
- type NegotiateReqExt
- type NegotiateRes
- type OplockBreakAck
- type OplockBreakNotification
- type OplockBreakRes
- type Options
- type QueryDirectoryReq
- type QueryDirectoryRes
- type QueryInfoReq
- type QueryInfoRes
- type ReadReq
- type ReadRes
- type Session
- func (s *Session) Close()
- func (s *Session) CloseFile(tree string) error
- func (s *Session) Debug(msg string, err error)
- func (s *Session) Logoff() error
- func (s *Session) NegotiateProtocol() error
- func (s *Session) NewCloseReq(tree string) (CloseReq, error)
- func (s *Session) NewCreateReq(tree string, name string) (CreateReq, error)
- func (s *Session) NewLogoffReq() (LogoffReq, error)
- func (s *Session) NewNegotiateReq() NegotiateReq
- func (s *Session) NewReadReq(tree string) (ReadReq, error)
- func (s *Session) NewSessionSetup1Req() (SessionSetup1Req, error)
- func (s *Session) NewSessionSetup2Req() (SessionSetup2Req, error)
- func (s *Session) NewTreeConnectReq(name string) (TreeConnectReq, error)
- func (s *Session) NewTreeDisconnectReq(treeId uint32) (TreeDisconnectReq, error)
- func (s *Session) OpenFile(tree, name string) error
- func (s *Session) ReadFile(tree string) error
- func (s *Session) TreeConnect(name string) error
- func (s *Session) TreeDisconnect(name string) error
- type SessionSetup1Req
- type SessionSetup1Res
- type SessionSetup2Req
- type SessionSetup2Res
- type SetInfoReq
- type SetInfoRes
- type TreeConnectReq
- type TreeConnectRes
- type TreeDisconnectReq
- type TreeDisconnectRes
- type WriteReq
- type WriteRes
Constants ¶
View Source
const ( CommandNegotiate uint16 = iota CommandSessionSetup CommandLogoff CommandTreeConnect CommandTreeDisconnect CommandCreate CommandClose CommandFlush CommandRead CommandWrite CommandLock CommandIOCtl CommandCancel CommandEcho CommandQueryDirectory CommandChangeNotify CommandQueryInfo CommandSetInfo CommandOplockBreak )
View Source
const ( SecurityModeSigningEnabled uint16 SecurityModeSigningRequired )
View Source
const ()
View Source
const ()
View Source
const ()
View Source
const ( Smb2OplockLevelNone uint8 = 0x00 Smb2OplockLevelII uint8 = 0x01 Smb2OplockLevelExclusive uint8 = 0x08 Smb2OplockLevelBatch uint8 = 0x09 Smb2OplockLevelLease uint8 = 0xFF )
RequestedOplockLevel
View Source
const ( Anonymous uint32 = iota Identification Impersonation Delegate )
ImpersonationLeve
View Source
const ( FileReadData uint32 = 0x00000001 FileWriteData uint32 = 0x00000002 FileAppendData uint32 = 0x00000004 FileReadEa uint32 = 0x00000008 FileWriteEa uint32 = 0x00000010 FileDeleteChild uint32 = 0x00000040 FileExecute uint32 = 0x00000020 FileReadAttributes uint32 = 0x00000080 FileWriteAttributes uint32 = 0x00000100 Delete uint32 = 0x00010000 ReadControl uint32 = 0x00020000 WriteDac uint32 = 0x00040000 WriteOwner uint32 = 0x00080000 Synchronize uint32 = 0x00100000 AccessSystemSecurity uint32 = 0x01000000 MaxinumAllowed uint32 = 0x02000000 GenericAll uint32 = 0x10000000 GenericExecute uint32 = 0x20000000 GenericWrite uint32 = 0x40000000 GenericRead uint32 = 0x80000000 )
DesiredAccess
View Source
const ( FileAttributeArchive uint32 = 0x00000020 FileAttributeCompressed uint32 = 0x00000800 FileAttributeDirectory uint32 = 0x00000010 FileAttributeEncrypted uint32 = 0x00004000 FileAttributeHidden uint32 = 0x00000002 FileAttributeNormal uint32 = 0x00000080 FileAttributeNotContentIndexed uint32 = 0x00002000 FileAttributeOffline uint32 = 0x00001000 FileAttributeReadonly uint32 = 0x00000001 FileAttributeReparsePoint uint32 = 0x00000400 FileAttributeSparseFile uint32 = 0x00000200 FileAttributeSystem uint32 = 0x00000004 FileAttributeTemporary uint32 = 0x00000100 FileAttributeIntegrityStream uint32 = 0x00008000 FileAttributeNoScrubData uint32 = 0x00020000 )
FileAttributes
View Source
const ()
ShareAccess
View Source
const ( FileSupersede uint32 = iota FileOpen FileCreate FileOpenIf FileOverwrite FileOverwriteIf )
CreateDisposition
View Source
const ( FileDirectoryFile uint32 = 0x00000001 FileWriteThrough uint32 = 0x00000002 FileSequentialOnly uint32 = 0x00000004 FileNoIntermediateBuffering uint32 = 0x00000008 FileSynchronousIoAlert uint32 = 0x00000010 FileSynchronousIoNonalert uint32 = 0x00000020 FileNonDirectoryFile uint32 = 0x00000040 FileCompleteIfOplocked uint32 = 0x00000100 FileNoEaKnowledge uint32 = 0x00000200 FileRandomAccess uint32 = 0x00000800 FileDeleteOnClose uint32 = 0x00001000 FileOpenByFileId uint32 = 0x00002000 FileOpenForBackupIntent uint32 = 0x00004000 FileNoCompression uint32 = 0x00008000 FileOpenRemoteInstance uint32 = 0x00000400 FileOpenRequireingOplock uint32 = 0x00010000 FileDisallowExclusive uint32 = 0x00020000 FileReserveOpfilter uint32 = 0x00100000 FileOpenReparsePoint uint32 = 0x00200000 FileOpenNoRecall uint32 = 0x00400000 FileOpenForFreeSpaceQuery uint32 = 0x00800000 )
CreateOptions
View Source
const ( Smb2ChannelNone uint32 = iota Smb2ChannelRdmaV1 Smb2ChannelRdmaV1Invalidate )
Channel
View Source
const DialectSmb2_ALL = 0x02FF
View Source
const DialectSmb_2_0_2 = 0x0202
View Source
const DialectSmb_2_1 = 0x0210
View Source
const DialectSmb_3_0 = 0x0300
View Source
const DialectSmb_3_0_2 = 0x0302
View Source
const DialectSmb_3_1_1 = 0x0311
View Source
const ProtocolSmb = "\xFFSMB"
View Source
const ProtocolSmb2 = "\xFESMB"
View Source
const StatusInvalidParameter = 0xc000000d
View Source
const StatusLogonFailure = 0xc000006d
View Source
const StatusMoreProcessingRequired = 0xc0000016
View Source
const StatusOk = 0x00000000
View Source
const StatusUserSessionDeleted = 0xc0000203
Variables ¶
View Source
var CommandStr = map[uint16]string{ CommandNegotiate: "Negotiate", CommandSessionSetup: "SessionSetup", CommandLogoff: "Logoff", CommandTreeConnect: "TreeConnect", CommandTreeDisconnect: "TreeDisconnect", CommandCreate: "Create", CommandClose: "Close", CommandFlush: "Flush", CommandRead: "Read", CommandWrite: "Write", CommandLock: "Lock", CommandIOCtl: "IOCtl", CommandCancel: "Cancel", CommandEcho: "Echo", CommandQueryDirectory: "QueryDirectory", CommandChangeNotify: "ChangeNotify", CommandQueryInfo: "QueryInfo", CommandSetInfo: "SetInfo", CommandOplockBreak: "OplockBreak", }
View Source
var StatusMap = map[uint32]string{ StatusOk: "OK", StatusMoreProcessingRequired: "More Processing Required", StatusInvalidParameter: "Invalid Parameter", StatusLogonFailure: "Logon failed", StatusUserSessionDeleted: "User session deleted", }
Functions ¶
This section is empty.
Types ¶
type ChangeNotifyReq ¶
type ChangeNotifyReq struct { Header StructureSize uint16 Flags uint16 OutputBufferLength uint32 FileID CompletionFilter uint32 Reserved uint32 }
change notify request&response
type ChangeNotifyRes ¶
type CloseReq ¶
type CloseReq struct { Header StructureSize uint16 Flags uint16 Reserved uint32 FileID `smb:"fixed:16"` }
close file request&response
type CreateReq ¶
type CreateReq struct { Header StructureSize uint16 SecurityFlags uint8 RequestedOplockLevel uint8 ImpersonationLevel uint32 SmbCreateFlags uint64 Reserved uint64 DesiredAccess uint32 FileAttributes uint32 CreateDisposition uint32 CreateOptions uint32 NameOffset uint16 NameLength uint16 CreateContextsOffset uint32 CreateContextsLength uint32 Buffer []byte }
create file request&response
type CreateRes ¶
type CreateRes struct { Header StructureSize uint16 OplockLevel uint8 Flags uint8 CreateAction uint32 CreationTime uint64 LastAccessTime uint64 LastWriteTime uint64 ChangeTime uint64 AllocationSize uint64 EndofFile uint64 FileAttributes uint32 Reserved2 uint32 FileID `smb:"fixed:16"` CreateContextsOffset uint32 `smb:"offset:Contexts"` CreateContextsLength uint32 `smb:"len:Contexts"` Contexts []byte }
type IoctlReq ¶
type IoctlReq struct { Header StructureSize uint16 Reserved uint16 CtlCode uint32 FileID InputOffset uint32 InputCount uint32 MaxInputResponse uint32 OutputOffset uint32 OutputCount uint32 MaxOutputResponse uint32 Flags uint32 Reserved2 uint32 Buffer []byte }
ioctl request&response
type LeaseBreakAck ¶
type LeaseBreakNotification ¶
type LeaseBreakRes ¶
type LockElement ¶
type LockReq ¶
type LockReq struct { Header StructureSize uint16 LockCount uint16 `smb:"count:Locks"` LockSequence uint32 `LSN: 4bit; LockSequenceIndex: 28bit` FileID Locks []LockElement }
lock request&response
type NegotiateContext ¶
type NegotiateReq ¶
type NegotiateReqExt ¶
type NegotiateReqExt struct { Header StructureSize uint16 DialectCount uint16 `smb:"count:Dialects"` SecurityMode uint16 Reserved uint16 Capabilities uint32 ClientGuid []byte `smb:"fixed:16"` NegotiateContextOffset uint16 `smb:"offset:NegotiateContextList"` NegotiateContextCount uint8 `smb:"count:NegotiateContextList"` Reserved2 uint8 Dialects []uint16 //used for 8 byte aligned Padding []byte NegotiateContextList []NegotiateContext }
if dialects contain 0x0311, use it
type NegotiateRes ¶
type NegotiateRes struct { Header StructureSize uint16 SecurityMode uint16 DialectRevision uint16 Reserved uint16 ServerGuid []byte `smb:"fixed:16"` Capabilities uint32 MaxTransactSize uint32 MaxReadSize uint32 MaxWriteSize uint32 SystemTime uint64 ServerStartTime uint64 SecurityBufferOffset uint16 `smb:"offset:SecurityBlob"` SecurityBufferLength uint16 `smb:"len:SecurityBlob"` Reserved2 uint32 SecurityBlob *gss.NegTokenInit }
func NewNegotiateRes ¶
func NewNegotiateRes() NegotiateRes
type OplockBreakAck ¶
type OplockBreakAck struct { Header StructureSize uint16 OplockLevel uint8 Reserved uint8 Reserved2 uint32 FileID }
oplock break ack by client
type OplockBreakNotification ¶
type OplockBreakNotification struct { Header StructureSize uint16 OplockLevel uint8 Reserved uint8 Reserved2 uint32 FileID }
oplock break notify by server
type OplockBreakRes ¶
type OplockBreakRes struct { Header StructureSize uint16 OplockLevel uint8 Reserved uint8 Reserved2 uint32 FileID }
oplock break res by server
type QueryDirectoryReq ¶
type QueryDirectoryReq struct { Header StructureSize uint16 FileInformationClass uint8 Flags uint8 FileIndex uint32 FileID FileNameOffset uint16 FileNameLength uint16 OutputBufferLength uint32 Pattern []byte }
query directory request&response
type QueryDirectoryRes ¶
type QueryInfoReq ¶
type QueryInfoReq struct { Header StructureSize uint16 InfoType uint8 FileInfoClass uint8 OutputBufferLength uint32 InputBufferOffset uint16 Reserved uint16 InputBufferLength uint32 AdditionalInformation uint32 Flags uint32 FileID InputBuffer []byte }
query info request&response
type QueryInfoRes ¶
type ReadReq ¶
type ReadReq struct { Header StructureSize uint16 Padding uint8 Flags uint8 Length uint32 Offset uint64 FileID `smb:"fixed:16"` MinimumCount uint32 Channel uint32 RemainingBytes uint32 ReadChannelInfoOffset uint16 `smb:"offset:ChannelInfo"` ReadChannelInfoLength uint16 `smb:"len:ChannelInfo"` ChannelInfo []byte }
read file request&response
type Session ¶
type Session struct { IsSigningRequired bool IsAuthenticated bool FileId FileID // contains filtered or unexported fields }
func (*Session) NegotiateProtocol ¶
func (*Session) NewCreateReq ¶
open a new file or directory using create
func (*Session) NewLogoffReq ¶
func (*Session) NewNegotiateReq ¶
func (s *Session) NewNegotiateReq() NegotiateReq
func (*Session) NewSessionSetup1Req ¶
func (s *Session) NewSessionSetup1Req() (SessionSetup1Req, error)
func (*Session) NewSessionSetup2Req ¶
func (s *Session) NewSessionSetup2Req() (SessionSetup2Req, error)
func (*Session) NewTreeConnectReq ¶
func (s *Session) NewTreeConnectReq(name string) (TreeConnectReq, error)
NewTreeConnectReq creates a new TreeConnect message and accepts the share name as input.
func (*Session) NewTreeDisconnectReq ¶
func (s *Session) NewTreeDisconnectReq(treeId uint32) (TreeDisconnectReq, error)
func (*Session) TreeConnect ¶
func (*Session) TreeDisconnect ¶
type SessionSetup1Req ¶
type SessionSetup1Res ¶
type SessionSetup1Res struct { Header StructureSize uint16 Flags uint16 SecurityBufferOffset uint16 `smb:"offset:SecurityBlob"` SecurityBufferLength uint16 `smb:"len:SecurityBlob"` SecurityBlob *gss.NegTokenResp }
func NewSessionSetup1Res ¶
func NewSessionSetup1Res() (SessionSetup1Res, error)
type SessionSetup2Req ¶
type SessionSetup2Res ¶
type SessionSetup2Res struct { Header StructureSize uint16 Flags uint16 SecurityBufferOffset uint16 `smb:"offset:SecurityBlob"` SecurityBufferLength uint16 `smb:"len:SecurityBlob"` SecurityBlob *gss.NegTokenResp }
func NewSessionSetup2Res ¶
func NewSessionSetup2Res() (SessionSetup2Res, error)
type SetInfoReq ¶
type SetInfoReq struct { Header StructureSize uint16 InfoType uint8 FileInfoClass uint8 BufferLength uint32 BufferOffset uint16 Reserved uint16 AdditionalInformation uint32 FileID Buffer []byte }
set info request&response
type SetInfoRes ¶
type TreeConnectReq ¶
type TreeConnectRes ¶
type TreeDisconnectReq ¶
type TreeDisconnectRes ¶
Click to show internal directories.
Click to hide internal directories.