From 430e8f73cfaa863cc7b49044a555fb8667f1fbb9 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 3 Jul 2014 12:47:38 +0200 Subject: replay-chunks.py: fix missing data Not all bytes were captured, it turns out that data was never read (and thus the send buffer becames full) which leads to data loss when the connection is closed. --- crafted-pkt/replay-chunks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crafted-pkt') diff --git a/crafted-pkt/replay-chunks.py b/crafted-pkt/replay-chunks.py index b969b27..3b77612 100755 --- a/crafted-pkt/replay-chunks.py +++ b/crafted-pkt/replay-chunks.py @@ -52,8 +52,10 @@ class FollowParser(object): def add_data(self, data, is_reply): sock = self.sock_server if is_reply else self.sock_client + othersock = self.sock_client if is_reply else self.sock_server for i in range(0, len(data), self.chunk_size): - sock.send(data[i:i+self.chunk_size]) + sock.sendall(data[i:i+self.chunk_size]) + othersock.recv(self.chunk_size) print('{}: {}'.format('S->C' if is_reply else 'C->S', _dumpbytes(data))) def state_find_begin(self, line): -- cgit v1.2.1