Skip to main content

This is an IPv4 and IPv6 calculator. It can validate IP address, convert then and also do net and subnet calculations.

Project description

My-Python-Template

Icon

GitHub Action CI GitHub Action CodeQL GitHub Action Trivy codecov

This an IP address calculator.

I'm a savy CyberSecurity professional, and the propose of this code is provide and an example and also incentivate my graduation students to develop tools and scripts in python to do defensive or ofensive security tasks.

Features:

  • Works with IPv6 and IPv4.
  • Convert address to decimal, hexadecimal and bnary form.
  • Valdiate addresses
  • Calculate nets (Broadcast, Network ID and avaliable host address)
  • Calculate Subnets

Demo

Install

You can use this tool in many ways:

Install from Repository

Run in Container

Build from Source Code

About this code

It uses Poetry for dependency management and includes pre-configured tools such as black, flake8, mypy, pylint, pytest, and others, for formatting, linting, testing, and documentation management. The project also includes security tools like trivy and bandit.

The pyproject.toml file contains various configurations like project metadata, dependencies, build system, and commands for release and documentation management.

To have more details, check the Documentation

Features

  • Project Management
    • Poetry
    • ✅ Script to manage project metadata (Name, Version, Description, etc)
    • ✅ Script to Upgrade all dependencies
    • ✅ Script to clean all temporary files
  • Code Formatting
  • Code Linting
  • Testing
    • Pytest
    • Coverage
    • ✅ Default tests structure folder for unit and functional tests
  • Security
  • Autoamtion commands
  • PyPI
    • ✅ Scripts to build and publish to PyPI
  • Docker
    • ✅ Scripts to build and publish to Docker Hub
  • Documentation
  • CI/CD
    • ✅ GitHub Actions to do CI/CD

Tasks

This project uses Taskipy to automate common development tasks.

All tasks are defined in the pypoject.toml file.

Almost all tools used in this project uses pyproject.toml to store their configurations.

List of preset tasks:

pre-commit      Run all pre-commit tasks
pre-release     Run all pre-release tasks
-----------     ----------------------------------------
info            Show project info
meta            Update project properties
upgrade         Upgrade all dependencies
sec             Run all security checks
format          Run all formaters
lint            Run all linters
bom             Generate BOM
req             Generate requirements.txt
test            Run all tests
pypi-build      Build package for PyPI
pypi-auth       Authenticate to PyPI
pypi-pub        Publish package to PyPI
docker-list     List docker images
docker-build    Build docker image
docker-sec-scan Scan a docker image looking for vulenrabilities
docker-auth     Authenticate to Docker Hub
docker-latest   Tag a docker image as latest
docker-pub      Publish docker image to Docker Hub
docs            Run docs server
docs-list       List docs versions
docs-build      Add a new version to docs
docs-delete     Delete a version of the docs
docs-latest     Set the latest Version.
docs-purge      Purge all versions of the docs.
docs-pub        Publish documentation to the doc branch on GitHub.
clean           Clean all generated files

Requirements

You must install manually the following tools:

Be sure you have installed all the requirements and that you on the desired python Version, you can check it with: python --version

Setup

# Clone the repository
git clone https://github.com/brunobotelhobr/My-IP-Calculator.git

# Check the python version, you must use the version that the project will use.
python -V

# Install the dependencies
pip install poetry
poetry shell
poetry install

# Check the taskipi commands:
task --list

# Update projetct metadata
task meta

How Start?

1. Fork the project

# Clone the repository
git clone

# Check the python version, you must use the version that the project will use.
python -V

# Install the dependencies
pip install poetry
poetry shell
poetry install

# Check the taskipi commands:
task --list

2. Create a new branch with your changes

# Create a new branch
git checkout -b <branch-name>

3. Make the changes and commit

# Check for lint errors
task format
task lint

# Check for security errors
task sec

# Update the meta
task meta
task bom
task req

# Add the changes
git add .

4. Open a Pull Request

git commit -m "feat: add a new feature"
git push origin <branch-name>

Hints

  • How add a Dev Package
    • poetry add --dev <package-name>
  • How add a Prod Package
    • poetry add <package-name>
  • How add a Package with extras
    • poetry add <package-name> -E <extras>
  • How remove a Package
    • poetry remove <package-name>

Call for Contributors

We invite you to contribute to this repository and help us make it even better. Whether it's bug fixes, new features, or documentation improvements, we welcome all contributions. Please read our documentation for guidelines on how to contribute. Happy coding!

check the Documentation for more details.

"Buy Me A Coffee"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

my_ip_calulator-0.0.2.tar.gz (12.9 kB view hashes)

Uploaded Source

Built Distribution

my_ip_calulator-0.0.2-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page