forked from secdev/scapy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
192 lines (167 loc) · 6.37 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Scapy tox configuration file
# Copyright (C) 2020 Guillaume Valadon <[email protected]>
# Tox environments:
# py{version}-{os}-{non_root,root}
# In our testing, version can be 37 to 312 or py39 for pypy39
[tox]
# minversion = 4.0
skip_missing_interpreters = true
# envlist = default when doing 'tox'
envlist = py{37,38,39,310,311,312}-{linux,bsd,windows}-{non_root,root}
# Main tests
[testenv]
description = "Scapy unit tests"
allowlist_externals = sudo
parallel_show_output = true
package = wheel
passenv =
PATH
PWD
PROGRAMFILES
WINDIR
SYSTEMROOT
OPENSSL_CONF
# Used by scapy
SCAPY_USE_LIBPCAP
deps =
ipython
cryptography
coverage[toml]
python-can
# disabled on windows because they require c++ dependencies
# brotli 1.1.0 broken https://github.com/google/brotli/issues/1072
brotli < 1.1.0 ; sys_platform != 'win32'
zstandard ; sys_platform != 'win32'
platform =
linux: linux
bsd: (darwin|freebsd|openbsd|netbsd).*
windows: win32
commands =
linux-non_root: {envpython} {env:DISABLE_COVERAGE:-m coverage run} -m scapy.tools.UTscapy -c ./test/configs/linux.utsc -N {posargs}
linux-root: sudo -E {envpython} {env:DISABLE_COVERAGE:-m coverage run} -m scapy.tools.UTscapy -c ./test/configs/linux.utsc {posargs}
bsd-non_root: {envpython} {env:DISABLE_COVERAGE:-m coverage run} -m scapy.tools.UTscapy -c test/configs/bsd.utsc -K tshark -N {posargs}
bsd-root: sudo -E {envpython} {env:DISABLE_COVERAGE:-m coverage run} -m scapy.tools.UTscapy -c test/configs/bsd.utsc -K tshark {posargs}
windows: {envpython} {env:DISABLE_COVERAGE:-m coverage run} -m scapy.tools.UTscapy -c test/configs/windows.utsc {posargs}
{env:DISABLE_COVERAGE:coverage combine}
{env:DISABLE_COVERAGE:coverage xml -i}
# Variants of the main tests
[testenv:py38-isotp_kernel_module]
description = "Scapy unit tests - ISOTP Linux kernel module"
allowlist_externals = sudo
git
bash
lsmod
modprobe
passenv =
PATH
PWD
PROGRAMFILES
WINDIR
SYSTEMROOT
deps = {[testenv]deps}
commands =
sudo apt-get -qy install build-essential linux-headers-$(uname -r) linux-modules-extra-$(uname -r)
sudo -E modprobe can
git clone --depth=1 https://github.com/linux-can/can-utils.git /tmp/can-utils
bash -c "cd /tmp/can-utils; ./autogen.sh; ./configure; make; sudo make install"
git clone --depth=1 https://github.com/hartkopp/can-isotp.git /tmp/can-isotp
bash -c "cd /tmp/can-isotp; make; sudo make modules_install; sudo modprobe can_isotp || sudo insmod ./net/can/can-isotp.ko"
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]
description = "Scapy unit tests - pyca/cryptography variant"
sitepackages = true
deps =
commands =
python -c "import cryptography; print('DEBUG: cryptography %s' % cryptography.__version__)"
python -m scapy.tools.UTscapy -c ./test/configs/cryptography.utsc
# The files listed past the first argument of the sphinx-apidoc command are ignored
[testenv:apitree]
description = "Regenerates the API reference doc tree"
skip_install = true
changedir = {toxinidir}/doc/scapy
deps = sphinx
commands =
sphinx-apidoc -f --no-toc -d 1 --separate --module-first --templatedir=_templates --output-dir api ../../scapy ../../scapy/modules/ ../../scapy/libs/ ../../scapy/tools/ ../../scapy/arch/ ../../scapy/contrib/scada/* ../../scapy/layers/msrpce/raw/ ../../scapy/layers/msrpce/all.py ../../scapy/all.py ../../scapy/layers/all.py ../../scapy/compat.py
[testenv:mypy]
description = "Check Scapy compliance against static typing"
skip_install = true
deps = mypy==1.7.0
typing
commands = python .config/mypy/mypy_check.py linux
python .config/mypy/mypy_check.py win32
[testenv:docs]
description = "Build the docs"
deps =
extras = doc
changedir = {toxinidir}/doc/scapy
commands =
sphinx-build -W --keep-going -b html . _build/html
# Debug mode
[testenv:docs2]
description = "Build the docs without rebuilding the API tree"
skip_install = true
changedir = {toxinidir}/doc/scapy
deps = {[testenv:docs]deps}
allowlist_externals = sphinx-build
setenv =
SCAPY_APITREE = 0
commands =
sphinx-build -W --keep-going -b html . _build/html
[testenv:spell]
description = "Check code for Grammar mistakes"
skip_install = true
deps = codespell
# inet6, dhcp6 and the ipynb files contains french: ignore them
commands = codespell --ignore-words=.config/codespell_ignore.txt --skip="*.pyc,*.png,*.jpg,*.ods,*.raw,*.pdf,*.pcap,*.js,*.html,*.der,*_build*,*inet6.py,*dhcp6.py,*manuf.py,*tcpros.py,*.ipynb,*.svg,*.gif,*.obs,*.gz" scapy/ doc/ test/ .github/
[testenv:twine]
description = "Check Scapy code distribution"
skip_install = true
deps = twine
cmarkgfm
build
setenv = SCAPY_VERSION=3.0.0
commands = python -m build
twine check --strict dist/*
[testenv:gitarchive]
description = "Check Scapy git archive"
skip_install = true
allowlist_externals = git
commands = git version
git archive HEAD -o {envtmpdir}/scapy.tar
python -m pip install {envtmpdir}/scapy.tar
# Below: remove current folder from path to force use of installed Scapy
python -c "import sys; sys.path.remove(''); import scapy; print(scapy._version_from_git_archive())"
[testenv:flake8]
description = "Check Scapy code style & quality"
skip_install = true
deps = flake8<6.0.0
commands = flake8 scapy/
# flake8 configuration
[flake8]
ignore = E203, E731, W504, W503
max-line-length = 88
per-file-ignores =
scapy/all.py:F403,F401
scapy/asn1/mib.py:E501
scapy/contrib/automotive/obd/obd.py:F405,F403
scapy/contrib/automotive/obd/pid/pids.py:F405,F403
scapy/contrib/automotive/obd/scanner.py:F405,F403,E501
scapy/contrib/automotive/volkswagen/definitions.py:E501
scapy/contrib/eigrp.py:E501
scapy/contrib/geneve.py:E501
scapy/contrib/http2.py:F821
scapy/contrib/igmp.py:E501
scapy/contrib/scada/iec104/__init__.py:F405
scapy/layers/tls/all.py:F403
scapy/layers/tls/crypto/all.py:F403
scapy/layers/tls/crypto/md4.py:E741
scapy/libs/winpcapy.py:F405,F403,E501
scapy/libs/manuf.py:E501
scapy/tools/UTscapy.py:E501
exclude = scapy/libs/ethertypes.py,
scapy/layers/msrpce/raw/*