代码拉取完成,页面将自动刷新
#!/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))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。