smb

package
v0.0.0-...-9842712 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0, ISC, MIT Imports: 10 Imported by: 0

Documentation

Index

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 (
	ShareTypeDisk byte
	ShareTypePipe
	ShareTypePrint
)
View Source
const (
	ShareFlagManualCaching            uint32 = 0x00000000
	ShareFlagAutoCaching              uint32 = 0x00000010
	ShareFlagVDOCaching               uint32 = 0x00000020
	ShareFlagNoCaching                uint32 = 0x00000030
	ShareFlagDFS                      uint32 = 0x00000001
	ShareFlagDFSRoot                  uint32 = 0x00000002
	ShareFlagRestriceExclusiveOpens   uint32 = 0x00000100
	ShareFlagForceSharedDelete        uint32 = 0x00000200
	ShareFlagAllowNamespaceCaching    uint32 = 0x00000400
	ShareFlagAccessBasedDirectoryEnum uint32 = 0x00000800
	ShareFlagForceLevelIIOplock       uint32 = 0x00001000
	ShareFlagEnableHashV1             uint32 = 0x00002000
	ShareFlagEnableHashV2             uint32 = 0x00004000
	ShareFlagEncryptData              uint32 = 0x00008000
)
View Source
const (
	ShareCapDFS                    uint32 = 0x00000008
	ShareCapContinuousAvailability uint32 = 0x00000010
	ShareCapScaleout               uint32 = 0x00000020
	ShareCapCluster                uint32 = 0x00000040
	ShareCapAsymmetric             uint32 = 0x00000080
)
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 StatusMap = map[uint32]string{
	StatusOk:                     "OK",
	StatusMoreProcessingRequired: "More Processing Required",
	StatusInvalidParameter:       "Invalid Parameter",
	StatusLogonFailure:           "Logon failed",
	StatusUserSessionDeleted:     "User session deleted",
}

Functions

func GetSMBBanner

func GetSMBBanner(logStruct *SMBLog, conn net.Conn) (err error)

Types

type Header struct {
	ProtocolID    []byte `smb:"fixed:4"`
	StructureSize uint16
	CreditCharge  uint16
	Status        uint32
	Command       uint16
	Credits       uint16
	Flags         uint32
	NextCommand   uint32
	MessageID     uint64
	Reserved      uint32
	TreeID        uint32
	SessionID     uint64
	Signature     []byte `smb:"fixed:16"`
}

type NegotiateReq

type NegotiateReq struct {
	Header
	StructureSize   uint16
	DialectCount    uint16 `smb:"count:Dialects"`
	SecurityMode    uint16
	Reserved        uint16
	Capabilities    uint32
	ClientGuid      []byte `smb:"fixed:16"`
	ClientStartTime uint64
	Dialects        []uint16
}

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 Options

type Options struct {
	Host        string
	Port        int
	Workstation string
	Domain      string
	User        string
	Password    string
	Hash        string
}

type SMBLog

type SMBLog struct {
	SupportV1 bool `json:"smbv1_support"`
}

type Session

type Session struct {
	IsSigningRequired bool
	IsAuthenticated   bool
	// contains filtered or unexported fields
}

func (*Session) Debug

func (s *Session) Debug(msg string, err error)

func (*Session) NegotiateProtocol

func (s *Session) NegotiateProtocol(logStruct *SMBLog) error

func (*Session) NewNegotiateReq

func (s *Session) NewNegotiateReq() NegotiateReq

Directories

Path Synopsis
* MIT License * * Copyright (c) 2017 stacktitan * * 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.
* MIT License * * Copyright (c) 2017 stacktitan * * 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL