安裝環境:
sudo apt-get install build-essential cmake libgmp3-dev libpcap-dev gengetopt byacc flex git dwarfdump
下載zmap:
git clone git://github.com/zmap/zmap.git
安裝zmap:
cmake -DENABLE_HARDENING=ON
make && make install
(kali安裝zmap還需要另外安裝json-c)
個人比較喜歡用設定檔來掃描。
zmap -C /etc/zmap/zmap.conf -o output.txt
用python寫了個批量驗證zmap的掃描結果是否存在未授權訪問的指令碼。
一開始的代碼沒設定逾時,結果發現才跑了一下子就卡住了,查了半天pymongo的官方文檔,找到了connectTimeoutMS、socketTimeoutMS這兩個參數。
設定連線逾時connectTimeoutMS,不知道為啥沒起作用,又改成設定socket的逾時時間socketTimeoutMS才有效。
pymongo預設串連數為100,所以代碼中的線程數為99,大家可自調。
附上 習科聯創寫的多線程驗證指令碼:
#/usr/bin/python#coding:utf8import sysimport pymongoimport urllib2,threading,timeimport sysfrom Queue import Queuedef conn(addr,output): try: w = open(output,'a') conn = pymongo.MongoClient(addr,27017,socketTimeoutMS=3000) dbname = conn.database_names() wr = "Ip: "+addr+"\r\n" wr += "dbs:\r\n" wr += str(dbname)+"\r\n" w.write(wr) print wr conn.close() w.close() except: print addr+" connection was failed\r\n"class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): global queue while not queue.empty(): ip = queue.get() conn(ip,sys.argv[1]+".txt")if __name__ == "__main__": queue = Queue() a = open(sys.argv[1],'r') for ip in a.readlines(): ip = ip.strip('\n') queue.put(ip) for i in range(99): c = MyThread() c.start()