Python more than 10 lines of code get the new POC for DB Library

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.