Skip to content
Snippets Groups Projects
Commit 6d6dba22 authored by Guillaume Valadon's avatar Guillaume Valadon Committed by Guillaume Valadon
Browse files

Functions from the unix module can be imported without importing pcapdnet

Replacing | with or

Useless line break
parent 60ed0c8d
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,6 @@ def str2mac(s): ...@@ -40,7 +40,6 @@ def str2mac(s):
return ("%02x:"*6)[:-1] % tuple(map(ord, s)) return ("%02x:"*6)[:-1] % tuple(map(ord, s))
def get_if_addr(iff): def get_if_addr(iff):
return socket.inet_ntoa(get_if_raw_addr(iff)) return socket.inet_ntoa(get_if_raw_addr(iff))
...@@ -52,13 +51,14 @@ def get_if_hwaddr(iff): ...@@ -52,13 +51,14 @@ def get_if_hwaddr(iff):
raise Scapy_Exception("Unsupported address family (%i) for interface [%s]" % (addrfamily,iff)) raise Scapy_Exception("Unsupported address family (%i) for interface [%s]" % (addrfamily,iff))
LINUX=sys.platform.startswith("linux") LINUX = sys.platform.startswith("linux")
OPENBSD=sys.platform.startswith("openbsd") OPENBSD = sys.platform.startswith("openbsd")
FREEBSD= "freebsd" in sys.platform FREEBSD = "freebsd" in sys.platform
NETBSD=sys.platform.startswith("netbsd") NETBSD = sys.platform.startswith("netbsd")
DARWIN=sys.platform.startswith("darwin") DARWIN = sys.platform.startswith("darwin")
SOLARIS=sys.platform.startswith("sunos") SOLARIS = sys.platform.startswith("sunos")
WINDOWS=sys.platform.startswith("win32") WINDOWS = sys.platform.startswith("win32")
BSD = DARWIN or FREEBSD or OPENBSD or NETBSD
X86_64 = not WINDOWS and (os.uname()[4] == 'x86_64') X86_64 = not WINDOWS and (os.uname()[4] == 'x86_64')
ARM_64 = not WINDOWS and (os.uname()[4] == 'aarch64') ARM_64 = not WINDOWS and (os.uname()[4] == 'aarch64')
...@@ -81,8 +81,12 @@ if LINUX: ...@@ -81,8 +81,12 @@ if LINUX:
from linux import * from linux import *
if scapy.config.conf.use_pcap or scapy.config.conf.use_dnet: if scapy.config.conf.use_pcap or scapy.config.conf.use_dnet:
from pcapdnet import * from pcapdnet import *
elif OPENBSD or FREEBSD or NETBSD or DARWIN: elif BSD:
from bsd import * from bsd import LOOPBACK_NAME
from unix import read_routes, read_routes6, in6_getifaddr
scapy.config.conf.use_pcap = True
scapy.config.conf.use_dnet = True
from pcapdnet import *
elif SOLARIS: elif SOLARIS:
from solaris import * from solaris import *
elif WINDOWS: elif WINDOWS:
......
...@@ -7,6 +7,4 @@ ...@@ -7,6 +7,4 @@
Support for BSD-like operating systems such as FreeBSD, OpenBSD and Mac OS X. Support for BSD-like operating systems such as FreeBSD, OpenBSD and Mac OS X.
""" """
LOOPBACK_NAME="lo0" LOOPBACK_NAME = "lo0"
from unix import *
...@@ -14,10 +14,7 @@ import scapy.config ...@@ -14,10 +14,7 @@ import scapy.config
import scapy.utils import scapy.utils
import scapy.utils6 import scapy.utils6
import scapy.arch import scapy.arch
from scapy.config import conf
scapy.config.conf.use_pcap = 1
scapy.config.conf.use_dnet = 1
from pcapdnet import *
################## ##################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment