Skip to main content

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

Project description

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

Features

  • acls: List ACLs of files and folders in cwd. Syntax: acls
  • bat: Pretty prints the contents of a file. Syntax: bat <file>
  • bhead: Pretty prints the first n lines of a file. Syntax: bhead <file>
  • btail: Pretty prints the last n lines of a file. Syntax: btail <file>
  • cat: Get the contents of a 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 working directory. Syntax: dir
  • exit: Exits the smbclient-ng script. Syntax: exit
  • get: Get a remote file. Syntax: get [-r] <directory or file>
  • help: Displays this help message. Syntax: help
  • head: Get the first n lines of a remote file. Syntax: head <file>
  • history: Displays the command history. Syntax: history
  • 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
  • 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
  • ltree: Displays a tree view of the local directories. Syntax: ltree [directory]
  • metadata: Get metadata about a file or directory. Syntax: metadata <file|directory>
  • 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>
  • put: Put a local file or directory in a remote directory. Syntax: put [-r] <directory or file>
  • 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
  • rm: 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
  • sizeof: Recursively compute the size of a folder. Syntax: sizeof [directory|file]
  • tail: Get the last n lines of a remote file. Syntax: tail <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

To install smbclient-ng, you can use pip, pip3 or pipx. You can run any of the following command in your terminal to install smbclient-ng :

  • With pip:

    python3 -m pip install smbclientng
    
  • With pip3:

    pip3 install smbclientng
    
  • With pipx:

    pipx install smbclientng
    

Demonstration

Usage

$ ./smbclient-ng.py 
               _          _ _            _
 ___ _ __ ___ | |__   ___| (_) ___ _ __ | |_      _ __   __ _
/ __| '_ ` _ \| '_ \ / __| | |/ _ \ '_ \| __|____| '_ \ / _` |
\__ \ | | | | | |_) | (__| | |  __/ | | | ||_____| | | | (_| |
|___/_| |_| |_|_.__/ \___|_|_|\___|_| |_|\__|    |_| |_|\__, |
    by @podalirius_                             v2.1.8  |___/
    
usage: smbclientng [-h] [--debug] [--no-colors] [-l LOGFILE] [-T TIMEOUT] [-a ADVERTISED_NAME] [-C COMMAND] [-S STARTUP_SCRIPT] [-N] -H HOST [-P PORT] [-d DOMAIN] [-u USER]
                   [-p [PASSWORD] | --no-pass | --hashes [LMHASH:]NTHASH | --aes-key HEXKEY | -k | --kdcHost KDCHOST]

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

options:
  -h, --help            show this help message and exit

Config:
  --debug               Enable debug mode.
  --no-colors           Disable colored output.
  -l LOGFILE, --logfile LOGFILE
                        Log file path.
  -T TIMEOUT, --timeout TIMEOUT
                        Timeout for SMB connections (default: 3s)
  -a ADVERTISED_NAME, --advertised-name ADVERTISED_NAME
                        Advertised machine name.

Commands:
  -C COMMAND, --command COMMAND
                        smbclient-ng commands to execute.
  -S STARTUP_SCRIPT, --startup-script STARTUP_SCRIPT
                        Startup script with commands.
  -N, --not-interactive
                        Non-interactive mode.

Target:
  -H HOST, --host HOST  Target SMB Server IP or hostname.
  -P PORT, --port PORT  Target SMB Server port (default: 445).

Authentication & Connection:
  -d DOMAIN, --domain DOMAIN
                        Authentication domain.
  -u USER, --user USER  Username for authentication.

Secrets:
  -p [PASSWORD], --password [PASSWORD]
                        Password.
  --no-pass             Do not prompt for a password.
  --hashes [LMHASH:]NTHASH
                        NT/LM hashes.
  --aes-key HEXKEY      AES key for Kerberos authentication.
  -k, --kerberos        Use Kerberos authentication.
  --kdcHost KDCHOST     Fully qualified domain name (FQDN) of key distribution center (KDC) for Kerberos.

Quick start commands

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

Contributing

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smbclientng-3.0.0-py3-none-any.whl (125.8 kB view details)

Uploaded Python 3

File details

Details for the file smbclientng-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: smbclientng-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 125.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for smbclientng-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ef299178ca1404e613e86cd4915ec0d80d7823a8b29edd7b3286d6af92174a1
MD5 91fab665008b7aa188f506245b1a53ed
BLAKE2b-256 3db7a8f6cc40ac778524135d1a90c9f02f8020365bcb915946db0327ec2a3117

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page