Python 3.x 使用远程命令执行python脚本进行代码辅助
因此,我已经尝试编写这种远程命令执行脚本有一段时间了,但我看不到它能正常工作,或者我得到了一个 断管错误32 或 TypeError:“int”对象不可调用 服务器Python 3.x 使用远程命令执行python脚本进行代码辅助,python-3.x,Python 3.x,因此,我已经尝试编写这种远程命令执行脚本有一段时间了,但我看不到它能正常工作,或者我得到了一个 断管错误32 或 TypeError:“int”对象不可调用 服务器 import socket import platform import subprocess s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) Host = platform.node() Port = 4444 s.bind((Host, Port)) s.listen(
import socket
import platform
import subprocess
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Host = platform.node()
Port = 4444
s.bind((Host, Port))
s.listen(1)
conn, addr = s.accept()
with conn:
while True:
data = conn.recv(1024)
x = subprocess.run([data], shell = True, stdout = subprocess.PIPE(), stderr = subprocess.PIPE)
s.sendall(stdout.read() + stderr.read()
客户端
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Host = input('Remote Host:')
Port = 4444
s.connect((Host, Port))
while True:
x = input('@-->Rhost:')
x2 = x.encode('utf')
s.sendall(x2)
s.recv(1024)