summaryrefslogtreecommitdiff
path: root/chat_client.py
diff options
context:
space:
mode:
authorjerome <jerome@xlinfo.fr>2025-07-05 12:57:49 +0200
committerjerome <jerome@xlinfo.fr>2025-07-05 12:57:49 +0200
commit3d82ba0abee73ba803f569e2847dc12b2603fb4b (patch)
tree6c1f2bc21b9812e430f1048fcc655fcbb6321dcb /chat_client.py
parent611e7f11cafdd68d9174799e6e8f6bee8688a54a (diff)
downloadpython-3d82ba0abee73ba803f569e2847dc12b2603fb4b.tar.gz
python-3d82ba0abee73ba803f569e2847dc12b2603fb4b.zip
sockets
Diffstat (limited to 'chat_client.py')
-rw-r--r--chat_client.py8
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: