smb

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WindowsBuildMapping = map[string]string{

	"20348": "Windows Server 2022",
	"19041": "Windows Server 2022 (Insider)",
	"17763": "Windows Server 2019",
	"14393": "Windows Server 2016",
	"10586": "Windows Server 2016 (Technical Preview)",
	"9600":  "Windows Server 2012 R2",
	"9200":  "Windows Server 2012",
	"7601":  "Windows Server 2008 R2 SP1 / Windows 7 SP1",
	"6002":  "Windows Server 2008 SP2 / Windows Vista SP2",
	"6001":  "Windows Server 2008 SP1 / Windows Vista SP1",
	"6000":  "Windows Server 2008 / Windows Vista",

	"22631": "Windows 11 23H2",
	"22621": "Windows 11 22H2",
	"22000": "Windows 11 21H2",

	"19045": "Windows 10 22H2",
	"19044": "Windows 10 21H2",
	"19043": "Windows 10 21H1",
	"19042": "Windows 10 20H2",
	"18363": "Windows 10 1909",
	"18362": "Windows 10 1903",
	"17134": "Windows 10 1803",
	"16299": "Windows 10 1709",
	"15063": "Windows 10 1703",
	"10240": "Windows 10 RTM",

	"9431": "Windows 8.1 Update 1",

	"7600": "Windows 7 RTM",
}

WindowsBuildMapping maps Windows build numbers to human-readable versions

Functions

This section is empty.

Types

type Client

type Client struct {
	Host           string
	Port           int
	Username       string
	Password       string
	Domain         string
	UseAnonymous   bool
	UseNullSession bool
	Timeout        time.Duration
	// contains filtered or unexported fields
}

Client represents a unified SMB client that provides base functionality for both enumeration and pentest operations

func NewClient

func NewClient(host string, port int) *Client

NewClient creates a new SMB client with the given configuration

func (*Client) Close

func (c *Client) Close() error

Close closes the SMB connection

func (*Client) Connect

func (c *Client) Connect() error

Connect establishes connection to SMB server and performs authentication

func (*Client) ConnectWithContext

func (c *Client) ConnectWithContext(ctx context.Context) error

ConnectWithContext establishes connection to SMB server and performs authentication with context

func (*Client) DetectDomainController

func (c *Client) DetectDomainController(shares []*ShareInfo) bool

DetectDomainController checks if the server appears to be a domain controller

func (*Client) EnumerateShares

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

EnumerateShares lists available shares using TreeConnect testing

func (*Client) EnumerateSharesWithContext

func (c *Client) EnumerateSharesWithContext(ctx context.Context) ([]*ShareInfo, error)

EnumerateSharesWithContext lists available shares using TreeConnect testing with context

func (*Client) GetServerInfo

func (c *Client) GetServerInfo() *ServerInfo

GetServerInfo returns extracted server information

func (*Client) IsAuthenticated

func (c *Client) IsAuthenticated() bool

IsAuthenticated returns true if client is authenticated to SMB server

func (*Client) IsConnected

func (c *Client) IsConnected() bool

IsConnected returns true if client is connected to SMB server

func (*Client) SetAnonymous

func (c *Client) SetAnonymous()

SetAnonymous configures client for anonymous authentication

func (*Client) SetCredentials

func (c *Client) SetCredentials(username, password, domain string)

SetCredentials sets username and password for authentication

func (*Client) SetNullSession

func (c *Client) SetNullSession()

SetNullSession configures client for null session authentication

func (*Client) TestCredentials

func (c *Client) TestCredentials(username, password, domain string) (bool, string, error)

TestCredentials tests if the provided credentials are valid

type ServerInfo

type ServerInfo struct {
	ServerName          string
	Domain              string
	OSVersion           string
	ServerType          string
	IsDomainController  bool
	Capabilities        []string
	SigningRequired     bool
	EncryptionSupported bool
	SupportedVersions   []string
}

ServerInfo contains basic server information extracted from SMB connection

type ShareInfo

type ShareInfo struct {
	Name            string
	Type            string
	Accessible      bool
	Access          string
	AnonymousAccess bool
	GuestAccess     bool
	Hidden          bool
	Comment         string
}

ShareInfo represents SMB share information

Jump to

Keyboard shortcuts

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