15 lines
345 B
Python
15 lines
345 B
Python
import socket
|
|
|
|
HOST = 'localhost'
|
|
PORT = 12345
|
|
|
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
s.connect((HOST, PORT))
|
|
|
|
# Se l'autenticazione è abilitata
|
|
s.sendall(b'admin\n')
|
|
s.sendall(b'password123\n')
|
|
|
|
s.sendall(b'status\n') # Invia il comando
|
|
data = s.recv(1024)
|
|
print(f"Received: {data.decode()}") |