Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

More than ten lines of Python code to get the poc added to the db library

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1. Background introduction

Due to the needs of the project and my hobbies, I download the compression package on the exploit-db library every month and update it to my own vulnerability platform. However, in the past, the entire folder of exploit was uploaded to the server through the remote desktop, because this folder is so large that it takes a long time to upload, so I just want to write a script to collect the new poc added last month.

two。 Use tools

Python2.7 's os and sys libraries

3. Script

First of all, the db library provides a particularly convenient way to have an excel file to store vulnerability information, including the file path of poc, so just put the new information in a txt text and regenerate the new poc file according to the path. The following is a particularly concise script:

# coding:utf-8import osimport syswith open (ringing files. Txt') as f: # contains the new vulnerability information in csv: for line in f: dbid,file, description,date,author,use_type,platform Port = line.split ('\ t') name = 'exploit-database-master/'+file # folder for all poc files n_name =' file/'+file # folder for new poc files path = os.path.split (n_name) [0] # returns the path if os.path.exists (path) for the newly added poc: Print 'exists' else: os.makedirs (path) # create a new path open (n_name) if the path does not exist "wb") .write (open (name, "rb") .read () # read the original poc and then rewrite it to the new folder

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report