Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ jobs:
- name: Run Tox
run: UT_FLAGS="${{ matrix.flags }}" ./.config/ci/test.sh ${{ matrix.python }} ${{ matrix.mode }}
- name: Codecov
uses: codecov/codecov-action@v2
with:
file: /home/runner/work/scapy/scapy/.coverage
uses: codecov/codecov-action@v3

cryptography:
name: pyca/cryptography test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MANIFEST
*.egg-info/
test/*.html
.coverage*
coverage.xml
.tox
.ipynb_checkpoints
.mypy_cache
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ Other useful resources:

- [Scapy in 20 minutes](https://github.com/secdev/scapy/blob/master/doc/notebooks/Scapy%20in%2015%20minutes.ipynb)
- [Interactive tutorial](https://scapy.readthedocs.io/en/latest/usage.html#interactive-tutorial) (part of the documentation)
- [The quick demo: an interactive session](https://scapy.readthedocs.io/en/latest/introduction.html#quick-demo)
(some examples may be outdated)
- [The quick demo: an interactive session](https://scapy.readthedocs.io/en/latest/introduction.html#quick-demo) (some examples may be outdated)
- [HTTP/2 notebook](https://github.com/secdev/scapy/blob/master/doc/notebooks/HTTP_2_Tuto.ipynb)
- [TLS notebooks](https://github.com/secdev/scapy/blob/master/doc/notebooks/tls)

Expand Down
96 changes: 96 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
[build-system]
requires = [ "setuptools>=62.0.0" ]
build-backend = "setuptools.build_meta"

[project]
name = "scapy"
dynamic = [ "version", "readme" ]
authors = [
{ name="Philippe BIONDI" },
]
maintainers = [
{ name="Pierre LALET" },
{ name="Gabriel POTTER" },
{ name="Guillaume VALADON" },
]
license = { text="GPL-2.0-only" }
requires-python = ">=3.7, <4"
description = "Scapy: interactive packet manipulation tool"
keywords = [ "network" ]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Intended Audience :: System Administrators",
"Intended Audience :: Telecommunications Industry",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Security",
"Topic :: System :: Networking",
"Topic :: System :: Networking :: Monitoring",
]

[project.urls]
homepage = "https://scapy.net"
documentation = "https://scapy.readthedocs.io"
repository = "https://github.com/secdev/scapy"
changelog = "https://github.com/secdev/scapy/releases"

[project.scripts]
scapy = "scapy.main:interact"

[project.optional-dependencies]
basic = [ "ipython" ]
complete = [
"ipython",
"pyx",
"cryptography>=2.0",
"matplotlib",
]
docs = [
"sphinx>=3.0.0",
"sphinx_rtd_theme>=0.4.3",
"tox>=3.0.0",
]

# setuptools specific

[tool.setuptools]
zip-safe = false # We use __file__ in scapy/__init__.py, therefore Scapy isn't zip safe

[tool.setuptools.packages.find]
include = [
"scapy*",
]
exclude = [
"test*",
"doc*",
]

[tool.setuptools.dynamic]
version = { attr="scapy.VERSION" }

# coverage

[tool.coverage]
concurrency = "multiprocessing"
omit = [
# Scapy specific paths
"scapy/tools/UTscapy.py",
"test/*",
# Scapy external modules
"scapy/libs/six.py",
"scapy/libs/winpcapy.py",
"scapy/libs/ethertypes.py",
# .tox specific path
".tox/*",
# OS specific paths
"/private/*",
]
26 changes: 0 additions & 26 deletions setup.cfg

This file was deleted.

87 changes: 17 additions & 70 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#! /usr/bin/env python

"""
Distutils setup file for Scapy.
Setuptools setup file for Scapy.
"""

import io
import os
import sys

if sys.version_info[0] <= 2:
raise OSError("Scapy no longer supports Python 2 ! Please use Scapy 2.5.0")

try:
from setuptools import setup, find_packages
from setuptools import setup
from setuptools.command.sdist import sdist
except:
raise ImportError("setuptools is required to install scapy !")
import io
import os


def get_long_description():
"""Extract description from README.md, for PyPI's usage"""
"""
Extract description from README.md, for PyPI's usage
"""
def process_ignore_tags(buffer):
return "\n".join(
x for x in buffer.split("\n") if "<!-- ignore_ppi -->" not in x
Expand All @@ -31,78 +38,18 @@ def process_ignore_tags(buffer):


class SDist(sdist):

def make_release_tree(self, base_dir, files):
sdist.make_release_tree(self, base_dir, files)
"""
Modified sdist to create scapy/VERSION file
"""
def make_release_tree(self, base_dir, *args, **kwargs):
super(SDist, self).make_release_tree(base_dir, *args, **kwargs)
# ensure there's a scapy/VERSION file
fn = os.path.join(base_dir, 'scapy', 'VERSION')
with open(fn, 'w') as f:
f.write(__import__('scapy').VERSION)


# https://packaging.python.org/guides/distributing-packages-using-setuptools/
setup(
name='scapy',
version=__import__('scapy').VERSION,
packages=find_packages(exclude=["test"]),
data_files=[('share/man/man1', ["doc/scapy.1"])],
cmdclass={'sdist': SDist},
# Build starting scripts automatically
entry_points={
'console_scripts': [
'scapy = scapy.main:interact'
]
},
python_requires='>=3.7, <4',
# pip > 9 handles all the versioning
extras_require={
'basic': ["ipython"],
'complete': [
'ipython',
'pyx',
'cryptography>=2.0',
'matplotlib'
],
'docs': [
'sphinx>=3.0.0',
'sphinx_rtd_theme>=0.4.3',
'tox>=3.0.0'
]
},
# We use __file__ in scapy/__init__.py, therefore Scapy isn't zip safe
zip_safe=False,

# Metadata
author='Philippe BIONDI',
author_email='phil(at)secdev.org',
maintainer='Pierre LALET, Gabriel POTTER, Guillaume VALADON',
description='Scapy: interactive packet manipulation tool',
long_description=get_long_description(),
long_description_content_type='text/markdown',
license='GPL-2.0-only',
url='https://scapy.net',
project_urls={
'Documentation': 'https://scapy.readthedocs.io',
'Source Code': 'https://github.com/secdev/scapy/',
},
download_url='https://github.com/secdev/scapy/tarball/master',
keywords=["network"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Intended Audience :: System Administrators",
"Intended Audience :: Telecommunications Industry",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Security",
"Topic :: System :: Networking",
"Topic :: System :: Networking :: Monitoring",
]
)
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
envlist = py{27,34,35,36,37,38,39,310,py27,py39}-{linux,bsd}_{non_root,root},
py{27,34,35,36,37,38,39,310,py27,py39}-windows,
skip_missing_interpreters = true
minversion = 2.9
minversion = 4.0

# Main tests

[testenv]
description = "Scapy unit tests"
allowlist_externals = sudo
parallel_show_output = true
package = wheel
passenv =
PATH
PWD
Expand All @@ -28,7 +29,7 @@ deps = mock
setuptools>=18.5
ipython
cryptography
coverage
coverage[toml]
python-can
# disabled on windows because they require c++ dependencies
brotli ; sys_platform != 'win32'
Expand All @@ -43,7 +44,7 @@ commands =
bsd_non_root: {envpython} {env:SCAPY_PY_OPTS:-m coverage run} -m scapy.tools.UTscapy -c test/configs/bsd.utsc -K manufdb -K tshark -N {posargs}
bsd_root: sudo -E {envpython} {env:SCAPY_PY_OPTS:-m coverage run} -m scapy.tools.UTscapy -c test/configs/bsd.utsc -K manufdb -K tshark {posargs}
windows: {envpython} {env:SCAPY_PY_OPTS:-m coverage run} -m scapy.tools.UTscapy -c test/configs/windows.utsc {posargs}
coverage combine
coverage xml -i

# Variants of the main tests

Expand Down Expand Up @@ -71,7 +72,7 @@ commands =
bash -c "rm -rf /tmp/can-utils /tmp/can-isotp"
lsmod
sudo -E {envpython} -m coverage run -m scapy.tools.UTscapy -c ./test/configs/linux.utsc {posargs}
coverage combine
coverage xml -i

# Test used by upstream pyca/cryptography
[testenv:cryptography]
Expand Down