roberto-patch-1 #2
15
Soket_server.py
Normal file
15
Soket_server.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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()}")
|
||||||
Reference in New Issue
Block a user