python多线程端口扫描工具,多线程自定义扫描主机开放端口。
Usage: portScan.py [options]
Options:
-h, --help show this help message and exit
-i IP, --ip=IP scan only ip default port in number 1 to 10000
-s STARTIP, --startip=STARTIP
1.自定义线程池
import threading
import Queue
import time
queue = Queue.Queue()
def put_data_in_queue():
for i in xrange(10):
queue.put(i)
class MyThread(threading.Thread):
def run(self):
while not queue.empty():
sleep_times = queue.get()
用PyQt中的QThread类实现多线程
利用PyQt中的pyqtSignal类实现信息的触发和捕获,即定义事件和订阅事件
利用QThread类实现多线程的方法
1,新建一个python类,继承自QThread
from PyQt5.QtCore import QThread
class SubThread(QThread):
2,重写__init__(),__del__()和run()函数
from PyQt5.QtCore import QThread
class SubThrea