How orange-cyberdefense/arsenal works
Project type and purpose
• Arsenal is an open-source command-line tool (CLI) written in Python.
• Its purpose is to index, search, display and auto-inject pentest “cheat-sheet” commands into any shell or tmux pane.
File structure
• Top-level files and scripts: run, addalias.sh, pushtopip.sh, setup.py, pyproject.toml, requirements.txt.
• Main package: “arsenal/” contains:
• app.py and __main__.py: entry points
• modules/: code organized by responsibility (cheat.py, command.py, config.py, gui.py, check.py)
• data/cheats/: hierarchical Markdown/YAML cheat-sheet files
• A “my_cheats” folder for user-provided cheat sheets.
• CI config in .github/workflows.
• README, LICENSE, PKGBUILD, MANIFEST.in indicate packaging and distribution.
README for additional insights
• Arsenal reads .md/.rst/.yml formats, supports global variables, fzf integration, tmux pane injection via TIOCSTI ioctl.
• It uses Python libraries: PyYAML, possibly prompt_toolkit or curses for UI.
• Extensions: external cheat-paths via config.
Main components and interactions
a. User Interface
• CLI front-end, parses arguments and keypresses.
• Optionally invokes fzf (external fuzzy-finder).
b. Configuration Manager
• Loads CHEATS_PATHS, global variables, prefix settings.
c. Cheat Loader
• Scans file system folders (data/cheats, my_cheats, ~/.cheats).
• Parses Markdown, RST, YAML into in-memory structures.
d. Search & Selection Engine
• Hands off cheat list to fzf or built-in selector (gui module).
e. Command Builder
• Substitutes variables, default values, prefixes.
f. Injection Engine
• Uses termios.TIOCSTI via fcntl.ioctl to emulate keystrokes.
• Integrates with tmux (splitting panes, sending to other pane).
• Falls back to direct TTY IO if needed.
g. External Shell/Environment
• Any POSIX shell; commands appear in shell history.
• Optionally tmux server.
Architectural patterns and design principles
• Modular layering: separation between CLI parsing, configuration, data loading, search UI, command injection.
• Plugin/extension point for additional cheat paths.
• Single-process, synchronous flow (no microservices).
• Uses external tools (fzf, tmux) rather than rebuilding functionality.
• Lightweight, file-system as primary datastore.