Skip to main content

A modular, high-performance Windows Cleaner and Optimizer CLI tool

Project description

Nightmare Cleaner ๐ŸŒ™

A modular, high-performance Windows Cleaner and Optimizer CLI tool built with Python, featuring a beautiful purple/magenta themed UI.

Python License Platform Version

Features

  • Beautiful Purple/Magenta UI: Eye-catching terminal interface with rich formatting
  • Modular Cleaning System: Multiple specialized cleaning modules
  • High Performance: Fast scanning and cleaning operations
  • Detailed Statistics: Comprehensive reports on cleaned items and space recovered
  • Safe Operations: Dry-run mode to preview actions before execution
  • Administrator Detection: Automatic detection of privilege levels
  • System Information: Detailed system, memory, and disk usage information
  • Self-Update: Check for and install the latest version directly from the CLI
  • Program Uninstaller ๐Ÿ†•: Interactive uninstaller with normal/force modes and automatic leftover cleanup

Cleaning Modules

Nightmare Cleaner includes the following cleaning modules:

Module Description Requires Admin
windows-temp Windows system temporary files โœ…
user-temp User temporary files and folders โŒ
browser Browser cache (Chrome, Edge, Firefox) โŒ
windows-update Windows Update cache โœ…
prefetch Windows Prefetch files โœ…
recycle Recycle Bin contents โœ…
error-reports Windows Error Reports โŒ
thumbnails Windows thumbnail cache โŒ
logs Windows Log files โœ…
delivery-optimization Delivery Optimization cache โŒ
disk-cleanup Run Windows Disk Cleanup utility โœ…
dns-cache Clear DNS resolver cache โœ…
store-cache Windows Store cache โŒ
memory Flush working-set memory to free RAM โŒ
font-cache Windows font cache files โŒ
cdrive C:\ drive root junk (Windows.old, installer dumps, driver leftovers) โœ…

Installation

Install via PyPI (Recommended)

You can install the package directly from PyPI using pip:

pip install nightmare-cleaner

Local One-Command Installation

To install from the source directory with a single command, open an Administrator prompt (CMD or PowerShell) in the root directory:

install.bat

(This automatically elevates privileges, checks for Python, and installs the CLI).

Alternatively, using PowerShell:

.\install.ps1 -InstallPython

Manual Source Installation

# Clone the repository
git clone https://github.com/Moamen-R/Nightmare-Cleaning.git
cd Nightmare-Cleaning

# Install dependencies and the package
pip install -r requirements.txt
pip install -e .

Install Dependencies Only

pip install click colorama psutil rich

Usage

Basic Commands

Display Help

nightmare --help

Show Version

nightmare --version

Check for Updates

nightmare -u
# or
nightmare --update

Checks PyPI for the latest published version. If a newer version is available, you will be prompted to confirm the upgrade. The tool automatically downloads and installs the update via pip.

Display System Information

nightmare info

Shows detailed information about:

  • Operating system and version
  • Hardware specifications
  • Memory usage
  • Disk usage for all drives

List Available Modules

nightmare modules

Scanning

Scan All Modules

nightmare scan --all

Scan Specific Modules

nightmare scan -m windows-temp -m browser

Scan Single Module

nightmare scan -m user-temp

Cleaning

Clean All (with confirmation)

nightmare clean --all

Clean Specific Modules

nightmare clean -m windows-temp -m browser

Dry Run (Preview Only)

nightmare clean --all --dry-run

Clean Without Confirmation

nightmare clean --all -y

Uninstalling Programs

Interactive Uninstaller

nightmare uninstall

Launches an interactive session that:

  1. Scans the registry for all installed programs
  2. Displays them in a searchable Rich table
  3. Lets you select a program and choose an uninstall mode
  4. Cleans up all leftover files and registry entries

Search for a Specific Program

nightmare uninstall -s discord

Skip Confirmation Prompts

nightmare uninstall -y

Uninstall Modes

Mode Description
Normal Runs the program's official uninstaller (silent mode for MSI packages)
Force Kills running processes, deletes install directory, and purges all leftover files and registry entries

Screenshots

Banner

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                                                               โ•‘
โ•‘              โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—          โ•‘
โ•‘              โ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•          โ•‘
โ•‘              โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘             โ•‘
โ•‘              โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘             โ•‘
โ•‘              โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘             โ•‘
โ•‘              โ•šโ•โ•  โ•šโ•โ•โ•โ•โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ•   โ•šโ•โ•             โ•‘
โ•‘                                                               โ•‘
โ•‘              NIGHTMARE CLEANER & OPTIMIZER v2.0.0             โ•‘
โ•‘              Windows System Cleaner and Optimizer             โ•‘
โ•‘                                                               โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Architecture

Project Structure

