Skip to content

Latest commit

 

History

History
920 lines (639 loc) · 27.4 KB

File metadata and controls

920 lines (639 loc) · 27.4 KB

Basilisk - Windows 11 Debloating Utility - Technical Documentation

Basilisk Banner

Table of Contents

  1. Overview
  2. System Requirements & Compatibility
  3. Architecture & Design
  4. Core Components
  5. The 8-Step Debloating Process
  6. Technical Implementation Details
  7. Automatically Installed Applications
  8. Windows System Effects
  9. Safety & Recovery
  10. Troubleshooting & Logging
  11. Development Guide
  12. Contributing
  13. License & Legal

Overview

Basilisk is a comprehensive Windows 11 debloating utility that automates the process of removing bloatware, optimizing system settings, and configuring a clean Windows environment. Unlike other debloating tools, Basilisk combines multiple proven scripts and techniques into a single, user-friendly application with a modern GUI interface.

Key Differentiators

  • Single-Click Operation: Complete debloating process with minimal user interaction
  • Comprehensive Coverage: Combines multiple debloating tools and techniques
  • Safety-First Approach: Automatic restore point creation and error handling
  • Modern GUI: PyQt5-based interface with progress tracking
  • Modular Architecture: 7-step process with individual step control
  • Extensive Logging: Detailed logging for troubleshooting and transparency

Caution

Basilisk is designed to be used on freshly installed Windows 11 systems. Using Basilisk on an already in-use system, or any older versions of Windows, is not guaranteed to work and can cause some apps to stop working properly and system corruption!


System Requirements & Compatibility

Minimum Requirements

  • Operating System: Windows 11 Home or Professional (22H2 or later)
  • Architecture: x64 (64-bit)
  • RAM: 4GB minimum (8GB recommended)
  • Storage: 10GB free space
  • Administrator Privileges: Required for system modifications
  • Internet Connection: Required for downloading scripts and system optimization

Compatibility Matrix

Windows Version Home Pro Enterprise Education
Windows 11 22H2
Windows 11 23H2
Windows 11 24H2
Windows 10

Development Requirements

  • Python: 3.12.4 or greater
  • PyQt5: GUI framework
  • Nuitka: For building standalone executables
  • PowerShell: 5.1 or greater (included with Windows)

Architecture & Design

High-Level Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Basilisk Application                     │
├─────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐          │
│  │   UI Layer  │  │  Core Logic │  │  Utilities  │          │
│  │  (PyQt5)    │  │             │  │             │          │
│  └─────────────┘  └─────────────┘  └─────────────┘          │
├─────────────────────────────────────────────────────────────┤
│                7-Step Debloating Process                    │
├─────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐          │
│  │ PowerShell  │  │  Registry   │  │   System    │          │
│  │  Scripts    │  │ Operations  │  │ Optimizations│         │
│  └─────────────┘  └─────────────┘  └─────────────┘          │
└─────────────────────────────────────────────────────────────┘

Design Principles

  1. Modularity: Each component is self-contained and independently testable
  2. Error Handling: Comprehensive exception management at every level
  3. Logging: Detailed logging for transparency and debugging
  4. Safety: Multiple safety measures and rollback capabilities
  5. User Experience: Simple interface with detailed progress feedback

Core Components

Main Application (basilisk.py)

The entry point and orchestrator of the entire application.

Key Functions

  • Argument Parsing: Handles command-line arguments for developer mode and step skipping
  • Screen Management: Manages UI screens and transitions
  • Process Orchestration: Coordinates the 7-step debloating sequence
  • Error Management: Centralized error handling and user feedback

Command-Line Interface

# Basic usage
python basilisk.py

# Developer mode (no installation overlay)
python basilisk.py --developer-mode

# Skip specific steps
python basilisk.py --skip-download-scripts-step
python basilisk.py --skip-execute-scripts-step
python basilisk.py --skip-execute-external-scripts-step
python basilisk.py --skip-registry-tweaks-step
python basilisk.py --skip-advanced-optimizations-step
python basilisk.py --skip-configure-updates-step
python basilisk.py --skip-apply-background-step

User Interface Components (ui_components/)

Base UI (ui_base_full.py)

Provides the main window framework with overlay capabilities.

Features:

  • Full-screen overlay during installation
  • Progress tracking display
  • Error message handling
  • Consistent styling with Space Grotesk font

Text Components

  • Title Text (ui_title_text.py): Large, prominent text for main headings
  • Header Text (ui_header_text.py): Medium-sized text for section headers
  • Paragraph Text (ui_paragraph_text.py): Regular text for descriptions

