Skip to content

Commit

Permalink
CP-Pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cavoq committed Sep 15, 2024
1 parent 8931147 commit 7642750
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 19 deletions.
84 changes: 67 additions & 17 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ on:
- master

jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.13.0rc2

- name: Install Dependencies
run: pip install -r requirements-dev.txt

- name: Install Linter
run: pre-commit install

- name: Lint Code
run: pre-commit run --all-files

test:
name: Run Tests
runs-on: ubuntu-latest
Expand All @@ -17,22 +39,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.13.0rc2

- name: Install Dependencies
run: pip install -r requirements.txt

- name: Install Test Dependencies
run: pip install -r requirements-dev.txt
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run Tests
run:
|
python -m unittest ntp_amplification_test.py
continue-on-error: true
run: python -m unittest ntp_amplification_test.py

lint:
name: Lint Code
publish:
name: Check Version and Publish
runs-on: ubuntu-latest

steps:
Expand All @@ -42,13 +60,45 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.13.0rc2

- name: Install Dependencies
run: pip install -r requirements-dev.txt
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Install Linter
run: pre-commit install
- name: Get Current Version
id: current_version
run: |
version=$(python -c "exec(open('version.py').read()); print(__version__)")
echo "Current version: $version"
echo "::set-output name=VERSION::$version"
- name: Lint Code
run: pre-commit run --all-files
- name: Check if Version is Incremented
id: version_check
run: |
git fetch origin master
git checkout master
cur_version=$(python -c "exec(open('ntp_amplification/version.py').read()); print(__version__)")
echo "Main branch version: $cur_version"
if [ "$cur_version" = "$version" ]; then
echo "Version has not been incremented, exiting..."
exit 1
else
echo "Version is incremented, proceeding..."
fi
- name: Push Changes to Repository
if: success()
env:
TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git checkout -b release
git add .
git commit -m "Release version ${{ steps.current_version.outputs.VERSION }}"
git push origin master
4 changes: 3 additions & 1 deletion ntp_amplification.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

from version import __version__

try:
from scapy.all import IP, UDP, Raw, send
except ImportError:
Expand Down Expand Up @@ -94,7 +96,7 @@ def is_ipv4(address: str):

def print_banner():
banner_text = "NTP-AMPLIFIER"
description_text = "NTP-Amplification Attack Tool v1.7.0"
description_text = f"NTP-Amplification Attack Tool v{__version__}"
usage_text = "USAGE: ntp_amplification [options] <target ip>"
options_text = """OPTIONS:
-h, --help: Show this help message and exit
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

__package__ = "ntp-amplification"
__version__ = "1.7.0"
from version import __version__

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
Expand Down
1 change: 1 addition & 0 deletions version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.7.1"

0 comments on commit 7642750

Please sign in to comment.