Skip to main content

SMB client and server toolkit

Project description

SMBCTL

SMBCTL es una herramienta simple para administrar conexiones SMB y levantar servidores SMB utilizando Impacket.

Características

Cliente SMB

  • Conectar a recursos SMB
  • Desconectar recursos SMB
  • Listar conexiones activas
  • Ver estado del cliente
  • Copiar archivos entre local y SMB
  • Soporte Windows y Linux

Servidor SMB

  • Iniciar servidor SMB
  • Detener servidor SMB
  • Consultar estado
  • Mostrar información de acceso
  • Soporte para autenticación opcional
  • Ejecución en background (Linux)

Instalación

Desarrollo

git clone https://github.com/kevinzl13/smbctl.git
uv sync

Ejecutar:

uv run smbctl --help

Instalación global

uv tool install smbctl

Después podrás usar:

smbctl

desde cualquier terminal.


Comandos Cliente

Conectar a un share SMB

Sin autenticación:

smbctl connect -i 192.168.1.10

Con autenticación:

smbctl connect \
    -i 192.168.1.10 \
    -u usuario \
    -p password

Share personalizado:

smbctl connect \
    -i 192.168.1.10 \
    -s documentos

Listar conexiones

smbctl list

Ejemplo:

================ SMB CONNECTIONS ================

SERVER  : 192.168.1.10
SHARE   : smbFolder
CLIENT  : windows
TARGET  : Z:
AUTH    : True
--------------------------------------------------

Estado del cliente

smbctl status

Desconectar una conexión

Desconectar servidor específico:

smbctl disconnect -i 192.168.1.10

Desconectar todas:

smbctl disconnect

Copiar Archivos

La sintaxis está inspirada en SCP.


Local → SMB

Copiar archivo local al servidor:

smbctl copy archivo.txt \
    192.168.1.10:/smbFolder/archivo.txt

Copiar a un directorio remoto:

smbctl copy archivo.txt \
    192.168.1.10:/smbFolder/docs/

SMB → Local

Copiar archivo remoto al directorio actual:

smbctl copy \
    192.168.1.10:/smbFolder/archivo.txt .

Copiar a una carpeta específica:

smbctl copy \
    192.168.1.10:/smbFolder/archivo.txt \
    ./downloads/

Comandos Servidor

Iniciar servidor SMB

Compartir directorio actual:

smbctl server start

Compartir directorio específico:

smbctl server start \
    -d /home/usuario/files

Share personalizado:

smbctl server start \
    -d /home/usuario/files \
    -s documentos

Con autenticación:

smbctl server start \
    -d /home/usuario/files \
    -u usuario \
    -p password

Estado del servidor

smbctl server status

Ejemplo:

=== SMB SERVER STATUS ===

PID      : 21344
Share    : smbFolder
Dir      : /home/usuario/files
Alive    : YES
Uptime   : 230s

Información de acceso

smbctl server info

Ejemplo:

smb://192.168.1.10/smbFolder

Detener servidor

smbctl server stop

Funcionamiento por Plataforma

Windows

Las conexiones SMB se montan automáticamente usando:

net use Z: \\IP\SHARE

Por defecto se utiliza:

Z:

Al ejecutar:

smbctl disconnect

la unidad se desmonta automáticamente.


Linux

Las conexiones SMB se montan automáticamente usando:

mount -t cifs

Por defecto:

/mnt/smb

Puede personalizarse:

smbctl connect \
    -i 192.168.1.10 \
    -m /mnt/files

Requisitos

Cliente

Windows:

net use

Linux:

mount.cifs

Servidor

Impacket:

pip install impacket

Verificar:

impacket-smbserver -h

Ejemplo Completo

Servidor:

smbctl server start \
    -d /tmp/share \
    -u usuario \
    -p password

Cliente:

smbctl connect \
    -i 192.168.1.10 \
    -u usuario \
    -p password

Copiar archivo:

smbctl copy test.txt \
    192.168.1.10:/smbFolder/test.txt

Descargar archivo:

smbctl copy \
    192.168.1.10:/smbFolder/test.txt .

Desconectar:

smbctl disconnect

Detener servidor:

smbctl server stop

Project details


Download files

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

Source Distribution

smbctl-0.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

smbctl-0.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file smbctl-0.0.1.tar.gz.

File metadata

  • Download URL: smbctl-0.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for smbctl-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0e5bf4e8140365f4810f8e4e71dfea757649da5b2a1e3865d555bfb114e74386
MD5 ebe10e5791ae0f689e2f2ac24d3b967c
BLAKE2b-256 9a848485cb59feea48b93be750aabd72d1a3fc86274075b1516c52724d969ec5

See more details on using hashes here.

File details

Details for the file smbctl-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: smbctl-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for smbctl-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d33867718114078ea5c81124a06b7d1fc058369ee349259dca06b574a79a96b5
MD5 ce4adacd9fab65bb576af8931a737605
BLAKE2b-256 18e84e141cb33bd40f30b851995c7cd7825629b5ff8afaf4d098632be8dcc4d8

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