Skip to content

Vah13/sncscan py3 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
115 changes: 59 additions & 56 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,130 +8,133 @@ on: [push, pull_request]
jobs:
health:
name: Check code health
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [2.7]
runs-on: ubuntu-latest
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

steps:
- name: Checkout pysap
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/checkout@v3

- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
python-version: "3.10"

- name: Install Python dependencies
run: |
python2 -m pip install --upgrade pip wheel
python2 -m pip install flake8 six
python2 -m pip install -r requirements.txt
- name: Run flake8 tests
python -m pip install flake8

- name: Check syntax errors
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

- name: Check PEP8 warnings
run: |
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
flake8 . --count --ignore=E501 --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 . --count --ignore=E1,E2,E3,E501,W291,W293 --exit-zero --max-complexity=65 --max-line-length=127 --statistics

test:
name: Run unit tests and build wheel
needs: health
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, macos-latest]
python-version: [2.7]
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
experimental: [false]
include:
- os: windows-latest
python-version: 2.7
experimental: true
continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout pysap
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install macOS dependencies
if: runner.os == 'macOS'
run: |
brew install openssl libdnet libpcap
- name: Install Windows dependencies
if: runner.os == 'Windows'
run: |
choco install vcredist2008 -f -y
choco install dotnet3.5 -f -y
(New-Object System.Net.WebClient).DownloadFile("https://web.archive.org/web/20200803210206if_/https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi", "VCForPython27.msi")
msiexec.exe /i VCForPython27.msi ALLUSERS=1 /qn /norestart

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r requirements.txt
python -m pip install --upgrade pip wheel tox tox-gh-actions
python -m pip install -r requirements.txt -r requirements-test.txt

- name: Run unit tests
run: |
python setup.py test
tox

- name: Build wheel artifact
run: |
python setup.py bdist_wheel
python -m pip wheel -w dist/ .

- name: Upload wheel artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: packages
path: dist/*.whl

docs:
name: Build documentation and source package
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7]
python-version: ["3.10"]

steps:
- name: Checkout pysap
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Linux dependencies
run: |
sudo apt-get install pandoc texlive-latex-base ghostscript

- name: Install Python dependencies
run: |
python2 -m pip install --upgrade pip wheel
python2 -m pip install -r requirements-docs.txt
python -m pip install --upgrade pip wheel tox tox-gh-actions
python -m pip install -r requirements-docs.txt

- name: Install the library
run: |
python2 setup.py install
python -m pip install .

- name: Pre-run documentation notebooks
run: |
python2 setup.py notebooks
tox -e notebooks

- name: Build source artifact
- name: Build documentation
run: |
python2 setup.py sdist
tox -e doc

- name: Build documentation
- name: Build source artifact
run: |
python2 setup.py doc
python setup.py sdist

- name: Upload source artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: packages
path: dist/*.tar.gz

release:
name: Release
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
needs: [test, docs]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'v') }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: packages
path: dist
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
version: 2

python:
version: 2.7
version: 3.10
install:
- method: pip
path: .
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pysap - Python library for crafting SAP's network protocols packets
===================================================================

[![Build and test pysap](https://github.com/OWASP/pysap/workflows/Build%20and%20test%20pysap/badge.svg)](https://github.com/OWASP/pysap/actions?query=workflow%3A%22Build+and+test+pysap%22)
[![Build and test pysap](https://github.com/OWASP/pysap/actions/workflows/build_and_test.yml/badge.svg?branch=master-0.2)](https://github.com/OWASP/pysap/actions/workflows/build_and_test.yml)
[![Latest Version](https://img.shields.io/pypi/v/pysap.svg)](https://pypi.python.org/pypi/pysap/)
[![Documentation Status](http://readthedocs.org/projects/pysap/badge/?version=latest)](http://pysap.readthedocs.io/en/latest/?badge=latest)

Version 0.1.20.dev0 (XXX 2023)
Version 0.2.1.dev0 (XXX 2023)

:information_source: [Python 3 port project](#Python3portproject)
:information_source: [This is the active branch of the Python 3 port project](#Python3portproject)


Overview
Expand Down Expand Up @@ -79,12 +79,7 @@ Roadmap

As time passed, and Python 2 started to loss relevance, we decided to start a new effort to complete the project and move the project to be Python 3 only compatible. The main reason is to avoid the introduction of backwards compatibility libraries that add complexity to the code and are not relevant in the current state of the Python project.

This project is actively being worked on right now by the OWASP CBAS project as part of the [master-0.2 branch](https://github.com/OWASP/pysap/tree/master-0.2)and tracked as a [project](https://github.com/OWASP/projects/12).

### Further efforts

The document

This is the active branch of the porting project being worked on by the OWASP CBAS project and tracked as a [project](https://github.com/OWASP/projects/12).


Documentation
Expand Down
98 changes: 11 additions & 87 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,96 +1,20 @@
# Makefile for Sphinx documentation
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
PAPER ?=
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Internal variables.
PAPEROPT_a4 = -D latex_elements.papersize=a4
PAPEROPT_letter = -D latex_elements.papersize=letter
# $(O) is meant as a shortcut for $(SPHINXOPTS)
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(O) $(SOURCEDIR)
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(O) $(SOURCEDIR)

.PHONY: help
# Put it first so that "make" without argument is like "make help".
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and an HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " lualatexpdf to make LaTeX files and run them through lualatex"
@echo " xelatexpdf to make LaTeX files and run them through xelatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
@echo " dummy to check syntax errors of document sources"

.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*

.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: lualatexpdf
lualatexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through lualatex..."
$(MAKE) PDFLATEX=lualatex -C $(BUILDDIR)/latex all-pdf
@echo "lualatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: xelatexpdf
xelatexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through xelatex..."
$(MAKE) PDFLATEX=xelatex -C $(BUILDDIR)/latex all-pdf
@echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx
.PHONY: Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
$(SPHINXBUILD) -b "$@" $(ALLSPHINXOPTS) "$(BUILDDIR)/$@"
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading
Loading