diff options
author | bofh <bofh@FreeBSD.org> | 2019-09-11 18:24:28 +0800 |
---|---|---|
committer | bofh <bofh@FreeBSD.org> | 2019-09-11 18:24:28 +0800 |
commit | 617e263f335a6aa7580429ce2b66e469ae5e2692 (patch) | |
tree | 8c789419192fbb3655418822a2b573b2ab694e11 | |
parent | 9b7a87139b2e380d52dc821ae75ea1b598d6603f (diff) | |
download | freebsd-ports-gnome-617e263f335a6aa7580429ce2b66e469ae5e2692.tar.gz freebsd-ports-gnome-617e263f335a6aa7580429ce2b66e469ae5e2692.tar.zst freebsd-ports-gnome-617e263f335a6aa7580429ce2b66e469ae5e2692.zip |
inet/scapy: Update version 2.4.2=>2.4.3
- Use net/py-pypcap instead of net/py-pcap as dnet and py-pcap will be
deprecated in future scapy versions. One other reason is py-pcap is
failing with python3. [1]
- Change MASTER_SITE to PYPI for better availability [2]
- Update WWW [2]
PR: 239380 [1] 240493 [2]
Submitted by: lwhsu [1] [2]
-rw-r--r-- | net/scapy/Makefile | 13 | ||||
-rw-r--r-- | net/scapy/distinfo | 6 | ||||
-rw-r--r-- | net/scapy/files/patch-1991.patch | 171 | ||||
-rw-r--r-- | net/scapy/files/patch-scapy_config.py | 23 | ||||
-rw-r--r-- | net/scapy/pkg-descr | 2 |
5 files changed, 9 insertions, 206 deletions
diff --git a/net/scapy/Makefile b/net/scapy/Makefile index 98f71300515c..19532e8afd0a 100644 --- a/net/scapy/Makefile +++ b/net/scapy/Makefile @@ -1,11 +1,10 @@ # Created by: vanhu <vanhu@netasq.com> # $FreeBSD$ -PORTNAME= scapy -PORTVERSION= 2.4.2 -DISTVERSIONPREFIX= v -PORTREVISION= 2 -CATEGORIES= net +PORTNAME= scapy +PORTVERSION= 2.4.3 +CATEGORIES= net python +MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= bofh@FreeBSD.org @@ -15,11 +14,9 @@ LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/LICENSE RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}libdnet>0:net/py-libdnet@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}pcap>0:net/py-pcap@${PY_FLAVOR} + ${PYTHON_PKGNAMEPREFIX}pypcap>0:net/py-pypcap@${PY_FLAVOR} USE_PYTHON= autoplist distutils -USE_GITHUB= yes -GH_ACCOUNT= secdev NO_ARCH= yes diff --git a/net/scapy/distinfo b/net/scapy/distinfo index fdfa9b74580d..39c6d8013736 100644 --- a/net/scapy/distinfo +++ b/net/scapy/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1552603437 -SHA256 (secdev-scapy-v2.4.2_GH0.tar.gz) = 141ee386cf6f296e8c9fae94a40a5386ac2d9bfa43a3870b13f575200c46b5f8 -SIZE (secdev-scapy-v2.4.2_GH0.tar.gz) = 3330071 +TIMESTAMP = 1568196750 +SHA256 (scapy-2.4.3.tar.gz) = e2f8d11f6a941c14a789ae8b236b27bd634681f1b29b5e893861e284d234f6b0 +SIZE (scapy-2.4.3.tar.gz) = 905334 diff --git a/net/scapy/files/patch-1991.patch b/net/scapy/files/patch-1991.patch deleted file mode 100644 index 45c0eec19ccf..000000000000 --- a/net/scapy/files/patch-1991.patch +++ /dev/null @@ -1,171 +0,0 @@ -From 5ff17673eec7fc200a16552e3686015e99d10b5e Mon Sep 17 00:00:00 2001 -From: Pierre LALET <pierre.lalet@cea.fr> -Date: Tue, 16 Apr 2019 16:08:15 +0200 -Subject: [PATCH 1/2] BPF: fix get_working_ifaces() - -It was broken when an interface name did not end by a digit. - -It was also incorrect when an interface name ended by more than one -digit. ---- - scapy/arch/bpf/core.py | 46 ++++++++++++++++++++++++------------------ - test/bpf.uts | 6 ++---- - 2 files changed, 28 insertions(+), 24 deletions(-) - -diff --git scapy/arch/bpf/core.py scapy/arch/bpf/core.py -index cc4732f52..4c9e9470a 100644 ---- scapy/arch/bpf/core.py -+++ scapy/arch/bpf/core.py -@@ -5,22 +5,22 @@ - """ - - from __future__ import absolute_import --from scapy.config import conf --from scapy.error import Scapy_Exception, warning --from scapy.data import ARPHDR_LOOPBACK, ARPHDR_ETHER --from scapy.arch.common import get_if, compile_filter --from scapy.consts import LOOPBACK_NAME -- --from scapy.arch.bpf.consts import BIOCSETF, SIOCGIFFLAGS, BIOCSETIF - -+from ctypes import cdll, cast, pointer -+from ctypes import c_int, c_ulong, c_char_p -+from ctypes.util import find_library -+import fcntl - import os -+import re - import socket --import fcntl - import struct - --from ctypes import cdll, cast, pointer --from ctypes import c_int, c_ulong, c_char_p --from ctypes.util import find_library -+from scapy.arch.bpf.consts import BIOCSETF, SIOCGIFFLAGS, BIOCSETIF -+from scapy.arch.common import get_if, compile_filter -+from scapy.config import conf -+from scapy.consts import LOOPBACK_NAME -+from scapy.data import ARPHDR_LOOPBACK, ARPHDR_ETHER -+from scapy.error import Scapy_Exception, warning - from scapy.modules.six.moves import range - - -@@ -126,6 +126,9 @@ def get_if_list(): - return interfaces - - -+_IFNUM = re.compile("([0-9]*)([ab]?)$") -+ -+ - def get_working_ifaces(): - """ - Returns an ordered list of interfaces that could be used with BPF. -@@ -156,24 +159,27 @@ def get_working_ifaces(): - if ifflags & 0x1: # IFF_UP - - # Get a BPF handle -- fd, _ = get_dev_bpf() -+ fd = get_dev_bpf()[0] - if fd is None: - raise Scapy_Exception("No /dev/bpf are available !") - - # Check if the interface can be used - try: -- fcntl.ioctl(fd, BIOCSETIF, struct.pack("16s16x", ifname.encode())) # noqa: E501 -- interfaces.append((ifname, int(ifname[-1]))) -+ fcntl.ioctl(fd, BIOCSETIF, struct.pack("16s16x", -+ ifname.encode())) - except IOError: - pass -- -- # Close the file descriptor -- os.close(fd) -+ else: -+ ifnum, ifab = _IFNUM.search(ifname).groups() -+ interfaces.append((ifname, int(ifnum) if ifnum else -1, ifab)) -+ finally: -+ # Close the file descriptor -+ os.close(fd) - - # Sort to mimic pcap_findalldevs() order -- interfaces.sort(key=lambda elt: elt[1]) -+ interfaces.sort(key=lambda elt: (elt[1], elt[2], elt[0])) - -- return interfaces -+ return [iface[0] for iface in interfaces] - - - def get_working_if(): -@@ -183,4 +189,4 @@ def get_working_if(): - if not ifaces: - # A better interface will be selected later using the routing table - return LOOPBACK_NAME -- return ifaces[0][0] -+ return ifaces[0] -diff --git test/bpf.uts test/bpf.uts -index 19e06bb14..45d36fd83 100644 ---- test/bpf.uts -+++ test/bpf.uts -@@ -47,12 +47,10 @@ len(iflist) > 0 - = Get working network interfaces - ~ needs_root - --from scapy.arch.bpf.core import get_working_ifaces -+from scapy.arch.bpf.core import get_working_if, get_working_ifaces - ifworking = get_working_ifaces() - assert len(ifworking) -- --from scapy.arch.bpf.core import get_working_if --assert len(ifworking) and get_working_if() == ifworking[0][0] -+assert get_working_if() == ifworking[0] - - - = Misc functions - -From afa5776ecf83f7a427fc1af763005fe249f450f9 Mon Sep 17 00:00:00 2001 -From: Pierre LALET <pierre.lalet@cea.fr> -Date: Wed, 17 Apr 2019 10:22:16 +0200 -Subject: [PATCH 2/2] BPF: test get_working_ifaces() - ---- - test/bpf.uts | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git test/bpf.uts test/bpf.uts -index 45d36fd83..23022530e 100644 ---- test/bpf.uts -+++ test/bpf.uts -@@ -53,6 +53,33 @@ assert len(ifworking) - assert get_working_if() == ifworking[0] - - -+= Get working network interfaces order -+ -+import mock -+from scapy.arch.bpf.core import get_working_ifaces -+ -+@mock.patch("scapy.arch.bpf.core.os.close") -+@mock.patch("scapy.arch.bpf.core.fcntl.ioctl") -+@mock.patch("scapy.arch.bpf.core.get_dev_bpf") -+@mock.patch("scapy.arch.bpf.core.get_if") -+@mock.patch("scapy.arch.bpf.core.get_if_list") -+@mock.patch("scapy.arch.bpf.core.os.getuid") -+def test_get_working_ifaces(mock_getuid, mock_get_if_list, mock_get_if, -+ mock_get_dev_bpf, mock_ioctl, mock_close): -+ mock_getuid.return_value = 0 -+ mock_get_if_list.return_value = ['igb0', 'em0', 'msk0', 'epair0a', 'igb1', -+ 'vlan20', 'igb10', 'igb2'] -+ mock_get_if.return_value = (b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -+ b'\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00' -+ b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -+ mock_get_dev_bpf.return_value = (31337,) -+ mock_ioctl.return_value = 0 -+ mock_close.return_value = 0 -+ return get_working_ifaces() -+ -+assert test_get_working_ifaces() == ['em0', 'igb0', 'msk0', 'epair0a', 'igb1', -+ 'igb2', 'igb10', 'vlan20'] -+ - = Misc functions - ~ needs_root - diff --git a/net/scapy/files/patch-scapy_config.py b/net/scapy/files/patch-scapy_config.py deleted file mode 100644 index 6867f0a8e97a..000000000000 --- a/net/scapy/files/patch-scapy_config.py +++ /dev/null @@ -1,23 +0,0 @@ ---- scapy/config.py.orig 2019-01-10 18:33:08 UTC -+++ scapy/config.py -@@ -16,7 +16,7 @@ import socket - import sys - - from scapy import VERSION, base_classes --from scapy.consts import DARWIN, WINDOWS, LINUX -+from scapy.consts import BSD, DARWIN, WINDOWS, LINUX - from scapy.data import ETHER_TYPES, IP_PROTOS, TCP_SERVICES, UDP_SERVICES, \ - MANUFDB - from scapy.error import log_scapy, warning, ScapyInvalidPlatformException -@@ -431,9 +431,9 @@ def _set_conf_sockets(): - """Populate the conf.L2Socket and conf.L3Socket - according to the various use_* parameters - """ -- if conf.use_bpf and not DARWIN: -+ if conf.use_bpf and not BSD: - Interceptor.set_from_hook(conf, "use_bpf", False) -- raise ScapyInvalidPlatformException("Darwin (OSX) only !") -+ raise ScapyInvalidPlatformException("BSD-like (OSX, *BSD...) only !") - if conf.use_winpcapy and not WINDOWS: - Interceptor.set_from_hook(conf, "use_winpcapy", False) - raise ScapyInvalidPlatformException("Windows only !") diff --git a/net/scapy/pkg-descr b/net/scapy/pkg-descr index f6c5e9af369c..cd2fed9d9a8f 100644 --- a/net/scapy/pkg-descr +++ b/net/scapy/pkg-descr @@ -11,4 +11,4 @@ tools can't handle, like sending invalid frames, injecting your own 802.11 frames, combining technics (VLAN hopping+ARP cache poisoning, VOIP decoding on WEP encrypted channel, ...), etc. -WWW: http://secdev.org/projects/scapy +WWW: http://scapy.net |