portscanner_threaded.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:Python4Pentesters 作者: tatanus 项目源码 文件源码
def run(self):
        # loop over the "in" queue and get a new port and scan it
        socket.setdefaulttimeout(TIMEOUT)
        while 1:
            host, port = self.inq.get()
            sd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            try:
                # connect to the given host:port
                sd.connect((host, port))
            except socket.error:
                # set the CLOSED flag
                self.outq.put((host, port, 'CLOSED'))
            else:
                # set the OPEN flag
                self.outq.put((host, port, 'OPEN'))
                sd.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号