scapy icon indicating copy to clipboard operation
scapy copied to clipboard

sndrcv does not return control to user after KeyboardInterrupt

Open bsullivan19 opened this issue 1 year ago • 3 comments

Brief description

sndrcv related functions (sr, sr1, srp...) do not return control to the user after a KeyboardInterrupt.

Scapy version

2.5.0

Python version

3.12.2

Operating system

Windows 10

Additional environment information

No response

How to reproduce

p = IP(dst="X.X.X.X")/ICMP() sr1(p) ^C does not end process

Actual result

No response

Expected result

KeyboardInterrupt should quit the process.

Related resources

No response

bsullivan19 avatar Mar 28 '24 20:03 bsullivan19

Hi, could you retry on master?

gpotter2 avatar Mar 29 '24 21:03 gpotter2

Bug is still present on latest pull from master. Tried on Ethernet and Wireless NetworkInterfaces and issue is present on both.

bsullivan19 avatar Apr 03 '24 15:04 bsullivan19

I'm not sure that this is fixable. We use windows native WaitForMultipleObjects to wait for incoming packets which... you can't cancel from within Python. This is a limitation we can't really work around without compromising on select() performance.

The workaround would probably be to use a timeout parameter. Like timeout=1.

gpotter2 avatar Apr 21 '24 00:04 gpotter2