diff --git a/clientBlaster.py b/clientBlaster.py index bb6528b..ccd0d50 100644 --- a/clientBlaster.py +++ b/clientBlaster.py @@ -62,12 +62,15 @@ def removeThread(): tprint(colorama.Fore.YELLOW + colorama.Style.BRIGHT + "Thread closed. Threads: " +str(threadCount)+ " (Actual: " +str(threading.active_count())+ ")" + colorama.Style.RESET_ALL) def sendResponse(connection,data): - connection.sendall(len(data).to_bytes(4,"big") + data) + connection.sendall(len(data).to_bytes(4,"big") + b"\x00" + data) def getResponse(connection): data = b'' data = connection.recv(4) if not data: return False + nul = connection.recv(1) + if not nul: return False + if nul != b"\x00": return False requestLength = int.from_bytes(data,"big") if requestLength > maxRequestSize: raise Exception("security","request_too_large") return connection.recv(requestLength) diff --git a/serverBlaster.py b/serverBlaster.py index a893310..b2c31ed 100644 --- a/serverBlaster.py +++ b/serverBlaster.py @@ -32,7 +32,7 @@ class receiverThread(threading.Thread): print("server: " +response) def sendRequest(connection,data): - connection.sendall(len(data).to_bytes(4,"big") + data) + connection.sendall(len(data).to_bytes(4,"big") + b"\x00" + data) def getResponse(connection): data = b'' @@ -42,6 +42,15 @@ def getResponse(connection): connection.close() return + nul = connection.recv(1) + if not nul: + connection.close() + return + + if nul != b"\x00": + connection.close() + return + requestLength = int.from_bytes(data,"big") data = connection.recv(requestLength) return data