Scapy windows - sniff () - 'log_runtime' undefined

I installed python 2.7 and scapy after the supported programs: pywin32, WinPcap, Pypcap and libdnet. I feel it is important to say that my OS is Windows 7.

When I use the sniff function, an error message appears: http://prntscr.com/dbd79a . I tried another scapy function and classes like IP and sendp, and it works fine, the only problem is that it exists.

I tried several versions of scapy from many installation links and no changes.

+4
source share
1 answer

Your problem is a bug in version 2.3.3 scapy (loaded 18/10/16). This will probably be fixed in the next version, meanwhile you can install the previous version by doing

pip install scapy==2.3.2

I checked in commits and this error was not in this version. However, I did not test it so that it could contain other errors (since 2.3.3 must have changed something for the better, at least I hope so), so if you should use 2.3.3, for some reason you can fix it like this:

from scapy.arch.windows import compatibility
from scapy.all import log_runtime, MTU, ETH_P_ALL, PcapTimeoutElapsed, plist

compatibility.log_runtime = log_runtime
compatibility.MTU = MTU
compatibility.PcapTimeoutElapsed = PcapTimeoutElapsed
compatibility.ETH_P_ALL = ETH_P_ALL
compatibility.plist = plist

compatibility.sniff(1) # call the sniff function however you like
+1
source

Source: https://habr.com/ru/post/1661883/


All Articles