nightmare-cleaner/
โ”œโ”€โ”€ nightmare_cleaner/
โ”‚   โ”œโ”€โ”€ __init__.py              # Package initialization
โ”‚   โ”œโ”€โ”€ cli.py                   # Main CLI interface
โ”‚   โ”œโ”€โ”€ ui.py                    # UI utilities and theming
โ”‚   โ”œโ”€โ”€ security.py              # Path validation and input sanitization
โ”‚   โ”œโ”€โ”€ audit_logger.py          # Audit logging for all operations
โ”‚   โ”œโ”€โ”€ system_info.py           # System information utilities
โ”‚   โ””โ”€โ”€ modules/
โ”‚       โ”œโ”€โ”€ __init__.py              # Base cleaning module
โ”‚       โ”œโ”€โ”€ windows_temp.py          # Windows temp files cleaner
โ”‚       โ”œโ”€โ”€ user_temp.py             # User temp files cleaner
โ”‚       โ”œโ”€โ”€ browser_cache.py         # Browser cache cleaner
โ”‚       โ”œโ”€โ”€ windows_update.py        # Windows Update cache cleaner
โ”‚       โ”œโ”€โ”€ prefetch.py              # Prefetch cleaner
โ”‚       โ”œโ”€โ”€ recycle_bin.py           # Recycle bin cleaner
โ”‚       โ”œโ”€โ”€ error_reports.py         # Error reports cleaner
โ”‚       โ”œโ”€โ”€ thumbnail_cache.py       # Thumbnail cache cleaner
โ”‚       โ”œโ”€โ”€ windows_logs.py          # Windows logs cleaner
โ”‚       โ”œโ”€โ”€ delivery_optimization.py # Delivery Optimization cleaner
โ”‚       โ”œโ”€โ”€ disk_cleanup.py          # Disk Cleanup utility runner
โ”‚       โ”œโ”€โ”€ dns_cache.py             # DNS cache cleaner
โ”‚       โ”œโ”€โ”€ store_cache.py           # Windows Store cache cleaner
โ”‚       โ”œโ”€โ”€ memory_cleaner.py        # RAM working-set flusher
โ”‚       โ”œโ”€โ”€ font_cache.py            # Font cache cleaner
โ”‚       โ”œโ”€โ”€ cdrive_cleaner.py        # C:\ drive root junk cleaner
โ”‚       โ””โ”€โ”€ uninstaller.py           # Program uninstaller module
โ”œโ”€โ”€ setup.py                     # Setup configuration
โ”œโ”€โ”€ pyproject.toml              # Project metadata
โ”œโ”€โ”€ requirements.txt            # Dependencies
โ”œโ”€โ”€ LICENSE                     # MIT License
โ””โ”€โ”€ README.md                   # Documentation

Modular Design

Each cleaning module inherits from the CleaningModule base class and implements:

  • scan(): Analyzes the system and identifies cleanable items
  • clean(): Removes identified items (with optional dry-run)
  • get_stats(): Returns statistics about the cleaning operation

Development

Adding a New Cleaning Module

  1. Create a new file in nightmare_cleaner/modules/
  2. Inherit from CleaningModule
  3. Implement scan() and clean() methods
  4. Register the module in cli.py

Example:

from . import CleaningModule
from typing import Tuple

class MyCustomCleaner(CleaningModule):
    def __init__(self):
        super().__init__()
        self.description = "My custom cleaner"

    def scan(self) -> Tuple[int, int]:
        # Implement scanning logic
        return count, size

    def clean(self, dry_run=False) -> Tuple[int, int]:
        # Implement cleaning logic
        return cleaned_count, cleaned_size

Safety Features

  • Dry Run Mode: Test cleaning operations without deleting files
  • Administrator Detection: Warns when not running with elevated privileges
  • Error Handling: Graceful handling of permission errors and file locks
  • Confirmation Prompts: Asks for confirmation before destructive operations
  • Path Validation: All file deletions pass through security.is_safe_path() checks
  • Audit Logging: Every deletion and registry operation is logged with timestamps
  • Protected Programs: The uninstaller blocks removal of critical system components: Python, pip, Nightmare, Windows, Microsoft, .NET, Visual C++, DirectX, NVIDIA/AMD/Intel Drivers

Requirements

  • Python 3.8+
  • click >= 8.1.7
  • colorama >= 0.4.6
  • psutil >= 5.9.8
  • rich >= 13.7.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

License

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

Disclaimer

This tool performs file deletion operations. While it includes safety features, always:

  • Review what will be deleted before confirming
  • Use dry-run mode first to preview operations
  • Keep backups of important data
  • Run with appropriate privileges

Made with ๐Ÿ’œ by Moamen-R & Mahmoud Osama

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nightmare_cleaner-2.0.1.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nightmare_cleaner-2.0.1-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file nightmare_cleaner-2.0.1.tar.gz.

File metadata

  • Download URL: nightmare_cleaner-2.0.1.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for nightmare_cleaner-2.0.1.tar.gz
Algorithm Hash digest
SHA256 79a1575e411bf3946c62f3d31ffe25ee0ece8a029ba01bbfa92e9fcfa2bad68f
MD5 dd7113d12aca74957100bf7eb385f735
BLAKE2b-256 fc28825b7f0c27110fed19fab503cd732b3b5d02350e3b5b1a19d83894e759b5

See more details on using hashes here.

File details

Details for the file nightmare_cleaner-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nightmare_cleaner-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81abd184ae53b295ff3551eaf5a4f7b908c173c057eec22a7fe63996d93a9da3
MD5 164fe1d4ecf4817b714f8556718a2274
BLAKE2b-256 9e4bbae44b13aa79eb5fb0f6c802be236b0df80a63d568162643167c0632cb5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page