Add exercise 2 by script-hacking course

Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
This commit is contained in:
2023-06-06 17:33:28 +02:00
parent 5ac64d1897
commit 9af7fa58d9
2 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
"""
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.1')
# 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')