GithubHelp home page GithubHelp logo

developerstoolbox / template-python-project Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 0.0 54 KB

A baseline for creating python projects for security projects.

License: MIT License

Python 100.00%
baseline offsensive-security security security-tools wolfsoftware defensive-security neutral-security

template-python-project's Introduction

GreyTeamToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

This is the template project template that we use internally when creating new python tools. It includes features such as argument parsing, configuration management, and a modular structure to facilitate scalable and maintainable code development.

We decided to make this available along with our other tools to allow people to use a well engineered starting point when creating their own tools.

We also proide 2 other templates which we use.

Features

  • Modular Architecture: Organize your code into modules for better maintainability.
  • Argument Parsing: Easily handle command-line arguments using argparse.
  • Configuration Management: Generate configuration objects from command-line arguments.
  • Custom Exceptions: Implement custom exceptions for specific error handling.

Installation

To install the template roject, clone the repository and navigate to the project directory:

git clone https://github.com/DevelopersToolbox/template-python-project.git
cd template-python-project

It is recommended to use a virtual environment to manage dependencies. You can create and activate a virtual environment using the following commands:

python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`

Install the required dependencies:

pip install -r requirements.txt

Usage

To run the template roject, execute the run function from the main script:

python main.py --required <value>

Command-Line Arguments

The application supports several command-line arguments:

  • -h, --help: Show help message and exit.
  • -d, --debug: Enable debug mode for verbose output.
  • -v, --verbose: Enable verbose output to show scan results as they come in.
  • -V, --version: Show the program's version number and exit.
  • -i, --optional-integer: An optional integer argument (default: 2).
  • -s, --optional-string: An optional string argument (default: "me").
  • -r, --required: A required string argument.

Example usage:

python main.py -r "required_value" -i 10 -s "optional_string"

Project Structure

The project is organized as follows:

template-python-project/
├── modules/
│   ├── __init__.py
│   ├── cli.py
│   ├── config.py
│   ├── exceptions.py
│   └── globals.py
├── main.py
├── requirements.txt
└── README.md
  • modules/: Contains the core modules of the application.
    • cli.py: Handles the command-line arguments and main program flow.
    • config.py: Handles configuration creation from command-line arguments.
    • exceptions.py: Handles custom exceptions.
    • globals.py: Defines global constants used across the application.
  • main.py: The main script that orchestrates argument parsing and program execution.
  • requirements.txt: Lists the dependencies required for the project.
  • README.md: The file you are currently reading.

template-python-project's People

Contributors

dependabot[bot] avatar tgwolf avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.