I am fairly new to python so forgive my bad errors or stupid questions. I made a program that can send commands from a remote computer to another computer, everything seems to work but I can't figure out how to capture the output from the client and send to the remote computer. Any help would be appreciated. My code for the remote side :
import time
import sys
import socket
import os
def func():
command = input(str("cmd or pwsh? : "))
conn.send(command.encode())
print("command has been sent, waiting")
s = socket.socket()
host = socket.gethostname()
print(host)
port = 8080
s.bind((host,port))
print("Waiting")
s.listen(1)
conn, addr = s.accept()
print("Connected")
func()
x = 1
while True:
func()
Code for the client side :
import time
import sys
import socket
import os
def input():
command = s.recv(1024)
command = command.decode()
os.system(command)
s = socket.socket()
host = "192.168.100.3"
port = 8080
s.connect((host, port))
print("Connected to server ")
def input():
command = s.recv(1024)
command = command.decode()
os.system(command)
input()
x = 1
while True:
input()