Skip to content

Commit

Permalink
Merge branch 'master' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
polybassa authored Feb 10, 2024
2 parents 1ee317c + 6829f4c commit 81a7975
Show file tree
Hide file tree
Showing 176 changed files with 29,383 additions and 6,072 deletions.
20 changes: 8 additions & 12 deletions .config/ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ then
fi

# Install on osx
if [ "${OSTYPE:0:6}" = "darwin" ] || [ "$TRAVIS_OS_NAME" = "osx" ]
if [ "${OSTYPE:0:6}" = "darwin" ]
then
if [ ! -z $SCAPY_USE_LIBPCAP ]
then
Expand All @@ -23,30 +23,26 @@ then
fi
fi

# Install wireshark data, ifconfig & vcan
if [ "$OSTYPE" = "linux-gnu" ] || [ "$TRAVIS_OS_NAME" = "linux" ]
# Install wireshark data, ifconfig, vcan, samba
if [ "$OSTYPE" = "linux-gnu" ]
then
sudo apt-get update
sudo apt-get -qy install tshark net-tools || exit 1
sudo apt-get -qy install can-utils || exit 1
sudo apt-get -qy install linux-modules-extra-$(uname -r) || exit 1
sudo apt-get -qy install samba smbclient
# Make sure libpcap is installed
if [ ! -z $SCAPY_USE_LIBPCAP ]
then
sudo apt-get -qy install libpcap-dev || exit 1
fi
fi

# On Travis, "osx" dependencies are installed in .travis.yml
if [ "$TRAVIS_OS_NAME" != "osx" ]
then
# Update pip & setuptools (tox uses those)
python -m pip install --upgrade pip setuptools --ignore-installed
# Update pip & setuptools (tox uses those)
python -m pip install --upgrade pip setuptools wheel --ignore-installed

# Make sure tox is installed and up to date
python -m pip install -U tox --ignore-installed
fi
# Make sure tox is installed and up to date
python -m pip install -U tox --ignore-installed

# Dump Environment (so that we can check PATH, UT_FLAGS, etc.)
openssl version
set
26 changes: 19 additions & 7 deletions .config/ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# ./test.sh 3.7 both
# ./test.sh 3.9 non_root

if [ "$OSTYPE" = "linux-gnu" ] || [ "$TRAVIS_OS_NAME" = "linux" ]
if [ "$OSTYPE" = "linux-gnu" ]
then
# Linux
OSTOX="linux"
Expand All @@ -18,13 +18,13 @@ then
sudo modprobe -n -v vcan
if [[ $? -ne 0 ]]
then
# The vcan module is currently unavailable on Travis-CI xenial builds
# The vcan module is currently unavailable on xenial builds
UT_FLAGS+=" -K vcan_socket"
fi
else
UT_FLAGS+=" -K vcan_socket"
fi
elif [[ "$OSTYPE" = "darwin"* ]] || [ "$TRAVIS_OS_NAME" = "osx" ] || [[ "$OSTYPE" = "FreeBSD" ]] || [[ "$OSTYPE" = *"bsd"* ]]
elif [[ "$OSTYPE" = "darwin"* ]] || [[ "$OSTYPE" = "FreeBSD" ]] || [[ "$OSTYPE" = *"bsd"* ]]
then
OSTOX="bsd"
# Travis CI in macOS 10.13+ can't load kexts. Need this for tuntaposx.
Expand Down Expand Up @@ -57,6 +57,11 @@ then
export DISABLE_COVERAGE=" "
fi

# macos -k scanner has glitchy coverage. skip it
if [ "$OSTOX" = "bsd" ] && [[ "$UT_FLAGS" = *"-k scanner"* ]]; then
export DISABLE_COVERAGE=" "
fi

