X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=parsetrace%2Fparse.py;h=1255f2d9158b2eb7074114c66191494cf6e034b6;hb=3f38239ab60c62ba020c85b92b7535b2e90776a7;hp=4419a35be39128f21cd01f56b0b8d42d2df0328c;hpb=145b4756946bbd443452ec1b2081984795de70d0;p=bluesky.git diff --git a/parsetrace/parse.py b/parsetrace/parse.py index 4419a35..1255f2d 100755 --- a/parsetrace/parse.py +++ b/parsetrace/parse.py @@ -1,7 +1,7 @@ #!/usr/bin/python import impacket, pcapy, re, sys -import impacket.ImpactDecoder +import impacket.ImpactDecoder, impacket.ImpactPacket start_time = None @@ -31,6 +31,8 @@ class Connection: self.times = [] self.transfer_count = 0 Connection.counter += 1 + self.last_id = 0 + self.winscale = {1: 0, -1: 0} def finish_transfer(self): if len(self.times) > 0: @@ -45,11 +47,12 @@ class Connection: print "Network RTT:", rtt print "Additional response delay:", start - rtt print "Transfer time:", end - start - print "Bandwidth:", data / (end - start) + if end - start > 0: + print "Bandwidth:", data / (end - start) print - logfile.write("%d\t%d\t%d\t%f\t%f\t%f\n" + logfile.write("%d\t%d\t%d\t%f\t%f\t%f\t# %s\n" % (self.id, self.transfer_count, data, - rtt, start - rtt, end - start)) + rtt, start - rtt, end - start, self.endpoints)) self.transfer_count += 1 self.times = [] self.state = STATE_START @@ -71,6 +74,18 @@ class Connection: else: direction = 0 + for o in tcp.get_options(): + if o.get_kind() == o.TCPOPT_WINDOW: + self.winscale[direction] = o.get_shift_cnt() + print "window scale for dir %d is %d" % (direction, + o.get_shift_cnt()) + + if direction < 0: + gap = (ip.get_ip_id() - self.last_id) & 0xffff + if 1 < gap < 256: + print "Gap of", gap, "packets on connection", self.endpoints + self.last_id = ip.get_ip_id() + seq = (tcp.get_th_seq(), tcp.get_th_seq() + datalen) ack = tcp.get_th_ack() @@ -103,6 +118,12 @@ class Connection: self.times.append(((timestamp - self.starttime) / 1e6, seq[1] - self.respseq)) + if self.id == 21: + winsize = tcp.get_th_win() + if not tcp.get_SYN(): + winsize <<= self.winscale[direction] + print "got packet, data=%d win=%d" % (datalen, winsize) + def handler(header, data): global start_time global pkt