Created
January 2, 2025 09:38
-
-
Save GuillaumeMorini/9eb01822b01f2081a36c4db09fadf99e to your computer and use it in GitHub Desktop.
fcsc2022-misc-a-l-envers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import re | |
| HOST = "127.0.0.1" # The server's hostname or IP address | |
| PORT = 4000 # The port used by the server | |
| with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
| s.connect((HOST, PORT)) | |
| data = s.recv(1024) | |
| print("Received",data) | |
| st=re.sub(r'>>> ','',data.decode()) | |
| print("extract",st) | |
| while 1: | |
| resp=st[:-1][::-1]+"\n" | |
| print("Sent",resp) | |
| s.sendall(str.encode(resp)) | |
| data = s.recv(1024) | |
| print("Received",data) | |
| st=re.sub(r'.*\n>>> ','',data.decode()) | |
| print("st:",st) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment