fragattacks icon indicating copy to clipboard operation
fragattacks copied to clipboard

ModuleNotFoundError: No module named scapy.modules.six.moves

Open john19922 opened this issue 9 months ago • 4 comments

Hi, I'm trying to run the code using the below in my latest Kali Linux 6.12.20-amd64 & Python 3.13.2

cd research
sudo su
source venv/bin/activate

but still facing the following error

./test-injection.py
Traceback (most recent call last):
  File "/home/user/Desktop/fragattacks/research/test-injection.py", line 7, in <module>
    from libwifi import *
  File "/home/user/Desktop/fragattacks/research/libwifi/__init__.py", line 1, in <module>
    from .wifi import *
  File "/home/user/Desktop/fragattacks/research/libwifi/wifi.py", line 5, in <module>
    from scapy.all import *
  File "/home/user/Desktop/fragattacks/research/venv/lib/python3.13/site-packages/scapy/all.py", line 10, in <module>
    from scapy.base_classes import *
  File "/home/user/Desktop/fragattacks/research/venv/lib/python3.13/site-packages/scapy/base_classes.py", line 32, in <module>                                                                                                                        
    from scapy.modules.six.moves import range
ModuleNotFoundError: No module named 'scapy.modules.six.moves'

Following packages are installed -

pip list                
Package            Version
------------------ -------
attrs              19.3.0
importlib-metadata 1.5.0
more-itertools     8.2.0
mpmath             1.1.0
packaging          20.1
pip                25.0.1
pluggy             0.13.1
py                 1.10.0
pycryptodome       3.9.7
pyparsing          2.4.6
pytest             5.3.5
scapy              2.4.3
simpy              3.0.11
six                1.13.0
sympy              1.5.1
wcwidth            0.1.8
wheel              0.45.1
zipp               3.0.0

When I upgraded scapy >= 2.5 I'm getting following error

./test-injection.py
Traceback (most recent call last):
  File "/home/user/Desktop/fragattacks/research/test-injection.py", line 7, in <module>
    from libwifi import *
  File "/home/user/Desktop/fragattacks/research/libwifi/__init__.py", line 1, in <module>
    from .wifi import *
  File "/home/user/Desktop/fragattacks/research/libwifi/wifi.py", line 227, in <module>
    class MonitorSocket(L2Socket):
                        ^^^^^^^^
NameError: name 'L2Socket' is not defined

Can anyone please help how to resolve the issue !!!

john19922 avatar Apr 18 '25 17:04 john19922

Unfortunately, the Scapy version used by the fragattacks script is not compatible with recent Python releases. This will not get fixed in the next month(s). In the meantime, you can try to downgrade to an older Python version, or use an older Linux distribution.

vanhoefm avatar Apr 19 '25 00:04 vanhoefm

Unfortunately, the Scapy version used by the fragattacks script is not compatible with recent Python releases. This will not get fixed in the next month(s). In the meantime, you can try to downgrade to an older Python version, or use an older Linux distribution.

Thank you @vanhoefm for your quick response. Got it working with Python 3.8.20

john19922 avatar Apr 19 '25 18:04 john19922

@vanhoefm By the way, on a different topic, this repo uses Scapy (GPL-2.0) and it's a derivative work of Scapy, not mere aggregation. Then shouldn't this repo also be distributed under GPL-2.0, not BSD?

jackshin98 avatar Aug 27 '25 03:08 jackshin98

@jackshin98, there aren't any files from Scapy in this repository, so it's fine. The definition of what exactly 'derivative work' is has countless discussions online, so to get a definite answer, you'd have to look up court rulings that match this scenario.

vanhoefm avatar Aug 27 '25 20:08 vanhoefm