去重和分类后缀asp、php等路径 用python3写的
生活随笔
收集整理的這篇文章主要介紹了
去重和分类后缀asp、php等路径 用python3写的
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我們在做滲透的時候肯定會用上掃描器的,本人一般會用御劍,當然你也會喜歡別的工具。
很多時候,能否滲透成功其實還挺依賴與字典的,如果把后臺給掃出來了,恰好還弱口令,那么豈不是美滋滋。
因此,有一個好的字典是至關重要的。當然了,大佬們滲透多年肯定已經收藏了很多好用的字典了,但是吧,很多時候一個asp的字典里還有aspx啊,php啊,jsp啊等等不相關的東西,
如果不相關的東西多了就會降低掃描的效率了,因此我們需要一個用來整理的工具,可以讓我們肆無忌憚的到處收集字典,然后整合到自己的字典庫中
?創建個data目錄??把需要去重和分類的txt文件放到里面
請用python3.X執行
用法如下
?
python datahanle.py?
?
?
#!/usr/bin/env python # -*- conding:utf-8 -*- import os,redata =[] asp = [] aspx = [] php = [] jsp = [] mdb = [] dirx = []def file_name():for files in os.walk("data"):#print(files[2]) #當前路徑下文件passreturn files[2] def datas(dir):with open("%s"%dir,"r",encoding="gb18030") as f:for i in f.readlines():data.append(i) dirs =file_name() for i in dirs:datas("data/%s"%(i)) print("一共有%s條路徑"%(len(data))) data = list(set(data)) print("去重后一共還有%s條路徑"%(len(data)))count_asp = 0 count_aspx = 0 count_jsp = 0 count_php = 0 count_dirx = 0 count_mdb = 0data = sorted(data) #對列表排序for i in data:#rule = re.compile(r".*?asp",re.I)res = re.search('.*?\.asp',i,flags=re.I)if res == None:res = re.search('.*?\.mdb', i, flags=re.I)if res == None:res = re.search('.*?\.php', i, flags=re.I)if res == None:res = re.search('.*?\.jsp', i, flags=re.I)if res == None:dirx.append(i)count_dirx +=1else:jsp.append(i)count_jsp +=1else:php.append(i)count_php +=1else:mdb.append(i)count_mdb += 1else:res = re.search('.*?\.aspx', i, flags=re.I)if res == None:asp.append(i)count_asp+=1else:aspx.append(i)count_aspx +=1print("asp:%s aspx:%s php:%s jsp:%s dir:%s mdb:%s"%(count_asp,count_aspx,count_php,count_jsp,count_dirx,count_mdb)) with open('nwe_asp.txt','a',encoding='utf-8') as f:for i in asp:f.write(i)with open('nwe_aspx.txt','a',encoding='utf-8') as f:for i in aspx:f.write(i)with open('nwe_php.txt','a',encoding='utf-8') as f:for i in php:f.write(i)with open('nwe_jsp.txt','a',encoding='utf-8') as f:for i in jsp:f.write(i)with open('nwe_mdb.txt','a',encoding='utf-8') as f:for i in mdb:f.write(i)with open('nwe_dir.txt','a',encoding='utf-8') as f:for i in dirx:f.write(i)?
轉載于:https://www.cnblogs.com/smxiazi/p/8811360.html
總結
以上是生活随笔為你收集整理的去重和分类后缀asp、php等路径 用python3写的的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: QTP(15)
- 下一篇: CSS 字体、边框阴影