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.2.tar.gz (7.8 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.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smbctl-0.0.2.tar.gz
  • Upload date:
  • Size: 7.8 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.2.tar.gz
Algorithm Hash digest
SHA256 db0cbdc47e4b2a0c1b17331bb8a7b27e26681dc613dab3dc5858f6379177628e
MD5 1a1d30536fe7c7c4226fef527338ad16
BLAKE2b-256 9f4562cb5e149e4283afce467381f369283e39bb02d2000feb575324bab9a711

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smbctl-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e7515e6357e78a96c105ccd90d5d7bf02ff68ba6f0518bc3b635f752c2eeb90d
MD5 0022d3f01321996be40cbaf69cb5bb19
BLAKE2b-256 8450df84c0e4b957c504cf0d2e8d23fc93100fc877d4a937dc2f33d4788cd347

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