From 6fdb91b7076b2571514336b5050c707b30ed36d9 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Thu, 15 Oct 2020 09:22:40 -0700 Subject: [PATCH] RHEL 9.0.0 Alpha bootstrap The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/scapy#8dc1c42f94b7a283b0534c2673a5b3980e412828 --- .gitignore | 7 + scapy-2.2.0-subprocess-import.patch | 18 ++ scapy-2.2.0-xdg-open.patch | 24 ++ scapy-2.4.3-ethertypes.patch | 23 ++ scapy.spec | 361 ++++++++++++++++++++++++++++ sources | 1 + 6 files changed, 434 insertions(+) create mode 100644 scapy-2.2.0-subprocess-import.patch create mode 100644 scapy-2.2.0-xdg-open.patch create mode 100644 scapy-2.4.3-ethertypes.patch create mode 100644 scapy.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..c482645 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,7 @@ +scapy-2.0.0.10.tar.gz +/scapy-2.2.0.tar.gz +/scapy-2.3.1.zip +/scapy-2.3.3.tar.gz +/scapy-2.4.0rc5.tar.gz +/scapy-2.4.0.tar.gz +/scapy-2.4.3.tar.gz diff --git a/scapy-2.2.0-subprocess-import.patch b/scapy-2.2.0-subprocess-import.patch new file mode 100644 index 0000000..e3a82b1 --- /dev/null +++ b/scapy-2.2.0-subprocess-import.patch @@ -0,0 +1,18 @@ +# HG changeset patch +# User Jean-Michel +# Date 1400096697 -7200 +# Node ID 3bd59a1a75ff4a96e3f549840d27fe707d9f7b8c +# Parent 6dd464d5ac302325e9e06f9ee2cf1d8e81637554 +Adding missing import for psdump() and pdfdump() methods + +diff --git a/scapy/packet.py b/scapy/packet.py +--- a/scapy/packet.py ++++ b/scapy/packet.py +@@ -15,6 +15,7 @@ + from volatile import VolatileValue + from utils import import_hexcap,tex_escape,colgen,get_temp_file + from error import Scapy_Exception,log_runtime ++import subprocess + + try: + import pyx diff --git a/scapy-2.2.0-xdg-open.patch b/scapy-2.2.0-xdg-open.patch new file mode 100644 index 0000000..8edfde2 --- /dev/null +++ b/scapy-2.2.0-xdg-open.patch @@ -0,0 +1,24 @@ +# HG changeset patch +# User Lubomir Rintel +# Date 1411237938 -7200 +# Node ID 0ce553161b799e9dc91f63de73dfdb0f50360056 +# Parent ac04713bb61839a3476b72118e3d1c3ce5c81e86 +Do not default to acroread and gv + +They are not very likely to be present nowadays. Default to user's preferred +application instead. + +diff --git a/scapy/config.py b/scapy/config.py +--- a/scapy/config.py ++++ b/scapy/config.py +@@ -56,8 +56,8 @@ + + + class ProgPath(ConfClass): +- pdfreader = "acroread" +- psreader = "gv" ++ pdfreader = "xdg-open" ++ psreader = "xdg-open" + dot = "dot" + display = "display" + tcpdump = "tcpdump" diff --git a/scapy-2.4.3-ethertypes.patch b/scapy-2.4.3-ethertypes.patch new file mode 100644 index 0000000..c61a1a2 --- /dev/null +++ b/scapy-2.4.3-ethertypes.patch @@ -0,0 +1,23 @@ +https://github.com/secdev/scapy/commit/0c3d5e417bbd923c4729d15572c3d693d58aff81.patch +From 0c3d5e417bbd923c4729d15572c3d693d58aff81 Mon Sep 17 00:00:00 2001 +From: Gabriel +Date: Wed, 21 Aug 2019 18:18:14 +0800 +Subject: [PATCH] Small Python 2 fix + +--- + scapy/tools/generate_ethertypes.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scapy/tools/generate_ethertypes.py b/scapy/tools/generate_ethertypes.py +index 5bc5cdf98..47c38c4f9 100644 +--- a/scapy/tools/generate_ethertypes.py ++++ b/scapy/tools/generate_ethertypes.py +@@ -20,7 +20,7 @@ + with urllib.request.urlopen(URL) as stream: + DATA = stream.read() + +-reg = rb".*ETHERTYPE_([^\s]+)\s.0x([0-9A-Fa-f]+).*\/\*(.*)\*\/" ++reg = br".*ETHERTYPE_([^\s]+)\s.0x([0-9A-Fa-f]+).*\/\*(.*)\*\/" + COMPILED = b"""# + # Ethernet frame types + # This file describes some of the various Ethernet diff --git a/scapy.spec b/scapy.spec new file mode 100644 index 0000000..81daef9 --- /dev/null +++ b/scapy.spec @@ -0,0 +1,361 @@ +Name: scapy +Version: 2.4.3 +Release: 6%{?dist} +Summary: Interactive packet manipulation tool and network scanner + +%global gituser secdev +%global gitname scapy +%global commit 3047580162a9407ef05fe981983cacfa698f1159 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +License: GPLv2 +URL: http://www.secdev.org/projects/scapy/ +# https://github.com/secdev/scapy/releases +# https://bitbucket.org/secdev/scapy/pull-request/80 +# https://scapy.readthedocs.io/en/latest/introduction.html +Source0: https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0: https://github.com/secdev/scapy/commit/0c3d5e417bbd923c4729d15572c3d693d58aff81.patch#/scapy-2.4.3-ethertypes.patch + +%global common_desc %{expand: +Scapy is a powerful interactive packet manipulation program built on top +of the Python interpreter. It can be used to forge or decode packets of +a wide number of protocols, send them over the wire, capture them, match +requests and replies, and much more.} + + +# By default build with python3 subpackage +%bcond_without python3 + +# Build also the python2 package on releases up to fc31 and rhel8 +%if (0%{?fedora} && 0%{?fedora} <= 31 ) || ( 0%{?rhel} && 0%{?rhel} <= 8 ) +%bcond_without python2 +%else +%bcond_with python2 +%endif + +# By default build the documentation +%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} >= 8 ) +%bcond_without doc +%else +# Documentation build fails on rhel7 due to version of sphinx +%bcond_with doc +%endif + + + + +BuildArch: noarch + +BuildRequires: sed + +%if 0%{?with_python2} +BuildRequires: python2-devel +BuildRequires: python2-setuptools +%endif + +%if 0%{?with_python3} +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +%endif + +# Recommends only supported on fedora and rhel8+ +%if (0%{?fedora}) || ( 0%{?rhel} && 0%{?rhel} >= 8 ) +Recommends: tcpdump +# Using database of manufactures /usr/share/wireshark/manuf +Recommends: wireshark-cli +%endif + +%description %{common_desc} + +%if 0%{?with_python2} +%package -n python2-%{name} +Summary: Interactive packet manipulation tool and network scanner + +%{?python_provide:%python_provide python2-%{name}} + +%if (0%{?fedora}) || ( 0%{?rhel} && 0%{?rhel} >= 8 ) +Recommends: python2-pyx +Recommends: python2-matplotlib +Recommends: ipython2 +%endif + +%description -n python2-%{name} +%{common_desc} + +%endif + + +%if 0%{?with_python3} +%package -n python%{python3_pkgversion}-%{name} +Summary: Interactive packet manipulation tool and network scanner + +%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}} +Provides: %{name} = %{version}-%{release} + +%if (0%{?fedora}) || ( 0%{?rhel} && 0%{?rhel} >= 8 ) +Recommends: PyX +Recommends: python%{python3_pkgversion}-matplotlib +Recommends: ipython3 +%endif + +%description -n python%{python3_pkgversion}-%{name} +%{common_desc} +%endif + +%if 0%{?with_doc} +%package doc +Summary: Interactive packet manipulation tool and network scanner + +BuildRequires: python%{python3_pkgversion}-sphinx +BuildRequires: python%{python3_pkgversion}-sphinx_rtd_theme + +%description doc +%{common_desc} +%endif + + + +%prep +%autosetup -p 1 -n %{name}-%{version} + +# Remove shebang +# https://github.com/secdev/scapy/pull/2332 +SHEBANGS=$(find ./scapy -name '*.py' -print | xargs grep -l -e '^#!.*env python') +for FILE in $SHEBANGS ; do + sed -i.orig -e 1d "${FILE}" + touch -r "${FILE}.orig" "${FILE}" + rm "${FILE}.orig" +done + + + +%build +%if 0%{?with_python2} +%py2_build +%endif + +%if 0%{?with_python3} +%py3_build +%endif + +%if 0%{?with_doc} +make -C doc/scapy html BUILDDIR=_build_doc SPHINXBUILD=sphinx-build-%python3_version + +rm -f doc/scapy/_build_doc/html/.buildinfo +rm -f doc/scapy/_build_doc/html/_static/_dummy +%endif + + + +%install +install -dp -m0755 %{buildroot}%{_mandir}/man1 +install -Dp -m0644 doc/scapy.1* %{buildroot}%{_mandir}/man1/ + +%if 0%{?with_python2} +%py2_install +rm -f %{buildroot}%{python2_sitelib}/*egg-info/requires.txt + + +# Rename the executables +mv -f %{buildroot}%{_bindir}/scapy %{buildroot}%{_bindir}/scapy2 +mv -f %{buildroot}%{_bindir}/UTscapy %{buildroot}%{_bindir}/UTscapy2 + +%if ! 0%{?with_python3} +# Link the default to the py2 version of executables if py3 not built +ln -s %{_bindir}/scapy2 %{buildroot}%{_bindir}/scapy +ln -s %{_bindir}/UTscapy2 %{buildroot}%{_bindir}/UTscapy +%endif +%endif + +%if 0%{?with_python3} +%py3_install +rm -f %{buildroot}%{python3_sitelib}/*egg-info/requires.txt + +# Rename the executables +mv -f %{buildroot}%{_bindir}/scapy %{buildroot}%{_bindir}/scapy3 +mv -f %{buildroot}%{_bindir}/UTscapy %{buildroot}%{_bindir}/UTscapy3 + +# Link the default to the python3 version of executables +ln -s %{_bindir}/scapy3 %{buildroot}%{_bindir}/scapy +ln -s %{_bindir}/UTscapy3 %{buildroot}%{_bindir}/UTscapy +%endif + + + +# check +# TODO: Need to fix/remove slow/failed test +# cd test/ +# ./run_tests_py2 || true +# ./run_tests_py3 || true + + + +%if 0%{?with_python2} +%files -n python2-%{name} +%license LICENSE +%if ! 0%{?with_python3} +%doc %{_mandir}/man1/scapy.1* +%{_bindir}/scapy +%{_bindir}/UTscapy +%endif +%{_bindir}/scapy2 +%{_bindir}/UTscapy2 +%{python2_sitelib}/scapy/ +%{python2_sitelib}/scapy-*.egg-info +%endif + + + +%if 0%{?with_python3} +%files -n python%{python3_pkgversion}-%{name} +%license LICENSE +%doc %{_mandir}/man1/scapy.1* +%{_bindir}/scapy +%{_bindir}/UTscapy +%{_bindir}/scapy3 +%{_bindir}/UTscapy3 +%{python3_sitelib}/scapy/ +%{python3_sitelib}/scapy-*.egg-info +%endif + + +%if 0%{?with_doc} +%files doc +%doc doc/scapy/_build_doc/html +%endif + + +%changelog +* Wed Jul 29 2020 Fedora Release Engineering - 2.4.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 2.4.3-5 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 2.4.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Nov 08 2019 Michal Ambroz - 2.4.3-3 +- remove colliding manpage from python2 package +- add license files +- add doc subpackage +- remove shebangs + +* Sun Oct 06 2019 Michal Ambroz - 2.4.3-2 +- change to recommended python build dependencies for EPEL7 - thanks Miro Hroncok + +* Thu Sep 26 2019 Michal Ambroz - 2.4.3-1 +- bump to 2.4.3 release +- change the python2 to conditional build to be able to keep one spec for all +- add Recommends for dependencies, except for EPEL7 + +* Fri Sep 20 2019 Miro Hrončok - 2.4.0-8 +- Subpackage python2-scapy has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Mon Aug 19 2019 Miro Hrončok - 2.4.0-7 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 2.4.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 2.4.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jul 14 2018 Fedora Release Engineering - 2.4.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 2.4.0-3 +- Rebuilt for Python 3.7 + +* Mon Apr 30 2018 Michal Ambroz - 2.4.0-2 +- disable the test for now - there is too many failing (network) tests + +* Mon Apr 30 2018 Michal Ambroz - 2.4.0-1 +- bump to 2.4.0 release + +* Fri Mar 9 2018 Michal Ambroz - 2.4.0-0.rc5.1 +- bump to upstream 2.4.0 release candidate 5 +- enable separate python3 and python2 build + +* Fri Feb 09 2018 Fedora Release Engineering - 2.3.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jan 31 2018 Iryna Shcherbina - 2.3.3-3 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Thu Jul 27 2017 Fedora Release Engineering - 2.3.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue May 23 2017 Michal Ambroz - 2.3.3-1 +- bump to upstream 2.3.3 + +* Sat Feb 11 2017 Fedora Release Engineering - 2.3.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Jul 19 2016 Fedora Release Engineering - 2.3.1-3 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 2.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sat Dec 26 2015 Sven Lankes - 2.3.1-1 +- update to latest upstream release (2.3.1) +- Update to 2.3.1 +- Remove upstreamed patch +- Some spec fixes +- Thanks to Athmane Madjoudj for the patch + +* Fri Jun 19 2015 Fedora Release Engineering - 2.2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Oct 02 2014 Lubomir Rintel - 2.2.0-5 +- Fix psdump()/pdfdump() + +* Sun Jun 08 2014 Fedora Release Engineering - 2.2.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 2.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 2.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jul 22 2012 Sven Lankes - 2.2.0-1 +- Update to Scapy 2.2.0 +- Fixes rhbz #788659 - thanks to Thiébaud Weksteen + +* Sat Jul 21 2012 Fedora Release Engineering - 2.0.0.10-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 2.0.0.10-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Wed Feb 09 2011 Fedora Release Engineering - 2.0.0.10-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jul 22 2010 David Malcolm - 2.0.0.10-4 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Sun Jul 26 2009 Fedora Release Engineering - 2.0.0.10-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 2.0.0.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Dec 22 2008 Devan Goodwin 2.0.0.10-1 +- Update to Scapy 2.0.0.10. + +* Sun Dec 07 2008 Devan Goodwin 2.0.0.9-2 +- Update for Scapy 2.0.0.9. + +* Tue Jan 22 2008 Devan Goodwin 1.1.1-4 +- Switch to using rm macro. + +* Mon Jan 21 2008 Devan Goodwin 1.1.1-2 +- Spec file cleanup. + +* Fri Jan 18 2008 Devan Goodwin 1.1.1-1 +- Initial packaging for Fedora. + diff --git a/sources b/sources new file mode 100644 index 0000000..1a5d2d4 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (scapy-2.4.3.tar.gz) = 48bf86ed851f4b15d4f3b1e2668f1516fff712b67d709963cb986076cfeec0724e20b400a75368309f3d99a45d7b1082fd049fbb67edef0ab5d838e2ae141e44