Skip to content

owasp-sbot/OSBot-PyQt6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

35 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

OSBot-PyQt6 - Web Content Capture

Python PyQt6 mitmproxy License

A powerful desktop application for capturing, analyzing, and modifying web content in real-time. Built with PyQt6 and an integrated mitmproxy server for comprehensive web traffic interception and modification.

๐ŸŽฏ Key Features

  • ๐ŸŒ Full Web Browser: Chromium-based browser with complete SSL/TLS interception
  • ๐Ÿ“ก Traffic Capture: Intercepts and saves all HTTP/HTTPS requests and responses
  • ๐Ÿ”„ Real-time Content Replacement: Modify web content on-the-fly using regex patterns
  • ๐Ÿ“ Organized Storage: Automatic content organization with detailed metadata
  • ๐Ÿ”’ Self-Contained: No system modifications or admin privileges required
  • ๐ŸŽจ Intuitive UI: Tabbed interface for browsing, capture logs, and rule management

๐Ÿš€ Quick Start

Prerequisites

pip install PyQt6 PyQt6-WebEngine mitmproxy fastapi uvicorn requests osbot-utils

Run the Application

cd osbot_pyqt6
python3 ./main_app.py

The application will start with:

  • Integrated mitmproxy on port 8080
  • FastAPI backend on port 8000
  • Browser with automatic proxy configuration

๐Ÿ“ธ Screenshots

Main Browser Interface

Main Browser with Content Replacement Web browser showing real-time content modification - notice how "Dinis" is replaced with "MODIFIED" throughout the page

Content Interception in Action

BBC Sports Interception BBC Sports page with injected warning banner demonstrating content modification capabilities

Rule Management Interface

Content Replacement Rules Configuration interface showing active replacement rules and statistics

๐Ÿ“Š Core Functionality

โœ… Integrated Components

  • Local mitmproxy server running within the Python application
  • SSL/TLS interception with automatic certificate handling
  • Content capture for all web traffic (HTML, JSON, CSS, JS, images, etc.)
  • Real-time content replacement using configurable regex patterns
  • Three-tab interface: Browser, Capture Log, and Content Replacement
  • FastAPI backend for content management and API access

โœ… Content Replacement System

  • JSON-based configuration stored in ./captures/replacements.json
  • Regex pattern matching with full flag support (IGNORECASE, MULTILINE, etc.)
  • Content-type filtering (HTML, JSON, CSS, JavaScript)
  • Live reload - changes take effect immediately
  • Visual indicators showing which content has been modified
  • Replacement statistics tracking

โœ… Capture Capabilities

  • Automatic content organization by flow ID
  • Complete metadata storage (headers, timestamps, status codes)
  • Content-aware file storage (HTML as .html, JSON as .json, etc.)
  • Performance optimized loading with duration tracking
  • Visual indicators (๐Ÿ”„ for modified content, ๐Ÿ“ก for original)

๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚        PyQt6 Desktop App            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚  โ”‚     QtWebEngine Browser         โ”‚โ”‚  
โ”‚  โ”‚   (SSL Bypass + Auto Proxy)     โ”‚โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚  โ”‚    Tab Interface                โ”‚โ”‚
โ”‚  โ”‚  โ€ข Browser                      โ”‚โ”‚
โ”‚  โ”‚  โ€ข Capture Log                  โ”‚โ”‚
โ”‚  โ”‚  โ€ข Content Replacement          โ”‚โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚ All Traffic
                  โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    Integrated mitmproxy Server      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚  โ”‚    ContentCaptureAddon          โ”‚โ”‚
โ”‚  โ”‚  โ€ข Intercepts requests/responsesโ”‚โ”‚  
โ”‚  โ”‚  โ€ข Applies replacements         โ”‚โ”‚
โ”‚  โ”‚  โ€ข Saves content & metadata     โ”‚โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚  โ”‚    ContentReplacer              โ”‚โ”‚
โ”‚  โ”‚  โ€ข Regex pattern matching       โ”‚โ”‚
โ”‚  โ”‚  โ€ข Content-type filtering       โ”‚โ”‚
โ”‚  โ”‚  โ€ข Real-time modification       โ”‚โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Storage Layer               โ”‚
โ”‚  โ€ข ./captures/[flow-id]/            โ”‚
โ”‚    - metadata.json                  โ”‚
โ”‚    - response.html/json/txt         โ”‚
โ”‚    - request.bin                    โ”‚
โ”‚  โ€ข ./captures/replacements.json     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“‚ Project Structure

