smbmap

SMBMap allows users to enumerate samba share drives across an entire domain. List share drives, drive permissions, share contents, upload/download functionality, file name auto-download pattern matching, and even execute remote commands. This tool was designed with pen testing in mind, and is intended to simplify searching for potentially sensitive data across large networks.

Usage

Usage: smbmap [options]...

Options

Main arguments

OptionDescription
-H HOSTIP of host
--host-file FILEFile containing a list of hosts
-u USERNAMEUsername, if omitted null session assumed
-p PASSWORDPassword or NTLM hash
--promptPrompt for a password
-s SHARESpecify a share
-d DOMAINDomain name (default WORKGROUP)
-P PORTSMB port (default 445)
-vReturn the OS version of the remote host
--adminJust report if the user is an admin
--no-bannerRemoves the banner from the top of the output
--no-colorRemoves the color from output
--no-updateRemoves the “Working on it” message
--timeout SCAN_TIMEOUTSet port scan socket timeout. Default is .5 seconds

Command Execution

Options for executing commands on the specified host

OptionDescription
-x COMMANDExecute a command ex. ipconfig /all
--mode CMDMODESet the execution method, wmi or psexec, default wmi

Options for searching/enumerating the share of the specified host(s)

OptionDescription
-LList all drives on the specified host, requires ADMIN rights.
-r [PATH]Recursively list dirs and files (no share\path lists the root of ALL shares), ex. ‘email/backup’
-A PATTERNDefine a file name pattern (regex) that auto downloads a file on a match (requires -r), not case sensitive,
-g FILEOutput to a file in a grep friendly format, used with -r (otherwise it outputs nothing)
--csv FILEOutput to a CSV file
--dir-onlyList only directories, ommit files.
--no-write-checkSkip check to see if drive grants WRITE access.
-qQuiet verbose output. Only shows shares you have READ or WRITE on, and suppresses file listing when performing a search.
--depth DEPTHTraverse a directory tree to a specific depth. (Default: 5)
--exclude SHARE [SHARE ...]Exclude share(s) from searching and listing

Options for searching the content of files (must run as root), kind of experimental

OptionDescription
-F PATTERNFile content search, -F '[Pp]assword' (requires admin access to execute commands, and PowerShell on victim host)
--search-path PATHSpecify drive/path to search
--search-timeout TIMEOUTSpecifcy a timeout (in seconds) before the file search job gets killed. Default is 300 seconds.

Filesystem interaction

Options for interacting with the specified host’s filesystem

OptionDescription
--download PATHDownload a file from the remote system
--upload SRC DSTUpload a file to the remote system
--delete PATH TO FILEDelete a remote file
--skipSkip delete file confirmation prompt