-
Notifications
You must be signed in to change notification settings - Fork 5
/
calculate.py
44 lines (31 loc) · 1005 Bytes
/
calculate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pcapDir = '/mnt/d/pcap'
#for readFile in [f for f in os.listdir(pcapDir) if f.endswith('.txt')]:
class Msg:
def __init__(self,src,dest,time,size):
self.src = src
self.dest = dest
self.time = time
self.size = size
def check_reply(self,src,dest):
if int(self.src.replace('.','')) == int(dest.replace('.','')):
if int(self.dest.replace('.','')) == int(src.replace('.','')):
return true
return false
import os
allfiles = os.listdir('.')
for i in xrange(len(allfiles)):
if allfiles[i].endswith('.txt'):
lines = open(allfiles[i],'r').readlines()
#d = dict()
#e2e = []
#totalbytes = 0
maxtime = 0
for line in lines:
#print line
parts = line.replace(' ',' ').replace(' ',' ').split(' ')[2:]
if len(parts)>2:
#item = parts[2].replace('.','')+parts[4].replace('.','')
#totalbytes = totalbytes + (int(parts[7])-64)
if parts[0] > maxtime :
maxtime = parts[0]
print allfiles[i].replace('.txt',',').replace('x',',')+str(maxtime)