frigate_TUNNEL

Posted monster学习笔记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了frigate_TUNNEL相关的知识,希望对你有一定的参考价值。

#coding=utf-8

Result=open(‘result.txt‘,"w")

FileTunnel = open(‘tunnel.txt‘).readlines()

New_dict = {}

UpSum=0

DownSum=0

#NumBer=0  #计数次数

for Line in FileTunnel:  

  #print Line  Protocol = Line.split()[6]   

  OriginalIp = Line.split()[8]  

  UpLoad = Line.split()[10]  

  DownLoad = Line.split()[11]  

  Type = Line.split()[20]  

  Domain = Line.split()[21]  

  if New_dict.has_key(OriginalIp):   

  #NumBer+=1   

    UpSum+=int(UpLoad)   

    DownSum+=int(DownLoad)  

    UpDictValue = Protocol,OriginalIp,UpSum,DownSum,Type,Domain,int(New_dict[OriginalIp][6])+1   

    New_dict[OriginalIp] = UpDictValue   

    #print OriginalIp,int(New_dict[OriginalIp][2]),int(New_dict[OriginalIp][3])  

     continue  

     #print New_dict[OriginalIp],UpSum,DownSum  

  DictValue = Protocol,OriginalIp,UpLoad,DownLoad,Type,Domain,1  

  New_dict[OriginalIp] = DictValue  

  #print "OUTPUT:",DictValue

#print New_dict["222.186.3.50:80"]

for x,y in New_dict.items():  

Result.writelines(str(y)+‘\n‘)

 

以上是关于frigate_TUNNEL的主要内容,如果未能解决你的问题,请参考以下文章