OSBot-PyQt6/
โ”œโ”€โ”€ osbot_pyqt6/
โ”‚   โ”œโ”€โ”€ main_app.py                 # Main application entry point
โ”‚   โ”œโ”€โ”€ start_mitmproxy.py          # Integrated mitmproxy implementation
โ”‚   โ”œโ”€โ”€ content_replacer.py         # Content replacement engine
โ”‚   โ”œโ”€โ”€ server.py                   # FastAPI backend server
โ”‚   โ”œโ”€โ”€ Version.py                  # Version management
โ”‚   โ””โ”€โ”€ __init__.py                 # Package initialization
โ”‚
โ”œโ”€โ”€ captures/                       # Auto-created storage directory
โ”‚   โ”œโ”€โ”€ replacements.json           # Content replacement rules
โ”‚   โ””โ”€โ”€ [flow-id]/                  # Captured content by flow
โ”‚       โ”œโ”€โ”€ metadata.json
โ”‚       โ”œโ”€โ”€ response.html
โ”‚       โ””โ”€โ”€ request.bin
โ”‚
โ””โ”€โ”€ README.md                       # This file

๐ŸŽฎ Usage Examples

Basic Web Browsing with Capture

# Start the application
cd osbot_pyqt6
python3 ./main_app.py

# All web traffic is automatically captured
# Check the Capture Log tab to see intercepted requests

Content Replacement Configuration

{
  "replacements": [
    {
      "name": "Replace 'Dinis' with 'MODIFIED'",
      "pattern": "\\bDinis\\b",
      "replacement": "******MODIFIED****",
      "flags": ["IGNORECASE"],
      "content_types": ["text/html", "application/json"],
      "enabled": true,
      "description": "Example replacement"
    },
    {
      "name": "Add banner to HTML pages",
      "pattern": "(<body[^>]*>)",
      "replacement": "\\1<div style=\"background: black; color: white; padding: 10px; text-align: center;\">โš ๏ธ CONTENT MODIFIED BY PROXY โš ๏ธ</div>",
      "flags": ["IGNORECASE"],
      "content_types": ["text/html"],
      "enabled": true
    }
  ]
}

Command Line Options

# Custom ports
python3 ./main_app.py --api-port 8001 --proxy-port 8081

# Disable content replacement
python3 ./main_app.py --no-replacement

# Quiet mode (less verbose output)
python3 ./main_app.py --quiet

๐Ÿ”ง Configuration

Environment Variables

The application automatically sets up required environment variables for SSL bypass:

  • QTWEBENGINE_CHROMIUM_FLAGS: Comprehensive SSL and security bypass flags
  • QTWEBENGINE_DISABLE_SANDBOX: Disabled for development
  • QTWEBENGINE_REMOTE_DEBUGGING: Port 9222 for debugging

Content Replacement Rules

Each rule in replacements.json supports:

  • name: Descriptive name for the rule
  • pattern: Regular expression pattern
  • replacement: Replacement string (supports backreferences)
  • flags: Array of regex flags (IGNORECASE, MULTILINE, DOTALL, etc.)
  • content_types: Array of MIME types to apply the rule to
  • enabled: Boolean to enable/disable the rule
  • description: Optional description

๐Ÿ“ˆ Features in Action

Real-time Content Modification

  • Modify any text content as it passes through the proxy
  • See changes instantly in the browser
  • Visual indicators show modified content (๐Ÿ”„) vs original (๐Ÿ“ก)

Comprehensive Capture

  • Every request and response is captured
  • Organized storage with metadata
  • Quick access to captured content through the Capture Log tab

Easy Rule Management

  • Edit rules through the UI or directly in JSON
  • Reload rules without restarting the application
  • View statistics on rule applications

๐Ÿšง Troubleshooting

Common Issues

Browser doesn't load HTTPS sites:

  • Ensure mitmproxy is running (check Proxy status indicator)
  • SSL bypass is automatically configured

Content replacement not working:

  • Check that replacement is enabled (green status indicator)
  • Verify your regex patterns in the Content Replacement tab
  • Ensure the content type matches your rule configuration

Application won't start:

  • Install all dependencies: pip install PyQt6 PyQt6-WebEngine mitmproxy fastapi uvicorn requests osbot-utils
  • Check that ports 8080 (proxy) and 8000 (API) are available

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • mitmproxy team for the excellent proxy framework
  • PyQt6 for robust desktop application capabilities
  • FastAPI for the clean API framework
  • OWASP community for security research and tools

Note: This tool is intended for authorized security testing, web development, and research purposes only. Always ensure you have permission before intercepting or modifying web traffic.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •