1

Im trying to install Scapy on windows 10, python 2.7.11, and stuck on this error:

>>> from scapy.all import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\tools\python\lib\site-packages\scapy\all.py", line 25, in <module>
    from scapy.route import *
  File "C:\tools\python\lib\site-packages\scapy\route.py", line 182, in <module>
    _betteriface = conf.route.route("0.0.0.0", verbose=0)[0]
  File "C:\tools\python\lib\site-packages\scapy\route.py", line 150, in route
    aa = atol(a)
  File "C:\tools\python\lib\site-packages\scapy\utils.py", line 400, in atol
    except socket.error:
socket.gaierror: [Errno 11001] getaddrinfo failed

What does it mean?

Idan
  • 69
  • 11

1 Answers1

2

As stated in the python 2.7 documentation, this error is thrown either by the getaddrinfo() or getnameinfo() function.
Judging by the stack trace, the scapy module tries to initialize a socket during its import and the port number is invalid (we can see the atol function being called, which convert a string to an integer).
It is unclear what the real issue is. However, you can try the following things:

  • Make sure you have the right version of python and scapy. I suggest that you install scapy from pip, and maybe use a virtual environment to run your script.
  • You can also try to compile scapy from source, or check the issue section in github to see if your problem is actually a known problem being worked on.
  • Maybe scapy tries to initialize a raw socket (i don't know why they would, but its worth a try), which requires admin privileges. Try running your script as admin.

    Hope this helps
Fire
  • 393
  • 1
  • 7
  • Thank you! It seems that the problem is a simple indent error as it now split: ' File "C:\tools\python\lib\site-packages\scapy\utils.py", line 399 ip = inet_aton(x) ^ IndentationError: unindent does not match any outer indentation level' which is the code in the try section befor the code that filed. how can I compile a python file into a compiled python file myself? – Idan Mar 14 '18 at 05:40
  • A python library is actually just a python file (or multiple files). You don't need to compile anything, although it is feasible to pre-compile python source files. – Fire Mar 16 '18 at 16:19