Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PenTestHub — Automated Web Application Vulnerability Scanner & Penetration Testing Framework

Python Flask Security AsyncIO Reports License: MIT

A multi-threaded web application security auditing framework featuring 12+ specialized vulnerability scanners (SQLi, XSS, RCE, SSRF, IDOR, Path Traversal), an interactive Web GUI, and automated CVSS-scored PDF/HTML vulnerability reporting.


Table of Contents


Overview

PenTestHub is an automated web penetration testing engine engineered in Python. It simplifies security posture assessments by combining high-speed asynchronous network probing with payload fuzzing across target web applications, REST APIs, and authentication endpoints.

Core Objectives

  • Comprehensive Attack Surface Discovery: Crawls web endpoints, form parameters, query strings, and JavaScript bundles.
  • Intelligent Payload Injection: Dispatches context-aware payloads to detect critical injection and logic flaws with minimal false positives.
  • Executive & Technical Reporting: Compiles categorized findings with CVSS v3.1 severity scores, proof-of-concept (PoC) payloads, and remediation guidance into PDF and HTML summaries.

System Architecture

flowchart TD
    subgraph Target["Target Scope"]
        TargetURL["Target Web Application / API Endpoint"]
    end

    subgraph Interface["User Control Interfaces"]
        CLI["CLI Command Hub (pentesthub.py)"]
        WebGUI["Interactive Web Dashboard (server.py / templates)"]
    end

    subgraph CoreEngine["Core Orchestrator (core/scanner.py)"]
        Crawler["Web Crawler & Form Parameter Extractor"]
        Dispatcher["Multi-Threaded Async Scanner Dispatcher"]
    end

    subgraph ScannerSuite["Modular Vulnerability Detection Modules"]
        SQLi["SQL Injection (sqli_scanner.py)"]
        XSS["Cross-Site Scripting (xss_scanner.py)"]
        RCE["Remote Code Execution (rce_scanner.py)"]
        SSRF["Server-Side Request Forgery (ssrf_scanner.py)"]
        IDOR["IDOR & Access Control (idor_scanner.py)"]
        Traversal["Path Traversal & LFI (traversal_scanner.py)"]
        CSRF["CSRF & Token Validation (csrf_scanner.py)"]
        Auth["Auth & Session Security (auth_scanner.py)"]
        Headers["Security Headers Audit (headers_scanner.py)"]
        JSScan["JavaScript Secret & Endpoint Scraper (js_scanner.py)"]
        Cookies["Cookie Flag Audit (cookies_scanner.py)"]
        Redirect["Open Redirect Detection (open_redirect_scanner.py)"]
    end

    subgraph Output["Vulnerability Reporting Engine"]
        ReportGen["Report Generator (reports/report_generator.py)"]
        HTMLRep["Interactive HTML Audit Report"]
        PDFRep["Executive PDF Vulnerability Report"]
    end

    CLI & WebGUI --> CoreEngine
    CoreEngine --> TargetURL
    TargetURL --> Crawler
    Crawler --> Dispatcher
    Dispatcher --> SQLi & XSS & RCE & SSRF & IDOR & Traversal & CSRF & Auth & Headers & JSScan & Cookies & Redirect
    SQLi & XSS & RCE & SSRF & IDOR & Traversal & CSRF & Auth & Headers & JSScan & Cookies & Redirect --> ReportGen
    ReportGen --> HTMLRep & PDFRep
Loading

Vulnerability Scanner Suite

Scanner Module Vulnerability Class Detection Methodology Severity
sqli_scanner.py SQL Injection (SQLi) Error-based heuristics, boolean differential analysis, time-based blind sleep injections. Critical
xss_scanner.py Cross-Site Scripting (XSS) Reflected payload reflection, DOM sink inspection, polyglot script injection. High
rce_scanner.py Command Execution (RCE) OS command separator fuzzing (` , ;, &&`), out-of-band execution triggers.
ssrf_scanner.py Server-Side Request Forgery Internal metadata endpoint targeting (169.254.169.254, localhost, 127.0.0.1). High
idor_scanner.py Broken Object Level Auth Sequential & UUID parameter fuzzing across unauthenticated/authenticated contexts. High
traversal_scanner.py Path Traversal / LFI Directory traversal string injection (../../../../etc/passwd, win.ini). High
csrf_scanner.py Cross-Site Request Forgery Form audit for missing, predictable, or unvalidated anti-CSRF tokens. Medium
auth_scanner.py Broken Authentication Credential rate-limiting verification, brute-force sensitivity, password policy checks. High
headers_scanner.py Misconfiguration Evaluates CSP, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy. Low / Info
js_scanner.py Information Disclosure Scrapes client JavaScript bundles for hardcoded API keys, bearer tokens, and internal routes. Medium
cookies_scanner.py Session Security Audits HttpOnly, Secure, and SameSite flags on session tokens. Medium
open_redirect_scanner.py Open Redirect Injects arbitrary external URLs into redirection query parameters (next=, url=, redirect=). Medium

