YaokaiYang-assaultmaster/py3PortScanner

descriptor 'popleft' of 'collections.deque' object needs an argument

Closed this issue · 5 comments

我在运行的时候出现这种状况,请问是为什么
代码:
from pyportscanner import pyscanner

scanner = pyscanner.PortScanner(target_ports=100, timeout=10, verbose=True)
scanner.scan('https://www.jianshu.com')
结果:
/usr/bin/python3.6 /home/evilgr0x/PycharmProjects/Hello/port_scan/test.py


Start scanning target: www.jianshu.com
Target IP is: 222.245.77.23
Traceback (most recent call last):
File "/home/evilgr0x/PycharmProjects/Hello/port_scan/test.py", line 4, in
scanner.scan('https://www.jianshu.com')
File "/home/evilgr0x/py3PortScanner/pyportscanner/pyscanner.py", line 167, in scan
output = self.__scan_ports(server_ip, message)
File "/home/evilgr0x/py3PortScanner/pyportscanner/pyscanner.py", line 200, in __scan_ports
self.__check_futures(output, futures)
File "/home/evilgr0x/py3PortScanner/pyportscanner/pyscanner.py", line 229, in __check_futures
future = deque.popleft()
TypeError: descriptor 'popleft' of 'collections.deque' object needs an argument

Process finished with exit code 1

我执行了你程序

scanner = pyscanner.PortScanner(target_ports=100, timeout=10, verbose=True)
scanner.scan('https://www.jianshu.com')

在我这里没问题。

请问你具体是如何执行的程序。在什么系统什么环境下执行的程序。谢谢。

虚拟机环境VMware15.02下Ubuntu18.04+pycharm
新建test.py文件,输入之前提问的代码
直接在pycharm环境中run

网络连接没有问题,我写了比较简单的端口扫描,运行正常

我检查了下程序。这是因为我之前手误,打错了变量名。deque是一个class,而popleft()是一个成员方法,应当从deque的实例来调用,也就是从futures上调用。我现在已经改正了这个错误。
你看看,如果你那边运行也没问题的话我就把这个issue关掉了。谢谢指出。

我这里没有问题了,可以正常运行,谢谢