try: title = path.replace('/', '_') filePath = "interface_post_file\\%s.txt" % title int_tm = int(round(time.time() * 1000)) tm = str(int_tm) if os.path.exists(filePath): new_file = title + tm filePath = "interface_post_file\\%s.txt" % new_file withopen(filePath, "a") as f: f.writelines(title_line + '\n') for i in new_headers: f.writelines(i + '\n') except: title = path.replace('/', '_') withopen("interface_post_file\\%s.txt" % title, "a") as f: f.writelines(title_line + '\n') for i in new_headers: f.writelines(i + '\n')
run_sqlmap.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#-*-coding:utf-8-*- __author__="orion-c"
import os # 遍历指定目录,显示目录下的所有文件名 here = os.getcwd() interface_post_file = here+'\interface_post_file' pathDir = os.listdir(interface_post_file) file_paths = [] for allDir in pathDir: child = os.path.join('%s\%s' % (interface_post_file, allDir)) file_paths.append(child.decode('gbk')) # .decode('gbk')是解决中文显示乱码问题 os.chdir('..') for file_path_index inrange(len(file_paths)): #os.system('python sqlmap.py -r %s --batch >> result.txt'%file_paths[file_path_index]) os.system('python sqlmap.py -r %s --batch'%file_paths[file_path_index])