Skip to content

About

Modular cybersecurity CLI framework with automated attack chains, module discovery, intelligence analysis, and an advanced interactive console.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

18 Commits

Folders and files

Repository files navigation

πŸ›‘οΈ Cyber Framework

Cyber Framework Banner

Python Platform License Status Maintained GitHub stars

A modular cybersecurity CLI framework written in Python designed for reconnaissance, scanning, vulnerability analysis, and automated attack chains.

The framework provides:

  • 🟒 Beginner Mode: Guided menu-driven interface
  • πŸ’» Advanced Console Mode: Metasploit-style interactive CLI
  • βš”οΈ Automated Attack Chain: Multi-stage reconnaissance and scanning workflows
  • πŸ“Š Attack Graph Visualization: Structural attack surface mapping
  • πŸ—„ SQLite Findings Database: Transaction-safe persistence and history tracking
  • πŸ“‹ Multi-Format Reporting: Text, JSON, and XSS-sanitized HTML report exports
  • πŸ›‘ Built-in Safety & Scope Enforcement: Strict authorization boundaries and opt-in intrusive testing

⭐ Why Cyber Framework

Most cybersecurity tools focus on a single capability such as scanning, exploitation, or reconnaissance.

Cyber Framework integrates multiple phases of a penetration testing workflow into a single modular CLI environment, enabling security researchers and students to simulate realistic attack pipelines.

Key objectives of the framework:

  • Provide a Metasploit-style learning platform
  • Demonstrate attack chain automation with safety boundaries
  • Enable modular security tool development with clean contracts
  • Provide an interactive penetration testing console with TAB auto-completion

This project is designed for:

  • Cybersecurity students
  • Ethical hackers
  • Security researchers
  • Developers building offensive and defensive security tools

πŸš€ Features

Core Framework

  • βœ… Beginner Mode (interactive guided menu)
  • βœ… Advanced Console Mode (interactive CLI with custom prompt)
  • βœ… Automatic Module Discovery (dynamic loading from modules/)
  • βœ… Automated Multi-stage Attack Chain (Recon -> Scan -> Web Scan)
  • βœ… Multi-Stage Pipeline Runner (run pipeline)
  • βœ… SQLite Persistent Scan Database (cyber_framework.db)
  • βœ… Atomic JSON Results & Session State Storage
  • βœ… Real-time Execution Spinners (honest status tracking)

Interactive Console Experience

  • ⌨️ TAB command auto-completion
  • 🧠 Syntax-highlighted commands
  • πŸ“œ Persistent command history (data/command_history.txt)
  • 🎯 Dynamic module prompt (cyber(recon)>)
  • πŸ“– Built-in Manual Viewer (man <module>)

Security Modules

  • πŸ” recon: Domain and DNS reconnaissance (theHarvester with native DNS fallback)
  • 🌐 scan: Network port and service scanning (unprivileged nmap with native TCP socket scanner fallback)
  • πŸ•Έ web_scan: Web vulnerability and header inspection (nikto with native HTTP security header inspection fallback)
  • ⚑ exploit: Targeted SQL injection testing (sqlmap, strictly requiring explicit intrusive authorization)
  • 🧠 intelligence: Empirical DNS and network service correlation distinguishing facts from heuristics

Advanced Capabilities

  • πŸ“Š Attack Graph Generation: Structural graph showing Target -> Port -> Service relationships (show graph)
  • πŸ“„ Multi-Format Reporting: Generate text, JSON, or styled HTML reports (report html)
  • ⏱ Task Scheduler: Background recurring scans (backed by apscheduler)
  • 🌍 Distributed Controller: Proof-of-concept socket agent for distributed scans (experimental, disabled by default)

πŸ” Security & Safety Architecture

