server.py calls sock.accept() exactly once globally. When the client disconnects or you hit 'q', the server script just dies. It doesn't loop back to listen for the next payload.
The Fix:
Put sock.accept() inside a while True: loop.
When shell() returns or errors out, explicitly call target.close().
Let the loop spin back around to block on the next accept().
server.py calls sock.accept() exactly once globally. When the client disconnects or you hit 'q', the server script just dies. It doesn't loop back to listen for the next payload.
The Fix:
Put sock.accept() inside a while True: loop.
When shell() returns or errors out, explicitly call target.close().
Let the loop spin back around to block on the next accept().