# libpcap
if [[ ! -z "$SCAPY_USE_LIBPCAP" ]]; then
UT_FLAGS+=" -K veth"
Expand Down Expand Up @@ -84,25 +89,32 @@ if [ -z $TOXENV ]
then
case ${SCAPY_TOX_CHOSEN} in
both)
export TOXENV="${TESTVER}_non_root,${TESTVER}_root"
export TOXENV="${TESTVER}-non_root,${TESTVER}-root"
;;
root)
export TOXENV="${TESTVER}_root"
export TOXENV="${TESTVER}-root"
;;
*)
export TOXENV="${TESTVER}_non_root"
export TOXENV="${TESTVER}-non_root"
;;
esac
fi

# Configure OpenSSL
export OPENSSL_CONF=$(${PYTHON:=python} `dirname $BASH_SOURCE`/openssl.py)

# Dump vars (the others were already dumped in install.sh)
# Dump vars (environment is already entirely dumped in install.sh)
echo OSTOX=$OSTOX
echo UT_FLAGS=$UT_FLAGS
echo TOXENV=$TOXENV
echo OPENSSL_CONF=$OPENSSL_CONF
echo OPENSSL_VER=$(openssl version)
echo COVERAGE=$([ -z "$DISABLE_COVERAGE" ] && echo "enabled" || echo "disabled")

if [ "$OSTYPE" = "linux-gnu" ]
then
echo SMBCLIENT=$(smbclient -V)
fi

# Launch Scapy unit tests
TOX_PARALLEL_NO_SPINNER=1 tox -- ${UT_FLAGS} || exit 1
Expand Down
7 changes: 5 additions & 2 deletions .config/codespell_ignore.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
aci
ans
archtypes
applikation
archtypes
ba
browseable
byteorder
cace
cas
componet
comversion
cros
delt
doas
Expand All @@ -18,8 +20,9 @@ funktion
gost
hart
iff
interaktive
implementors
inout
interaktive
microsof
mitre
nd
Expand Down
3 changes: 3 additions & 0 deletions .config/mypy/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
ignore_errors = True
ignore_missing_imports = True

[mypy-scapy.libs.rfc3961]
warn_return_any = False

# Layers specific config

[mypy-scapy.arch.*]
Expand Down
12 changes: 11 additions & 1 deletion .config/mypy/mypy_enabled.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ scapy/__main__.py
scapy/all.py
scapy/ansmachine.py
scapy/arch/__init__.py
scapy/arch/bpf/__init__.py
scapy/arch/bpf/consts.py
scapy/arch/bpf/core.py
scapy/arch/bpf/supersocket.py
scapy/arch/common.py
scapy/arch/libpcap.py
scapy/arch/linux.py
scapy/arch/unix.py
scapy/arch/solaris.py
scapy/arch/unix.py
scapy/arch/windows/__init__.py
scapy/arch/windows/native.py
scapy/arch/windows/structures.py
Expand Down Expand Up @@ -87,7 +91,13 @@ scapy/contrib/roce.py
scapy/contrib/tcpao.py

# LIBS
scapy/libs/__init__.py
scapy/libs/ethertypes.py
scapy/libs/extcap.py
scapy/libs/matplot.py
scapy/libs/rfc3961.py
scapy/libs/structures.py
scapy/libs/test_pyx.py