Cyber Framework is designed with explicit defensive controls:

  1. Target Validation: All targets are strictly validated against injection characters (;, &, |, `, $, \n) and option injection (leading - or /).
  2. Scope Enforcement: Configured via config.json. Out-of-scope targets are rejected before executing any network operations.
  3. Opt-in Intrusive Testing: Exploitation actions are never executed automatically in default workflows. Intrusive testing requires explicit authorization (set intrusive true).
  4. Subprocess Argument Vectors: Subprocess calls avoid shell string interpolation (shell=False) with fixed timeouts to prevent hangs.
  5. Credential Redaction: Passwords, API tokens, and Basic Auth credentials are automatically scrubbed from runtime logs.

πŸ— Architecture

         +-------------------+
         |      main.py      |
         +---------+---------+
                   |
         +---------+---------+
         |                   |
         v                   v
 +---------------+   +---------------+
 | Beginner Mode |   | Advanced CLI  |
 +---------------+   +---------------+
         |                   |
         +---------+---------+
                   |
                   v
            +--------------+
            | Command      |
            | Parser       |
            +-------+------+
                    |
       +------------+-------------+
       |                          |
       v                          v
+---------------+          +---------------+
|  Core Engine  |          |    Modules    |
+---------------+          +---------------+
| Session State |          | recon         |
| Scope Policy  |          | scan          |
| Safe Runners  |          | web_scan      |
| Attack Chain  |          | exploit       |
| Pipeline      |          | intelligence  |
| Attack Graph  |          +---------------+
| Reporting     |
| SQLite DB     |
+---------------+

Detailed component descriptions are available in docs/architecture.md.


πŸ“ Project Structure

cyber-framework/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml             # GitHub Actions CI workflow (Python 3.10-3.12)
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ advanced_console.py    # Rich-enhanced interactive console
β”‚   β”œβ”€β”€ attack_chain.py        # Automated attack chain workflow
β”‚   β”œβ”€β”€ attack_graph.py        # Attack surface relationship graph
β”‚   β”œβ”€β”€ command_parser.py      # CLI command dispatch and parameter parser
β”‚   β”œβ”€β”€ console.py             # Base prompt-toolkit console loop
β”‚   β”œβ”€β”€ console_style.py       # Console styling and palette tokens
β”‚   β”œβ”€β”€ database.py            # SQLite connection, migration, and query layer
β”‚   β”œβ”€β”€ distributed_controller.py # Distributed socket worker controller (experimental)
β”‚   β”œβ”€β”€ intelligence_engine.py # Target profiling & empirical correlation
β”‚   β”œβ”€β”€ logger.py              # Log handler with automated secret scrubbing
β”‚   β”œβ”€β”€ man_viewer.py          # Terminal manual page reader
β”‚   β”œβ”€β”€ module_info.py         # Metadata registry for tools and commands
β”‚   β”œβ”€β”€ module_loader.py       # Dynamic module discovery and validation
β”‚   β”œβ”€β”€ os_detection.py        # OS environment and privilege detection
β”‚   β”œβ”€β”€ output.py              # Styled output panels and terminal banners
β”‚   β”œβ”€β”€ pipeline.py            # Multi-stage security assessment pipeline
β”‚   β”œβ”€β”€ progress_engine.py     # Real-time status execution spinners
β”‚   β”œβ”€β”€ report.py              # Text, JSON, and XSS-safe HTML report generator
β”‚   β”œβ”€β”€ scheduler.py           # Background scan job scheduler
β”‚   β”œβ”€β”€ session_manager.py     # Session target, scope, and intrusive state
β”‚   β”œβ”€β”€ syntax_highlighter.py  # Prompt-toolkit lexer for CLI commands
β”‚   β”œβ”€β”€ tool_detection.py      # External binary availability detector
β”‚   └── utils.py               # Target validator, scope policy, and safe runner
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ recon.py               # OSINT & DNS reconnaissance
β”‚   β”œβ”€β”€ scan.py                # Network port and service scanner
β”‚   β”œβ”€β”€ web_scan.py            # Web application security inspector
β”‚   β”œβ”€β”€ exploit.py             # Targeted SQL injection tester (opt-in)
β”‚   └── intelligence.py        # Target intelligence gathering
β”œβ”€β”€ man/
β”‚   β”œβ”€β”€ attack_chain.man       # Manual page for automated attack chain
β”‚   β”œβ”€β”€ exploit.man            # Manual page for exploit module
β”‚   β”œβ”€β”€ intelligence.man       # Manual page for intelligence module
β”‚   β”œβ”€β”€ recon.man              # Manual page for recon module
β”‚   β”œβ”€β”€ scan.man               # Manual page for scan module
β”‚   └── web_scan.man           # Manual page for web scan module
β”œβ”€β”€ ui/
β”‚   └── banner.py              # Framework startup banner
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ results.json           # Atomic JSON scan findings repository
β”‚   β”œβ”€β”€ sessions.json          # Persistent session cache
β”‚   └── command_history.txt    # Shell command history
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ architecture.md        # Comprehensive technical architecture
β”‚   └── usage.md               # User guide and command reference
β”œβ”€β”€ tests/                     # Automated test suite (84+ pytest tests)
β”œβ”€β”€ config.json                # Active configuration file
β”œβ”€β”€ config.example.json        # Template configuration file
β”œβ”€β”€ requirements.txt           # Production dependencies
β”œβ”€β”€ requirements-dev.txt       # Development & test dependencies
β”œβ”€β”€ LICENSE                    # MIT License
β”œβ”€β”€ README.md                  # Project overview and documentation
└── main.py                    # Framework entry point

βš™οΈ Installation

Prerequisites

  • Python: 3.10, 3.11, or 3.12
  • Operating System: Linux (Ubuntu, Debian, Kali, Arch) or Windows (10/11)
  • Git

1. Clone the repository

git clone https://github.com/Bhuvaneshkumar1/cyber-framework.git
cd cyber-framework

2. Create and activate a virtual environment

On Linux / macOS:

python3 -m venv venv
source venv/bin/activate

On Windows (PowerShell):

python -m venv venv
.\venv\Scripts\Activate.ps1

3. Install dependencies

pip install -r requirements.txt

(Optional) Install development and testing dependencies:

pip install -r requirements-dev.txt

πŸ”§ Configuration

The framework loads configuration from config.json in the project root:

{
  "scope": {
    "enforce_scope": true,
    "allowed_targets": [
      "localhost",
      "127.0.0.1",
      "::1"
    ]
  },
  "safety": {
    "allow_intrusive_actions": false,
    "subprocess_timeout_seconds": 30
  },
  "logging": {
    "file": "scan.log",
    "redact_secrets": true
  },
  "distributed": {
    "enabled": false,
    "bind_host": "127.0.0.1",
    "bind_port": 9090,
    "auth_token": ""
  }
}
  • scope.enforce_scope: When true, rejects targets not listed in allowed_targets.
  • safety.allow_intrusive_actions: Global safety switch for intrusive modules.
  • safety.subprocess_timeout_seconds: Maximum execution time per external process call.
  • logging.redact_secrets: Automatically masks passwords and API tokens in scan.log.

▢️ Running the Framework

Start Cyber Framework:

python main.py

You will be prompted to select an interface mode:

1. Beginner Mode
2. Advanced Console

🟒 Beginner Mode

Beginner mode provides a menu-driven, guided interface ideal for quick assessments or learning:

  1. Select Beginner Mode.
  2. Enter the target (e.g., 127.0.0.1 or example.com).
  3. Select an operation:
    • Recon
    • Scan
    • Web Scan
    • Exploit (requires confirmation)
    • Attack Chain
    • Full Pipeline

πŸ’» Advanced Console Mode

Advanced Console Mode provides an interactive shell with tab auto-completion, command history, and dynamic prompts.

Command Reference

Command Arguments Description
help, ? None Display available console commands
show modules None List all discovered security modules
show options None Display active target, module, and safety status
show info [module] View tool metadata and usage for a module
show graph None Visualize the attack surface relationship graph
show scans None Display recorded scan findings from the database
use <module> Select and switch into a specific module context
set target <target> Set target domain, IP, CIDR, or URL
set intrusive <true|false> Authorize or disable intrusive vulnerability actions
run None Execute the currently selected module
run pipeline [--exploit] Run the multi-stage assessment pipeline
run attack_chain [--exploit] Execute automated attack chain workflow
report [txt|json|html] Export assessment report to text, JSON, or HTML
man <module> View manual page for a module or workflow
back None Deselect current module and return to main prompt
clear None Clear terminal screen
exit, quit None Exit the framework

Interactive Walkthrough Example

cyber> show modules
Available Modules:
  - recon
  - scan
  - web_scan
  - exploit
  - intelligence

cyber> set target 127.0.0.1
[+] Target set to: 127.0.0.1

cyber> use scan
cyber(scan)> run
[*] Starting scan against 127.0.0.1...
[+] Discovered open port 80/tcp (http)
[+] Discovered open port 443/tcp (https)
[+] Scan findings saved to database.

cyber(scan)> show graph
Target: 127.0.0.1
  └── Port: 80/tcp (http)
  └── Port: 443/tcp (https)

cyber(scan)> report html
[+] HTML report generated successfully: reports/report_127.0.0.1_20261015.html

cyber(scan)> back
cyber> exit

πŸ§ͺ Automated Testing

Cyber Framework includes an extensive automated test suite covering target validation, subprocess safety, scope policies, database migrations, atomic I/O, manual pages, and module contracts.

Run the test suite with pytest:

python -m pytest tests -v

All 84+ tests pass across Windows and Linux environments without external tool dependencies.


πŸ›  Troubleshooting & Limitations

Symptom Cause Resolution
Target out of scope Scope enforcement is active in config.json Add the target to scope.allowed_targets or set "enforce_scope": false in config.json for authorized testing.
Exploit module refused Intrusive actions disabled by default Run set intrusive true in the console or set "allow_intrusive_actions": true in config.json.
External tool not found nmap, theHarvester, nikto, or sqlmap not in PATH Install external tools or rely on automatic native Python fallbacks for DNS and TCP port scanning.
Port scanning permissions Raw SYN scans require administrative privileges on some OS Cyber Framework defaults to unprivileged TCP connect (-sT) scans and native Python socket fallbacks.
Distributed controller Socket worker listener not running The distributed controller is an experimental proof-of-concept disabled by default. Run locally or configure distributed.enabled and auth_token in config.json.

⚠️ Disclaimer

This tool is designed strictly for educational purposes and authorized security assessments.

Do NOT use this tool against targets without prior written authorization from the system owners. The authors and contributors assume no liability for misuse or damage caused by this software.


πŸ”§ Roadmap & Planned Features

The following capabilities are planned for future major releases:

  • Real-time Web UI dashboard
  • Async distributed worker node orchestration
  • Dynamic CVSS scoring integration
  • Automated PDF report exports

πŸ“œ License

This project is licensed under the MIT License. See the LICENSE file for complete details.


πŸ‘¨β€πŸ’» Author

Bhuvaneshkumar β€” Modular Cybersecurity Framework

About

Modular cybersecurity CLI framework with automated attack chains, module discovery, intelligence analysis, and an advanced interactive console.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages