diff options
Diffstat (limited to 'chat_client.py')
| -rw-r--r-- | chat_client.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/chat_client.py b/chat_client.py index 88bb7ae..affc1d3 100644 --- a/chat_client.py +++ b/chat_client.py @@ -1,16 +1,18 @@ #!/usr/bin/env python3 -import sys,socket +import sys,socket,os def chat_client(host,port): + whoami = os.getenv("USER") try: s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.connect((host,port)) while True: - message = input() + message = input("moi > ") + message = whoami+" > "+message # à commenter pour le bindshell s.sendall(message.encode()) data = s.recv(1024) - print(data.decode()) + print(data.decode().strip()) except KeyboardInterrupt: s.close() finally: |
