How securisec/chepy works
Project type and purpose
• Chepy is an open‐source Python library plus a CLI tool that mimics CyberChef’s data‐transformation “stacking” capabilities.
• Its purpose is to provide a pipeline‐based engine in pure Python, letting users load files or strings, apply a chain of modules (encoding, hashing, parsing, etc.), and emit results.
File structure
• Top‐level:
• cli.py – CLI entrypoint
• chepy/ – core package
– config.py – configuration loader
– core.py – pipeline orchestrator
– modules/ – built‐in operations (e.g., aritmeticlogic, compression, hashing)
– extras/ – additional utility recipes (e.g., bruteforce, crypto extras)
– chepy_plugins/ – extension folder for third‐party plugins
• tests/ & tests_plugins/ – unit and plugin tests
• docs/ – documentation sources
• Dockerfile, Makefile, setup.py, requirements.txt – build & deployment
README for additional insights
• Confirms a “stacking” pipeline pattern.
• Highlights plugin extensibility, CLI with autocompletion, pure‐Python speed, and optional standalone binary via PyInstaller.
Main components & their relationships
a. CLI layer (cli.py)
• Parses user arguments, autocompletes commands
• Invokes the Core Engine with an initial Chepy object (file path or input string)
b. Core Engine (chepy/core.py)
• Loads config (chepy/config.py), discovers built‐in modules and plugins
• Maintains a pipeline (chain of operations)
• Exposes fluent API (.load_file(), .reverse(), .rot_13(), …)
c. Module Library (chepy/modules/)
• Each module implements a single transformation
• Modules follow a consistent interface so the pipeline can invoke them generically
d. Extras Library (chepy/extras/)
• Higher‐level recipes or utilities that combine modules or provide specialized functionality
e. Plugin Manager (chepy/chepy_plugins/)
• Dynamically loads external plugin packages at startup
• Extends both the CLI and the core pipeline
f. Configuration subsystem (config.py)
• Reads default settings, plugin paths, user‐overrides
g. I/O and External Services
• File loader/saver modules (in core/modules)
• Networking modules support HTTP/S operations
h. Packaging & Deployment
• setup.py / setup.cfg for PyPI installation
• Dockerfile and Makefile for containerized builds
• PyInstaller for standalone binary
Architectural patterns & design principles
• Pipeline / Chain of Responsibility: each operation is a node in a linear chain.
• Plugin/Extension pattern: core package discovers and registers modules and extras as commands.
• Separation of concerns: CLI vs engine vs modules vs config vs plugins.
• Pure‐Python, single‐process, in‐memory transformation flow.