1. Background information
Due to the needs of the project and personal interests, I will download the EXPLOIT-DB library every month to update the compressed package, updated to their vulnerability platform. However, in the past, the entire folder of exploit through the remote Desktop to the server, because this folder is very large, resulting in a long time to pass, so you want to write a script light collection of the new POC last month.
2. Using Tools
Python2.7 OS and SYS libraries
3. Scripts
First, the DB Library provides a particularly handy way to have an Excel file that stores vulnerability information, including the POC file path, so just put the new information in a txt text and then regenerate the new POC file based on the path. The following is a particularly concise script:
#coding: Utf-8import osimport syswith open (R ' files.txt ') as f: #里面是csv中新增的漏洞信息 for line in f: dbid,file, description,date,author,use_type,platform,port = line.split ( ' \ t ') name = ' exploit-database-master/' +file #所有poc文件存放的文件夹 n_name = ' file/' +file #新增的poc文件存放的文件夹 path = os.path.split (N_name) [0] #返回新增的poc存放的路径 if os.path.exists (path): print ' exists ' else: os.makedirs (path) #路径不存在则新建路径 open (n_name, "WB"). Write (Open (name, "RB"). Read ()) # Read the original POC and re-write to the new folder
Python more than 10 lines of code get the new POC for DB Library