Python端口扫描

!/usr/bin/python# -- coding: UTF-8 --

'''

本文摘自
https://www.vulbox.com/knowledge/detail/?id=153

'''

import socket,threadpool

ports=[]

def scan_poort(port):

ip='127.0.0.1'

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)

try:

    statu=s.connect_ex((ip,port))

    if statu==0:

        print(port,'is open')

except:

    pass

def get_port():

global ports

for p in range(65536):

    ports.append(p)

get_port()

pool=threadpool.ThreadPool(100)

reqs=threadpool.makeRequests(scan_poort,ports)

[pool.putRequest(req) for req in reqs]

pool.wait()

上一篇:https中间人攻击.md


下一篇:freebsd了解--需要知道的