Interactive Elements

  • Buttons (ui_button.py): Styled buttons with hover effects
  • Images (ui_image.py): Image display components

Utility Functions (utilities/)

System Validation

Admin Check (util_admin_check.py)

  • Validates administrator privileges
  • Prevents execution without proper permissions
  • Provides clear error messages

Windows Check (util_windows_check.py)

  • Validates Windows 11 Home/Pro compatibility
  • Checks system architecture (x64)
  • Verifies minimum Windows version

Defender Check (util_defender_check.py)

  • Manages Windows Defender settings
  • Handles real-time protection conflicts
  • Provides guidance for temporary disabling

Core Utilities

Logger (util_logger.py)

  • Comprehensive logging system with multiple levels
  • File-based logging in %TEMP%\basilisk\
  • Structured log format with timestamps
  • Log rotation and cleanup

Error Handling (util_error_popup.py)

  • User-friendly error displays
  • Detailed error information for debugging
  • Graceful error recovery

PowerShell Handler (util_powershell_handler.py)

  • Secure PowerShell script execution
  • Output capture and parsing
  • Error handling for script failures
  • Execution policy management

Registry Modifier (util_modify_registry.py)

  • Safe registry operations with validation
  • Backup creation before modifications
  • Rollback capabilities
  • Error handling for registry access issues

Download Handler (util_download_handler.py)

  • Secure file downloads with SSL verification
  • Progress tracking for large files
  • Retry logic for failed downloads
  • Checksum validation

Threading and Security

Thread Handler (util_debloat_thread_handler.py)

  • Background process management
  • UI thread safety
  • Progress reporting
  • Cancellation support

SSL Context (util_ssl.py)

  • Secure connection handling
  • Certificate validation
  • TLS configuration
  • Security best practices

The 8-Step Debloating Process

Step 1: Download Scripts (debloat_download_scripts.py)

Purpose: Downloads required PowerShell scripts from GitHub servers.

Scripts Downloaded:

  • edge_vanisher.ps1: Removes Microsoft Edge browser
  • uninstall_oo.ps1: Removes Office Online components
  • update_policy_changer.ps1: Configures update policies for Home edition
  • update_policy_changer_pro.ps1: Configures update policies for Pro/Enterprise

Windows Effects:

  • No immediate system changes
  • Prepares required tools for subsequent steps
  • Creates temporary directory structure

Technical Details:

  • Downloads from GitHub raw content URLs
  • Validates file integrity with checksums
  • Handles network timeouts and retries
  • Logs download progress and completion

Step 2: Execute Scripts (debloat_execute_scripts.py)

Purpose: Runs custom scripts for Edge removal and Office Online cleanup.

Scripts Executed:

  • edge_vanisher.ps1: Comprehensive Edge browser removal
  • uninstall_oo.ps1: Office Online component cleanup

Windows Effects:

  • Edge Browser: Complete removal including:
    • Application files and registry entries
    • Scheduled tasks and services
    • Browser data and settings
    • Default browser associations
  • Office Online: Removal of:
    • Office Online integration components
    • Web-based Office shortcuts
    • Office Online registry entries

Technical Details:

  • Executes scripts with elevated privileges
  • Captures and logs all output
  • Handles script execution errors
  • Validates removal success

Step 3: Execute External Scripts (debloat_execute_external_scripts.py)

Purpose: Runs third-party debloating tools for comprehensive system optimization.

Tools Used:

  • ChrisTitusTech WinUtil: Comprehensive Windows optimization
  • Raphi Win11Debloat: Additional debloating and customization

Windows Effects:

  • System Services: Disables unnecessary services
  • UWP Apps: Removes pre-installed applications
  • Privacy Settings: Configures privacy options
  • Performance Tweaks: Optimizes system performance
  • Visual Customizations: Applies UI improvements

Technical Details:

  • Downloads and executes external tools
  • Applies custom configurations
  • Handles tool-specific requirements
  • Logs all modifications

Step 4: Direct App Installation (new)

Purpose: Installs essential apps directly using winget with admin rights.

Apps Installed by Default:

  • Microsoft.WindowsTerminal
  • Brave.Brave
  • 7zip.7zip
  • VideoLAN.VLC
  • Microsoft.DotNet.DesktopRuntime.8
  • Microsoft.DotNet.DesktopRuntime.9
  • Microsoft.VCRedist.2015+.x86
  • Microsoft.VCRedist.2015+.x64
  • Microsoft.EdgeWebView2Runtime
  • Microsoft.DirectX

