Skip to content

TheManticoreProject/smbclient-ng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smbclient-ng, a fast, cross-platform, and user friendly way to interact with SMB shares.
GitHub release (latest by date) YouTube Channel Subscribers

This is a Go re-implementation of p0dalirius/smbclient-ng, built on top of the Manticore SMB stack.

Features

  • acls: List ACLs of files and folders in the current directory. Syntax: acls
  • bat: Pretty prints the contents of a remote file. Syntax: bat <file>
  • bhead: Pretty prints the first n lines of a remote file. Syntax: bhead [-n <lines>] <file>
  • btail: Pretty prints the last n lines of a remote file. Syntax: btail [-n <lines>] <file>
  • cat: Get the contents of a remote file. Syntax: cat <file>
  • cd: Change the current working directory. Syntax: cd <directory>
  • close: Closes the SMB connection to the remote machine. Syntax: close
  • connect: Connect to the remote machine (useful if connection timed out). Syntax: connect
  • dir: List the contents of the current remote working directory (alias of ls). Syntax: dir
  • exit (alias quit): Exits the smbclient-ng script. Syntax: exit
  • find: Search for files in a directory hierarchy. Syntax: find [-name PATTERN] [-iname PATTERN] [-type f|d] [-maxdepth N] [-mindepth N] [-ls] [PATH ...]
  • get: Get a remote file. Syntax: get <file> [local_file]
  • head: Get the first n lines of a remote file. Syntax: head [-n <lines>] <file>
  • help: Displays this help message. Syntax: help [command]
  • history: Displays the command history. Syntax: history [--contains <string>] [--clear]
  • info: Get information about the server and or the share. Syntax: info <--server|--share>
  • lbat: Pretty prints the contents of a local file. Syntax: lbat <file>
  • lcat: Print the contents of a local file. Syntax: lcat <file>
  • lcd: Changes the current local directory. Syntax: lcd <directory>
  • lcp: Create a copy of a local file. Syntax: lcp <srcfile> <dstfile>
  • lls: Lists the contents of the current local directory. Syntax: lls [directory]
  • lmkdir: Creates a new local directory. Syntax: lmkdir <directory>
  • lpwd: Shows the current local directory. Syntax: lpwd
  • lrename: Renames a local file. Syntax: lrename <oldfilename> <newfilename>
  • lrm: Removes a local file. Syntax: lrm <file>
  • lrmdir: Removes a local directory. Syntax: lrmdir <directory>
  • ls: List the contents of the current remote working directory. Syntax: ls [directory]
  • ltree: Displays a tree view of the local directories. Syntax: ltree [directory]
  • metadata: Get metadata about a file or directory. Syntax: metadata <file|directory>
  • mget: Download every remote file matching a wildcard mask. Syntax: mget <mask>
  • mkdir: Creates a new remote directory. Syntax: mkdir <directory>
  • module: Loads a specific module for additional functionalities. Syntax: module <name>
  • mount: Creates a mount point of the remote share on the local machine. Syntax: mount <remote_path> <local_mountpoint>
  • mv (alias rename, move): Move or rename a remote file or directory. Syntax: mv <source> <destination>
  • put: Put a local file or directory in a remote directory. Syntax: put <local_file> [remote_file]
  • pwd: Print the current remote working directory. Syntax: pwd
  • reconnect: Reconnect to the remote machine (useful if connection timed out). Syntax: reconnect
  • reset: Reset the TTY output, useful if it was broken after printing a binary file on stdout. Syntax: reset
  • rget: Recursively download a remote directory tree. Syntax: rget [directory]
  • rm (alias del): Removes a remote file. Syntax: rm <file>
  • rmdir: Removes a remote directory. Syntax: rmdir <directory>
  • sessions: Manage the SMB sessions. Syntax: sessions [interact|create|delete|execute|list]
  • shares: Lists the SMB shares served by the remote machine. Syntax: shares [-R]
  • sizeof: Recursively compute the size of a folder. Syntax: sizeof [directory|file]
  • tail: Get the last n lines of a remote file. Syntax: tail [-n <lines>] <file>
  • tree: Displays a tree view of the remote directories. Syntax: tree [directory]
  • umount: Removes a mount point of the remote share on the local machine. Syntax: umount <local_mount_point>
  • use: Use a SMB share. Syntax: use <sharename>

Install

Build from source with Go (≥ 1.24). The tool builds against the in-development Manticore SMB stack, which go.mod references through a local replace directive, so check out both repositories side by side:

git clone https://github.com/TheManticoreProject/Manticore
git clone https://github.com/TheManticoreProject/smbclient-ng
cd smbclient-ng
go build -o smbclient-ng .

Demonstration

Usage

$ ./smbclient-ng
               _          _ _            _
 ___ _ __ ___ | |__   ___| (_) ___ _ __ | |_      _ __   __ _
/ __| '_ ` _ \| '_ \ / __| | |/ _ \ '_ \| __|____| '_ \ / _` |
\__ \ | | | | | |_) | (__| | |  __/ | | | ||_____| | | | (_| |
|___/_| |_| |_|_.__/ \___|_|_|\___|_| |_|\__|    |_| |_|\__, |
    by @podalirius_                             v1.0.0  |___/

Usage: smbclient-ng [--debug] [--domain <string>] [--username <string>] [--password <string>] [--hashes <string>] [--use-kerberos] --host <string> [--port <tcp port>] [--nbt]

  --debug         Debug mode. (default: false)

  Authentication:
    -d, --domain <string>   Windows domain to authenticate to. Use '.' for local accounts. (default: ".")
    -u, --username <string> User to authenticate as. (default: "")
    -p, --password <string> Password to authenticate with. (default: "")
    --hashes <string>       NT/LM hashes, format is LMhash:NThash. (default: "")

  Connection Settings:
    -k, --use-kerberos Use Kerberos instead of NTLM. (not yet supported by the Manticore SMB stack) (default: false)

  Target:
    -H, --host <string>   IP address or hostname of the SMB server to connect to.
    -P, --port <tcp port> Port number to connect to on the SMB server. (default: 445)
    --nbt                 Use NetBIOS (NBT) transport instead of direct TCP. (default: false)

Quick start commands

  • Connect to a remote SMB server:
    smbclient-ng --host 10.0.0.201 -d "LAB" -u "Administrator" -p 'Admin123!'
    

Contributing

Pull requests are welcome. Feel free to open an issue if you want to add other features.

About

smbclient-ng, a fast, cross-platform, and user friendly way to interact with SMB shares.

Resources

License

Stars

9 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages