1 Star 0 Fork 0

abin / ExploitDB_Spider

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
FileProcess.py 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import csv
import shutil
from B2M import B2M
def classifyToImg(source,destination):
num = 0
for fpathe,dirs,fs in os.walk(source):
for f in fs:
source_file = os.path.join(fpathe,f)
num = num +1
with open('ExploitDB_Info.csv', 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if row['app_url'].split("/")[4] == f:
dir = row["type"] + "\\" + row["platform"] + "\\"
for category in row["category"].split(" / "):
# file_name = destination + "\\" + dir + str(category).replace(" ","").replace(".","_").replace("/","_").replace(":","_").replace("?","_").replace("\"","\'") + "\\" + row["app_url"].split("/")[-1]
# mycopyfile(source_file, file_name)
img_name = destination + "Img" + "\\" + dir + str(category).replace(" ","").replace(".","_").replace("/","_").replace(":","_").replace("?","_").replace("\"","\'") + "\\" + str(os.path.splitext(row["app_url"])[0]).split("/")[-1].replace(".tar","")+".png"
B2M(source_file,img_name)
print("classifyToImg num:",num)
#classifyToImg('E:\\我的文档\\毕业论文\\漏洞\\Download','.\\Download')
def mycopyfile(srcfile, dstfile):
if os.path.isfile(dstfile):
print("%s has been existed!" % (dstfile))
return
if not os.path.isfile(srcfile):
print("%s not exist!" % (srcfile))
else:
fpath, fname = os.path.split(dstfile) # 分离文件名和路径
if not os.path.exists(fpath):
os.makedirs(fpath) # 创建路径
shutil.copyfile(srcfile, dstfile) # 复制文件
print("copy %s -> %s" % (srcfile, dstfile))
Python
1
https://gitee.com/sctb/ExploitDB_Spider.git
git@gitee.com:sctb/ExploitDB_Spider.git
sctb
ExploitDB_Spider
ExploitDB_Spider
master

搜索帮助