Curso-lenguaje-python/scripts-hacking-etico/src/02-impacket.py
Manuel Vergara e0c73bda48 Add exercise 3 by script-hacking course
Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
2023-06-06 19:44:44 +02:00

20 lines
413 B
Python

"""
Instalar la biblioteca de Python `impacket`
y realizar un escaneo de puertos
a la dirección IP `192.168.1.1`
"""
from impacket import smb
# Crear un objeto de cliente SMB
client = smb.SMB('*SMBSERVER', '192.168.1.110')
# Conectar al servidor SMB
client.connect()
# Escanear puertos
ports = client.scan_ports()
# Imprimir puertos abiertos
for port in ports:
print(f'El puerto {port} está abierto')