Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scapy Can't load when have bridge interface on OSX [Bug] #161

Closed
dark-lbp opened this issue May 16, 2016 · 1 comment
Closed

Scapy Can't load when have bridge interface on OSX [Bug] #161

dark-lbp opened this issue May 16, 2016 · 1 comment

Comments

@dark-lbp
Copy link
Contributor

system: OSX 10.11.4

When i try to load scapy from OSX, i got this Error.

Python 2.7.11 (default, Apr 21 2016, 16:15:36)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from scapy.all import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "scapy/all.py", line 25, in <module>
    from route import *
  File "scapy/route.py", line 162, in <module>
    conf.route=Route()
  File "scapy/route.py", line 22, in __init__
    self.resync()
  File "scapy/route.py", line 31, in resync
    self.routes = read_routes()
  File "scapy/arch/unix.py", line 81, in read_routes
    ifaddr = scapy.arch.get_if_addr(netif)
  File "scapy/arch/__init__.py", line 44, in get_if_addr
    return socket.inet_ntoa(get_if_raw_addr(iff))
  File "scapy/arch/pcapdnet.py", line 519, in get_if_raw_addr
    return i.get(ifname)["addr"].data
  File "dnet.pyx", line 990, in dnet.intf.get
OSError: Device not configured

This may fix that problem.
scapy/arch/unix.py

def read_routes():
    if scapy.arch.SOLARIS:
        f = os.popen("netstat -rvn")  # -f inet
    elif scapy.arch.FREEBSD:
        f = os.popen("netstat -rnW")  # -W to handle long interface names
    elif scapy.arch.DARWIN:
        f = os.popen("netstat -rn | grep -v 'vboxnet \| bridge'")  # Fix OSX problem
    else:
        f = os.popen("netstat -rn")  # -f inet
    ...
@dark-lbp
Copy link
Contributor Author

After doing some test, i realize this is the same problem with #149. Sorry for open duplicate issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant