处理burp log 小脚本
burp 日志保存
保存的日志格式为
将日志中的数据包 每个数据包保存到一个单独的txt里面 然后可以控制目录放进不同的目录中
#coding=utf-8 import re import os def getFileContent(filename): with open(filename,'r') as f: content = f.read() f_list = content.split('======================================================') return f_list def saveRequest(k): new_list =[] for i in xrange(len(k)): id = int(i)+1 if k[i].lstrip().startswith(('GET','POST','OPTIONS','DELETE','PUT')): new_list.append(k[i].lstrip()) else: continue return new_list def splist(l,s): # l 原始列表 s代表每份多少个元素 return [l[i:i+s] for i in range(len(l)) if i%s==0] def saveRequestToFile(x): # num = 1 for j in xrange(len(x)): dirname = str(1+int(j)) os.mkdir(dirname) for L in xrange(len(x[j])): with open(dirname+'/'+str(num)+'.txt','w') as f: f.write(x[j][L]) num = num +1 if __name__ == '__main__': s = getFileContent('12345.txt') new = saveRequest(s) print "数据包总数"+": "+str(len(new)) raw_input_A = raw_input("请输入每个目录文件数量: ") new_list = splist(new,int(raw_input_A)) saveRequestToFile(new_list)
效果图就是