OWASP Top 10 Coverage

PenTestHub maps directly to the OWASP Top 10 Web Application Security Risks:

  • A01:2021 — Broken Access Control: IDOR, Path Traversal, Open Redirect.
  • A02:2021 — Cryptographic Failures: Weak cookies, missing HSTS, exposed secrets in JS.
  • A03:2021 — Injection: SQL Injection, Remote Command Execution, Cross-Site Scripting.
  • A05:2021 — Security Misconfiguration: Missing security headers, permissive CORS policies.
  • A07:2021 — Identification & Authentication Failures: Auth brute-force, insecure session cookies.
  • A10:2021 — Server-Side Request Forgery (SSRF): Internal network probe payloads.

Execution Modes (CLI & Web GUI)

1. Web Dashboard (Flask GUI)

Start the local web dashboard for interactive point-and-click scanning:

python3 server.py

Navigate to http://127.0.0.1:5000 to configure target domains, select scanner modules, and view real-time vulnerability logs.

2. Command Line Interface (CLI)

# Execute a full scan on target URL
python3 pentesthub.py --url https://target.example.com --full

# Scan for specific vulnerability vectors
python3 pentesthub.py --url https://target.example.com --scan sqli,xss,headers

# Export audit report to PDF
python3 pentesthub.py --url https://target.example.com --full --report target_audit.pdf

Automated Audit Reports

The platform produces structured audit deliverables including:

  • Target Scope & Metadata (Scan duration, endpoints tested, HTTP status distribution).
  • Vulnerability Breakdown Chart by CVSS Severity (Critical, High, Medium, Low, Info).
  • Detailed Finding Cards:
    • Vulnerability Title & CVE/CWE Classification
    • Affected URL & Parameter
    • Exact Injected Payload
    • Remediation & Hardening Steps

Tech Stack

  • Language: Python 3.10+
  • Web Framework: Flask, Jinja2, HTML5/CSS3, Bootstrap
  • Networking: Requests, Urllib3, AsyncIO, BeautifulSoup4
  • PDF Generation: pdfkit, wkhtmltopdf
  • Testing: Pytest

Project Structure

pentesthub/
├── server.py                        # Flask Web Application Server & API
├── pentesthub.py                    # CLI Scanner Entry Point
├── requirements.txt                 # Python Dependencies
├── core/
│   └── scanner.py                   # Central Scanner Engine & Dispatcher
├── scanners/                        # Modular Vulnerability Detectors
│   ├── sqli_scanner.py              # SQL Injection Scanner
│   ├── xss_scanner.py               # Cross-Site Scripting Scanner
│   ├── rce_scanner.py               # Remote Code Execution Scanner
│   ├── ssrf_scanner.py              # SSRF Scanner
│   ├── idor_scanner.py              # IDOR Scanner
│   ├── traversal_scanner.py         # Directory Traversal Scanner
│   ├── csrf_scanner.py              # CSRF Token Validator
│   ├── auth_scanner.py              # Authentication Auditor
│   ├── headers_scanner.py           # Security Headers Analyzer
│   ├── cookies_scanner.py           # Cookie Flag Inspector
│   ├── js_scanner.py                # Client JS Secrets Scraper
│   └── open_redirect_scanner.py     # Open Redirect Detector
├── templates/                       # Web Dashboard Templates
│   ├── index.html                   # Scan Configuration Interface
│   └── result.html                  # Real-Time Results & Findings View
├── reports/                         # Audit Report Generation
│   └── report_generator.py          # PDF & HTML Report Compiler
└── utils/
    └── helpers.py                   # Formatting & HTTP Helpers

Getting Started

Prerequisites

  • Python 3.10 or higher
  • wkhtmltopdf (optional, for PDF report generation)

Installation

  1. Clone the repository:

    git clone https://github.com/a360n/pentesthub.git
    cd pentesthub
  2. Install dependencies:

    pip install -r requirements.txt
  3. Launch the Web Interface:

    python3 server.py

    Open http://localhost:5000 in your web browser.


Disclaimer & Legal Notice

This software is developed strictly for authorized educational research, defensive security assessments, and legitimate penetration testing on systems where you have explicit written permission from the asset owner. Unauthorized scanning, testing, or attacking of third-party systems without prior authorization is illegal. The author assumes no liability for misuse, damages, or legal repercussions resulting from the operation of this tool.


Author

Ali Nasser (Ali Al-Khazali)


License

This project is licensed under the MIT License — see the LICENSE file for details.

About

This tool is intended for educational purposes only. Unauthorized scanning of targets without permission is illegal. The developer assumes no liability for misuse or damages caused by this tool.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages