diff options
| author | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:22 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-10-12 17:41:22 +0200 |
| commit | ba41fa46e69dbb264dfbed1b9fca5daab44a07c7 (patch) | |
| tree | d9c6eeee3a32b0d5a004f2846882868c29ba531c /chat_client.py | |
| parent | ec7b5913698416b775665a871a0d4102b47c680c (diff) | |
| download | python-ba41fa46e69dbb264dfbed1b9fca5daab44a07c7.tar.gz python-ba41fa46e69dbb264dfbed1b9fca5daab44a07c7.zip | |
organisation
Diffstat (limited to 'chat_client.py')
| -rw-r--r-- | chat_client.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/chat_client.py b/chat_client.py deleted file mode 100644 index affc1d3..0000000 --- a/chat_client.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 - -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("moi > ") - message = whoami+" > "+message # à commenter pour le bindshell - s.sendall(message.encode()) - data = s.recv(1024) - print(data.decode().strip()) - except KeyboardInterrupt: - s.close() - finally: - print("bye") - -if __name__ == "__main__": - try: - chat_client(sys.argv[1],int(sys.argv[2])) - except IndexError: - print(f"{sys.argv[0]} demande un hôte où se connecter et un numéro de port") - |
