From d4a09f4ca993b92876a0f8dbfeb7d4962bb35de1 Mon Sep 17 00:00:00 2001
From: Guillaume Valadon <guillaume.valadon@ssi.gouv.fr>
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 d94f88a6..516262c8 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:
--
GitLab