You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SndRcvHandler has a field multi to enable receiving multiple answer to a single Packet. Currently, if multi is set, the only way to stop sniffing for more answers is to specify a timeout and wait for it to expire, or to give a KeyboardInterrupt. Waiting for a specified timeout is not very feasibly for a few reasons: the timeout to receive an answer may not always come in a reliably consistent amount of time, and waiting for a timeout may result in decreased responsiveness for applications using Scapy.
AsyncSniffer already has a field stop_filter for a callback fn which takes a Packet and returns True if the AsyncSniffer should be stopped early.
I'm proposing adding a field stop_filter to SndRcvHandler.__init__() to allow sr() related functions to pass the stop_filter to the AsyncSniffer in SndRcvHandler()._sndrcv_rcv()
Scapy version
2.5.0
Python version
3.12.2
Operating system
Windows 10
Additional environment information
No response
How to reproduce
pkt: Packet= ...
sr(pkt, multi=1, timeout=1)
Actual result
No response
Expected result
No response
Related resources
No response
The text was updated successfully, but these errors were encountered:
bsullivan19
added a commit
to bsullivan19/scapy-sndrcv-stop-filter
that referenced
this issue
Apr 23, 2024
Added stop_filter param to SndRcvHandler.__init__().
Pass stop_filter to AsyncSniffer._run in SndRcvHandler._sndrcv_rcv.
Check if SndRcvHandler.sniffer is running before stopping in SndRcvHandler._process_packet.
Updated _DOC_SNDRCV_PARAMS documentation to include new parameter.
* #4360: Add stop_filter parameter to SndRcvHandler
Added stop_filter param to SndRcvHandler.__init__().
Pass stop_filter to AsyncSniffer._run in SndRcvHandler._sndrcv_rcv.
Check if SndRcvHandler.sniffer is running before stopping in SndRcvHandler._process_packet.
Updated _DOC_SNDRCV_PARAMS documentation to include new parameter.
* Resolve code style errors
Brief description
SndRcvHandler
has a field multi to enable receiving multiple answer to a singlePacket
. Currently, if multi is set, the only way to stop sniffing for more answers is to specify a timeout and wait for it to expire, or to give a KeyboardInterrupt. Waiting for a specified timeout is not very feasibly for a few reasons: the timeout to receive an answer may not always come in a reliably consistent amount of time, and waiting for a timeout may result in decreased responsiveness for applications using Scapy.AsyncSniffer
already has a field stop_filter for a callback fn which takes a Packet and returns True if theAsyncSniffer
should be stopped early.I'm proposing adding a field stop_filter to
SndRcvHandler.__init__()
to allowsr()
related functions to pass the stop_filter to theAsyncSniffer
inSndRcvHandler()._sndrcv_rcv()
Scapy version
2.5.0
Python version
3.12.2
Operating system
Windows 10
Additional environment information
No response
How to reproduce
Actual result
No response
Expected result
No response
Related resources
No response
The text was updated successfully, but these errors were encountered: