御剑字典合并赛选去重工具集合

热度:295℃ 评论:2 发布时间:2019-03-27 收录:未收录

合并赛选

将wordlists目录下的所有文件中的内容整理赛选后写入到script目录中对应后缀的文件中。

如:把wordlists目录下的2.txt中的第三行后缀是.php,那么将写入到script目录的php.txt中。

御剑字典合并赛选去重工具集合

御剑字典合并赛选去重工具集合

#!/usr/env python
#-*- coding:utf-8 -*-

##########################################################################
######					路径扫描字典分类工具					 #############
######					Author: Pino_HD					     #############
######									By T00ls.Net		 #############
##########################################################################

import os
import time

ext = ['php', 'jsp', 'jspx.txt', 'asp', 'aspx', 'dir', 'mdb']

def open_files():
	f_asp = open('asp.txt','a+')
	f_aspx = open('aspx.txt', 'a+')
	f_php = open('php.txt', 'a+')
	f_jsp = open('jsp.txt', 'a+')
	f_jspx = open('jspx.txt', 'a+')
	f_dir = open('dir.txt','a+')
	f_other = open('mdb.txt', 'a+')
	return f_asp, f_aspx, f_php, f_jsp, f_jspx, f_dir, f_other

def close_files(f_asp, f_aspx, f_php, f_jsp, f_jspx, f_dir, f_other):
	f_asp.close()
	f_aspx.close()
	f_php.close()
	f_jsp.close()
	f_other.close()
	f_dir.close()

if __name__ == '__main__':
	starttime = time.time()
	path = "../wordlists/"
	count = 0
	f = open_files()
	f_asp = f[0]
	f_aspx = f[1]
	f_php = f[2]
	f_jsp = f[3]
	f_jspx = f[4]
	f_dir = f[5]
	f_other = f[6]
	files = []
	for file in os.listdir(path):
		if os.path.isfile(os.path.join(path, file)):
			print (file)
			with open(path + file) as fp:
				lines = fp.readlines()
				for line in lines:
					count = count + 1
					if '.asp' in line and '.aspx' not in line:
						f_asp.write(line)
					elif '.aspx' in line:
						f_aspx.write(line)
					elif '.php' in line:
						f_php.write(line)
					elif '.jsp' in line and '.jspx' not in line:
						f_jsp.write(line)
					elif '.jspx' in line:
						f_jspx.write(line)
					elif '.' not in line:
						f_dir.write(line)
					else:
						f_other.write(line)
	close_files(f_asp, f_aspx, f_php, f_jsp, f_jspx, f_dir, f_other)
	endtime = time.time()
	costtime = endtime - starttime
	print ('[OK]Job finishes !!!')
	print ('[OK]Total ' + str(count) +' lines')
	print ('[OK]Costs ' + str(costtime) + ' \'s')

去重复

#coding=utf-8
 
import sys, re, os
 
def getDictList(dict):
    regx = '''[\w\~`\!\@\#\$\%\^\&\*\(\)\_\-\+\=\[\]\{\}\:\;\,\.\/\<\>\?]+'''
    with open(dict) as f:
        data = f.read()
        return re.findall(regx, data)
 
def rmdp(dictList):
    return list(set(dictList))
 
def fileSave(dictRmdp, out):
    with open(out, 'a') as f:
        for line in dictRmdp:
            f.write(line + '\n')
 
def main():
    try:
        dict = sys.argv[1].strip()
        out = sys.argv[2].strip()
    except Exception, e:
        print 'error:', e
        me = os.path.basename(__file__)
        print 'usage: %s <input> <output>' %me
        print 'example: %s dict.txt dict_rmdp.txt' %me
        exit()
 
    dictList = getDictList(dict)
    dictRmdp = rmdp(dictList)
    fileSave(dictRmdp, out)
     
if __name__ == '__main__':
    main()
打赏
本文由 Mr.Wu 创作,除注明转载/出处外,均为本站原创,转载前请注明出处!

2条回应:“御剑字典合并赛选去重工具集合”

  1. moming说道:

    终于看到更新了,一次更新这么多,看着好过隐呀

发表评论

电子邮件地址不会被公开。 必填项已用*标注

顶部
护眼
搜索
分享
公告