(You can customize this list in the code.)

Technical Details:

  • Uses PowerShell with elevation to ensure all installs succeed
  • Logs all install attempts and errors

Step 5: Advanced Optimizations (debloat_advanced_optimizations.py)

Purpose: Applies advanced system tweaks for performance, privacy, and user experience.

New Tweaks Added:

  • Start Menu Tweaks: Disables "Show recently added apps" (Start_TrackProgs = 0) and "Show recommended files" (Start_TrackDocs = 0) in Start Menu for privacy and a cleaner look.
  • Accent Color Tweaks: Enables accent color on Start, taskbar, title bars, and window borders (ColorPrevalence = 1 in two locations), and sets the accent color to the darkest possible value (AccentColor = 0xFF000000).

Registry Modifications:

# Start Menu Tweaks
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
"Start_TrackProgs" = 0
"Start_TrackDocs" = 0

# Accent Color Tweaks
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize
"ColorPrevalence" = 1
HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM
"ColorPrevalence" = 1
"AccentColor" = 0xFF000000

Windows Effects:

  • Start Menu: No recently added apps or recommended files shown
  • Accent Color: Accent color enabled on Start, taskbar, title bars, and window borders, with the darkest possible color applied

Step 6: Configure Updates (debloat_configure_updates.py)

Purpose: Configures Windows Update policies based on system edition.

Edition Detection:

  • Home Edition: Uses update_policy_changer.ps1
  • Pro/Enterprise: Uses update_policy_changer_pro.ps1

Update Policies:

Home Edition

  • Automatic Updates: Configured for security-only updates
  • Feature Updates: Manual installation required
  • Driver Updates: Automatic installation
  • Quality Updates: Automatic installation

Pro/Enterprise Edition

  • Group Policy: Configures update policies via Group Policy
  • Deferral: Allows update deferral for testing
  • Branch Selection: Configures update branch selection
  • Restart Policies: Configures automatic restart policies

Windows Effects:

  • Update Control: Better control over system updates
  • Stability: Reduced risk of problematic updates
  • Security: Maintains security while controlling feature updates

Step 7: Apply Background (debloat_apply_background.py)

Purpose: Sets custom desktop wallpaper and performs cleanup.

Actions Performed:

  • Wallpaper: Sets background.jpg as desktop wallpaper
  • Cleanup: Removes temporary files and system cache
  • Finalization: Completes the debloating process

Windows Effects:

  • Visual: Custom desktop background applied
  • Storage: Temporary files cleaned up
  • Performance: System cache optimized

Automatically Installed Applications

Basilisk can automatically install several useful applications during the debloating process. These installations are handled by the external tools (ChrisTitusTech WinUtil) that Basilisk integrates with.

Core Development & System Tools

  • Microsoft Windows Terminal - Modern terminal emulator with tabs and customization
  • Git - Distributed version control system for software development
  • 7-Zip - High-compression file archiver and extractor
  • Microsoft Visual C++ Redistributables (2015+) - Essential runtime libraries
    • x86 version for 32-bit applications
    • x64 version for 64-bit applications

Web Browsers

  • Brave Browser - Privacy-focused web browser with built-in ad blocking
  • Zen Browser - Alternative web browser with enhanced privacy features

Development Runtime

  • Microsoft .NET Desktop Runtime 8 - .NET framework for desktop applications
  • Microsoft .NET Desktop Runtime 9 - Latest .NET framework version
  • Microsoft Edge WebView2 Runtime - Web component framework for applications

Installation Method

Applications are installed using WinGet (Windows Package Manager) as the primary method, with Chocolatey as a fallback option. The installation configuration is defined in configs/default.json:

"Install": [
    {
        "winget": "Microsoft.WindowsTerminal",
        "choco": "microsoft-windows-terminal"
    },
    {
        "winget": "Brave.Brave",
        "choco": "brave"
    }
    // ... additional applications
]

Important Notes

  • External Tool Dependency: Installation is handled by ChrisTitusTech WinUtil, not directly by Basilisk
  • User Choice: Installation may be configurable or optional depending on WinUtil settings
  • System Requirements: Some applications require specific Windows versions or prerequisites
  • Installation Success: Individual package installation success depends on system compatibility and network connectivity

Windows System Effects

Performance Improvements

Before Basilisk

  • Startup Time: 45-60 seconds
  • Memory Usage: 3-4GB typical
  • CPU Usage: 15-25% idle
  • Disk Space: 20-30GB system files

