Skip to main content

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

Metadata

Release files for smbctl 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smbctl 0.0.2
File Size Uploaded
smbctl-0.0.2.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smbctl 0.0.2
File Interpreter ABI Platform
smbctl-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / smbctl-0.0.2.tar.gz

Download URL smbctl-0.0.2.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
db0cbdc47e4b2a0c1b17331bb8a7b27e26681dc613dab3dc5858f6379177628e
BLAKE2b-256 checksum
How to use checksums
9f4562cb5e149e4283afce467381f369283e39bb02d2000feb575324bab9a711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / smbctl-0.0.2-py3-none-any.whl

Download URL smbctl-0.0.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7515e6357e78a96c105ccd90d5d7bf02ff68ba6f0518bc3b635f752c2eeb90d
BLAKE2b-256 checksum
How to use checksums
8450df84c0e4b957c504cf0d2e8d23fc93100fc877d4a937dc2f33d4788cd347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page