# TEST
test/testsocket.py
Expand Down
51 changes: 26 additions & 25 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Scapy
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install tox
run: pip install tox
- name: Run flake8 tests
Expand All @@ -32,15 +32,16 @@ jobs:
- name: Run gitarchive check
run: tox -e gitarchive
docs:
# 'runs-on' and 'python-version' should match the ones defined in .readthedocs.yml
name: Build doc
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout Scapy
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install tox
run: pip install tox
- name: Build docs
Expand All @@ -50,11 +51,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Scapy
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install tox
run: pip install tox
- name: Run mypy
Expand All @@ -69,15 +70,15 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.7", "3.8", "3.9", "3.10"]
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
mode: [non_root]
installmode: ['']
flags: [" -K scanner"]
allow-failure: ['false']
include:
# Linux root tests
- os: ubuntu-latest
python: "3.10"
python: "3.12"
mode: root
flags: " -K scanner"
# PyPy tests: root only
Expand All @@ -87,18 +88,18 @@ jobs:
flags: " -K scanner"
# Libpcap test
- os: ubuntu-latest
python: "3.10"
python: "3.12"
mode: root
installmode: 'libpcap'
flags: " -K scanner"
# macOS tests
- os: macos-12
python: "3.10"
python: "3.12"
mode: both
flags: " -K scanner"
# Scanner tests
- os: ubuntu-latest
python: "3.10"
python: "3.12"
mode: root
allow-failure: 'true'
flags: " -k scanner"
Expand All @@ -108,37 +109,37 @@ jobs:
allow-failure: 'true'
flags: " -k scanner"
- os: macos-12
python: "3.10"
python: "3.12"
mode: both
allow-failure: 'true'
flags: " -k scanner"
steps:
- name: Checkout Scapy
uses: actions/checkout@v3
uses: actions/checkout@v4
# Codecov requires a fetch-depth > 1
with:
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Tox and any other packages
run: ./.config/ci/install.sh ${{ matrix.installmode }}
- name: Run Tox
run: UT_FLAGS="${{ matrix.flags }}" ./.config/ci/test.sh ${{ matrix.python }} ${{ matrix.mode }}
- name: Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4.0.0-beta.3

cryptography:
name: pyca/cryptography test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install tox
run: pip install tox
# pyca/cryptography's CI installs cryptography
Expand All @@ -156,12 +157,12 @@ jobs:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: 'python'
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ coverage.xml
.ipynb_checkpoints
.mypy_cache
.vscode
.DS_Store
[.]venv/
__pycache__/
doc/scapy/_build
Expand Down
12 changes: 9 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ formats:
- pdf

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.12"
# To show the correct Scapy version, we must unshallow
# https://docs.readthedocs.io/en/stable/build-customization.html#unshallow-git-clone
jobs:
post_checkout:
- git fetch --unshallow || true

# https://docs.readthedocs.io/en/stable/config-file/v2.html#python
python:
install:
- method: pip
path: .
extra_requirements:
- docs
- doc
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# <img src="https://github.com/secdev/scapy/raw/master/doc/scapy/graphics/scapy_logo.png" width="64" valign="middle" alt="Scapy" />&nbsp;&nbsp; Scapy

[![Scapy unit tests](https://github.com/secdev/scapy/workflows/Scapy%20unit%20tests/badge.svg?event=push)](https://github.com/secdev/scapy/actions?query=workflow%3A%22Scapy+unit+tests%22+branch%3Amaster+event%3Apush) <!-- ignore_ppi -->
[![Scapy unit tests](https://github.com/secdev/scapy/actions/workflows/unittests.yml/badge.svg?branch=master&event=push)](https://github.com/secdev/scapy/actions/workflows/unittests.yml?query=event%3Apush) <!-- ignore_ppi -->
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/os03daotfja0wtp7/branch/master?svg=true)](https://ci.appveyor.com/project/secdev/scapy/branch/master) <!-- ignore_ppi -->
[![Codecov Status](https://codecov.io/gh/secdev/scapy/branch/master/graph/badge.svg)](https://codecov.io/gh/secdev/scapy) <!-- ignore_ppi -->
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/30ee6772bb264a689a2604f5cdb0437b)](https://www.codacy.com/app/secdev/scapy) <!-- ignore_ppi -->
Expand All @@ -26,7 +26,7 @@ handle, like sending invalid frames, injecting your own 802.11 frames, combining
techniques (VLAN hopping+ARP cache poisoning, VoIP decoding on WEP protected
channel, ...), etc.

Scapy supports Python 2.7 and Python 3 (3.4 to 3.9). It's intended to
Scapy supports Python 3.7+. It's intended to
be cross platform, and runs on many different platforms (Linux, OSX,
\*BSD, and Windows).

Expand Down
Loading

0 comments on commit 81a7975

Please sign in to comment.