From d4a09f4ca993b92876a0f8dbfeb7d4962bb35de1 Mon Sep 17 00:00:00 2001 From: Guillaume Valadon Date: Thu, 3 Nov 2016 10:39:22 +0100 Subject: [PATCH] top sniff() on empty s.recv() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - improved from Mattias Ahlbäck original patch --- scapy/sendrecv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scapy/sendrecv.py b/scapy/sendrecv.py index d94f88a6c..516262c87 100644 --- a/scapy/sendrecv.py +++ b/scapy/sendrecv.py @@ -608,7 +608,10 @@ interfaces) sel = select(sniff_sockets, [], [], remain) for s in sel[0]: p = s.recv() - if p is not None: + if p is None and offline is not None: + stop_event = True + break + elif p is not None: if lfilter and not lfilter(p): continue if s in label: