-
-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #863 from arkid15r/code-base-refactoring
Nettacker code base major refactoring
- Loading branch information
Showing
802 changed files
with
7,203 additions
and
5,561 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
name: CI/CD | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
run-pytest: | ||
name: Run pytest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade poetry | ||
poetry install --with test | ||
- name: Run tests | ||
run: | | ||
poetry run pytest | ||
build-package: | ||
name: Build package | ||
needs: run-pytest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade poetry | ||
poetry install | ||
- name: Build package | ||
run: | | ||
poetry build --no-interaction | ||
- name: Upload package artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
publish-to-test-pypi: | ||
name: Publish to Test PyPI | ||
|
||
if: | | ||
${{ | ||
github.repository == 'owasp/nettacker' && | ||
github.event_name == 'push' && | ||
github.ref_name == 'implement-package-publishing-poc' }} | ||
# environment: test | ||
needs: | ||
- build-package | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get package artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Publish package distributions to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
publish-to-pypi: | ||
name: Publish to PyPI | ||
if: | | ||
${{ github.repository == 'owasp/nettacker' && | ||
github.event_name == 'push' && | ||
github.ref_name == 'implement-package-publishing-poc' }} | ||
# environment: release | ||
needs: | ||
- build-package | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get package artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
test-docker-image: | ||
name: Test Docker image | ||
# needs: publish-to-pypi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/[email protected] | ||
|
||
- name: Build Docker image | ||
run: docker build . -t nettacker | ||
|
||
- name: Test help menu | ||
run: | | ||
docker run -e github_ci=true --rm nettacker \ | ||
poetry run python nettacker.py --help | ||
- name: Test help menu in Persian | ||
run: | | ||
docker run -e github_ci=true --rm nettacker \ | ||
poetry run python nettacker.py --help -L fa | ||
- name: Show all modules | ||
run: | | ||
docker run -e github_ci=true --rm nettacker \ | ||
poetry run python nettacker.py --show-all-modules | ||
- name: Show all profiles | ||
run: | | ||
docker run -e github_ci=true --rm nettacker \ | ||
poetry run python nettacker.py --show-all-profiles | ||
- name: Test all modules command + check if it's finish successfully + csv | ||
run: | | ||
docker run -e github_ci=true --rm -i nettacker \ | ||
poetry run python nettacker.py -i 127.0.0.1 -u user1,user2 -p pass1,pass2 -m all -g 21,25,80,443 \ | ||
-t 1000 -T 3 -o out.csv | ||
- name: Test all modules command + check if it's finish successfully + csv | ||
run: | | ||
docker run -e github_ci=true --rm -i nettacker \ | ||
poetry run python nettacker.py -i 127.0.0.1 -u user1,user2 -p pass1,pass2 -m all -g 21,25,80,443 \ | ||
-t 1000 -T 3 -o out.csv --skip-service-discovery | ||
- name: Test all modules command + check if it's finish successfully + with graph + Persian | ||
run: | | ||
docker run -e github_ci=true --rm -i nettacker \ | ||
poetry run python nettacker.py -i 127.0.0.1 -L fa -u user1,user2 -p pass1,pass2 --profile all \ | ||
-g 21,25,80,443 -t 1000 -T 3 --graph d3_tree_v2_graph -v | ||
- name: Test all modules command + check if it's finish successfully + with graph + Persian | ||
run: | | ||
docker run -e github_ci=true --rm -i nettacker \ | ||
poetry run python nettacker.py -i 127.0.0.1 -L fa -u user1,user2 -p pass1,pass2 --profile all \ | ||
-g 21,25,80,443 -t 1000 -T 3 --graph d3_tree_v2_graph -v --skip-service-discovery | ||
publish-to-docker-registry: | ||
name: Publish Docker image | ||
needs: | ||
- test-docker-image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: owasp/nettacker:dev |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-builtin-literals | ||
- id: check-yaml | ||
- id: fix-encoding-pragma | ||
args: | ||
- --remove | ||
- id: mixed-line-ending | ||
args: | ||
- --fix=lf | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.13 | ||
hooks: | ||
- id: ruff | ||
args: | ||
- --fix | ||
- id: ruff-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.