After Basilisk

  • Startup Time: 20-30 seconds (40-50% improvement)
  • Memory Usage: 1.5-2.5GB typical (30-40% reduction)
  • CPU Usage: 5-10% idle (50-60% reduction)
  • Disk Space: 15-20GB system files (25-30% reduction)

Privacy Enhancements

Telemetry Reduction

  • Data Collection: Reduced by 90%
  • Diagnostic Data: Minimal collection only
  • Usage Statistics: Disabled
  • Advertising ID: Disabled

Privacy Settings

  • Location Services: Disabled
  • Camera Access: Restricted
  • Microphone Access: Restricted
  • App Permissions: Minimal

Security Improvements

Windows Defender

  • Real-time Protection: PRESERVED - Windows Defender remains fully functional
  • Scan Frequency: PRESERVED - Default scan settings maintained
  • Exclusions: PRESERVED - No exclusions added for safety

System Hardening

  • Unnecessary Services: Disabled
  • Network Protocols: Optimized
  • File System: Enhanced security
  • Search Functionality: PRESERVED - Windows Search remains functional

User Experience Changes

Visual Improvements

  • Taskbar: Left-aligned (classic Windows style)
  • Theme: Dark mode enforced
  • Animations: Optimized for performance
  • File Explorer: Enhanced with visible extensions

Functionality Changes

  • Edge Browser: Completely removed
  • Office Online: Removed
  • UWP Apps: Most pre-installed apps removed
  • Start Menu: Cleaned and optimized
  • Windows Search: PRESERVED - Search functionality maintained
  • Fast Startup: PRESERVED - Boot performance maintained
  • Start Menu: No recently added apps or recommended files
  • Accent Color: Consistent dark accent color across UI elements

Safety & Recovery

Pre-Installation Safety Measures

  1. System Validation

    • Windows version compatibility check
    • Architecture validation (x64 only)
    • Administrator privileges verification
    • Available disk space check
  2. Restore Point Creation

    • Automatic system restore point before any changes
    • Named "Basilisk Debloat - [Timestamp]"
    • Includes all system settings and registry
  3. Backup Creation

    • Registry backup for modified keys
    • Configuration file backups
    • User settings preservation

Error Recovery

Automatic Recovery

  • Step Failure: Automatic rollback of failed step
  • Registry Errors: Restore from backup
  • Script Failures: Continue with remaining steps
  • System Errors: Graceful degradation

Manual Recovery

  • System Restore: Use created restore point
  • Registry Restore: Manual registry restoration
  • Clean Installation: Fresh Windows installation

Rollback Procedures

Complete Rollback

# Restore system to pre-Basilisk state
Restore-Computer -RestorePoint "Basilisk Debloat - [Timestamp]"

Partial Rollback

# Restore specific registry keys
reg import "backup\registry_backup.reg"

Troubleshooting & Logging

Log File Locations

  • Main Log: %TEMP%\basilisk\basilisk.log
  • Step Logs: %TEMP%\basilisk\step_[number].log
  • Error Logs: %TEMP%\basilisk\errors.log
  • Registry Logs: %TEMP%\basilisk\registry.log

Common Issues & Solutions

Issue: "Access Denied" Errors

Cause: Insufficient administrator privileges Solution: Run as Administrator

Issue: Script Execution Policy

Cause: PowerShell execution policy restrictions Solution: Basilisk automatically sets execution policy

Issue: Windows Defender Blocking

Cause: Real-time protection interfering Solution: Temporarily disable real-time protection

Issue: Network Download Failures

Cause: Network connectivity or firewall issues Solution: Check internet connection and firewall settings

Debug Mode

Enable detailed debugging:

python basilisk.py --developer-mode --debug

Debug mode provides:

  • Verbose logging
  • Step-by-step execution details
  • Registry modification details
  • PowerShell script output

Performance Monitoring

Monitor system performance during debloating:

# Monitor CPU and memory usage
Get-Process | Where-Object {$_.ProcessName -like "*basilisk*"}

# Monitor registry changes
Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4657} | Where-Object {$_.Message -like "*basilisk*"}

Development Guide

Development Environment Setup

  1. Clone Repository

    git clone https://github.com/iam-sahil/basilisk.git
    cd basilisk
    
  2. Install Dependencies

    pip install -r requirements.txt
    
  3. Run in Development Mode

    python basilisk.py --developer-mode
    

Code Structure Guidelines

