Cyber security

SMBclient-ng : A Comprehensive Tool For Managing SMB Shares

SMBclient-ng is a robust and intuitive command-line tool designed to enhance interactions with SMB shares, offering a plethora of commands to manage and navigate both local and remote file systems.

This versatile tool simplifies the process of connecting to SMB servers, handling files, and managing directories.

Whether you’re a network administrator or a security professional, SMBclient-ng provides the essential functionalities to efficiently work with SMB protocols.

Features

  • bat: Pretty prints the contents of a file. Syntax: bat <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
  • 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]
  • 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]
  • 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. Run the following command in your terminal:

python3 -m pip install smbclientng

Usage

$ ./smbclient-ng.py -h
               _          _ _            _                    
 ___ _ __ ___ | |__   ___| (_) ___ _ __ | |_      _ __   __ _ 
/ __| '_ ` _ \| '_ \ / __| | |/ _ \ '_ \| __|____| '_ \ / _` |
\__ \ | | | | | |_) | (__| | |  __/ | | | ||_____| | | | (_| |
|___/_| |_| |_|_.__/ \___|_|_|\___|_| |_|\__|    |_| |_|\__, |
    by @podalirius_                               v2.1  |___/  
    
usage: smbclient-ng.py [-h] [--debug] [--no-colors] [-S startup_script] [-N] --host HOST [--port PORT]
                       [--kdcHost FQDN KDC] [-d DOMAIN] [-u USER] [--no-pass | -p [PASSWORD] | -H
                       [LMHASH:]NTHASH | --aes-key hex key] [-k]

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

options:
  -h, --help            show this help message and exit
  --debug               Debug mode.
  --no-colors           No colors mode.
  -S startup_script, --startup-script startup_script
                        File containing the list of commands to be typed at start of the console.
  -N, --not-interactive
                        Non interactive mode.

Target:
  --host HOST           IP address or hostname of the SMB Server to connect to.
  --port PORT           Port of the SMB Server to connect to. (default: 445)

Authentication & connection:
  --kdcHost FQDN KDC    FQDN of KDC for Kerberos.
  -d DOMAIN, --domain DOMAIN
                        (FQDN) domain to authenticate to.
  -u USER, --user USER  User to authenticate with.

  --no-pass             Don't ask for password (useful for -k).
  -p [PASSWORD], --password [PASSWORD]
                        Password to authenticate with.
  -H [LMHASH:]NTHASH, --hashes [LMHASH:]NTHASH
                        NT/LM hashes, format is LMhash:NThash.
  --aes-key hex key     AES key to use for Kerberos Authentication (128 or 256 bits).
  -k, --kerberos        Use Kerberos authentication. Grabs credentials from .ccache file (KRB5CCNAME) based on target
                        parameters. If valid credentials cannot be found, it will use the ones specified in the
                        command line.
Varshini

Tamil has a great interest in the fields of Cyber Security, OSINT, and CTF projects. Currently, he is deeply involved in researching and publishing various security tools with Kali Linux Tutorials, which is quite fascinating.

Recent Posts

ModTask – Task Scheduler Attack Tool

ModTask is an advanced C# tool designed for red teaming operations, focusing on manipulating scheduled…

4 hours ago

HellBunny : Advanced Shellcode Loader For EDR Evasio

HellBunny is a malleable shellcode loader written in C and Assembly utilizing direct and indirect…

4 hours ago

SharpRedirect : A Lightweight And Efficient .NET-Based TCP Redirector

SharpRedirect is a simple .NET Framework-based redirector from a specified local port to a destination…

4 hours ago

Flyphish : Mastering Cloud-Based Phishing Simulations For Security Assessments

Flyphish is an Ansible playbook allowing cyber security consultants to deploy a phishing server in…

1 day ago

DeLink : Decrypting D-Link Firmware Across Devices With A Rust-Based Library

A crypto library to decrypt various encrypted D-Link firmware images. Confirmed to work on the…

1 day ago

LLM Lies : Hallucinations Are Not Bugs, But Features As Adversarial Examples

LLMs (e.g., GPT-3.5, LLaMA, and PaLM) suffer from hallucination—fabricating non-existent facts to cheat users without…

1 day ago