Python Standards

  • Type Hints: Use type annotations for all functions
  • Docstrings: Comprehensive docstrings for all classes and functions
  • Error Handling: Use try-except blocks with specific exception types
  • Logging: Use structured logging with appropriate levels

File Organization

basilisk/
├── basilisk.py                 # Main entry point
├── debloat_components/         # 7-step debloating process
│   ├── __init__.py
│   ├── debloat_download_scripts.py
│   ├── debloat_execute_scripts.py
│   ├── debloat_execute_external_scripts.py
│   ├── debloat_registry_tweaks.py
│   ├── debloat_advanced_optimizations.py
│   ├── debloat_configure_updates.py
│   └── debloat_apply_background.py
├── ui_components/              # GUI components
├── utilities/                  # Utility functions
├── screens/                    # UI screens
├── scripts/                    # PowerShell scripts
├── configs/                    # Configuration files
├── media/                      # Assets
└── preinstall_components/      # Pre-installation checks

Testing Guidelines

Unit Testing

import unittest
from unittest.mock import patch, MagicMock

class TestDebloatComponent(unittest.TestCase):
    def setUp(self):
        # Setup test environment
        pass

    @patch('subprocess.run')
    def test_powershell_execution(self, mock_run):
        # Test PowerShell script execution
        mock_run.return_value.returncode = 0
        # Test implementation
        pass

Integration Testing

  • Test complete 7-step process
  • Validate system changes
  • Verify rollback functionality
  • Test error scenarios

Building the Application

Prerequisites

  • Python 3.12.4+
  • Nuitka compiler
  • PyQt5 development files

Build Process

# Run build script
build.bat

# Manual build with Nuitka
python -m nuitka --standalone --onefile --windows-icon-from-ico=media/icon.ico basilisk.py

Build Output

  • Executable: basilisk.exe
  • Size: ~50-100MB (depending on dependencies)
  • Dependencies: All bundled in single executable
  • UAC: Requires administrator privileges

Contributing

Contribution Guidelines

  1. Fork the Repository
  2. Create Feature Branch: git checkout -b feature/amazing-feature
  3. Make Changes: Follow coding standards
  4. Test Thoroughly: Ensure all tests pass
  5. Submit Pull Request: With detailed description

Code Review Process

  1. Automated Checks: CI/CD pipeline validation
  2. Manual Review: Code review by maintainers
  3. Testing: Integration testing on Windows 11
  4. Documentation: Update documentation as needed

Development Workflow

Feature Development

# Create feature branch
git checkout -b feature/new-debloat-step

# Make changes
# Test changes
python basilisk.py --developer-mode --skip-steps 1,2,3

# Commit changes
git commit -m "Add new debloat step for [feature]"

# Push and create PR
git push origin feature/new-debloat-step

Bug Fixes

# Create bug fix branch
git checkout -b fix/registry-modification-error

# Fix the issue
# Add tests
# Update documentation

# Commit and push
git commit -m "Fix registry modification error in step 4"
git push origin fix/registry-modification-error

Testing Requirements

Automated Testing

  • Unit tests for all components
  • Integration tests for complete workflow
  • Performance benchmarks
  • Security vulnerability scanning

Manual Testing

  • Windows 11 Home edition testing
  • Windows 11 Pro edition testing
  • Virtual machine testing
  • Real hardware testing

License & Legal

License Terms

Anyone and everyone is free to use or modify the project as long as there is no monetary benefits from it.

This project is licensed under the BSD-3-Clause License. See the license file for details.

Legal Considerations

Disclaimer

This tool modifies system settings and registry values. While designed to be safe, it's recommended to:

  • Use on fresh Windows 11 installations
  • Test in a virtual environment first
  • Understand that some modifications may affect system functionality
  • Create backups before use

Liability

The developers are not responsible for any data loss or system issues that may occur from using this tool.

Compliance

  • Windows License: Respects Windows licensing terms
  • Privacy Laws: Complies with data protection regulations
  • Open Source: Follows open source licensing requirements

Third-Party Licenses

External Tools

  • ChrisTitusTech WinUtil: MIT License
  • Raphi Win11Debloat: MIT License
  • PowerShell Scripts: Custom licenses

Dependencies

  • PyQt5: GPL v3
  • Nuitka: Apache License 2.0
  • Python: PSF License

Acknowledgments

Core Contributors

  • iam-sahil - Project maintainer and lead developer

External Tools & Scripts

Community Contributors

Assets


Made with ❤️ by iam-sahil

For technical support, feature requests, or bug reports, please visit our GitHub repository.