Nightmare Cleaner 🌙
A modular, high-performance Windows Cleaner and Optimizer CLI tool built with Python, featuring a beautiful purple/magenta themed UI.
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:
- Scans the registry for all installed programs
- Displays them in a searchable Rich table
- Lets you select a program and choose an uninstall mode
- 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 itemsclean(): Removes identified items (with optional dry-run)get_stats(): Returns statistics about the cleaning operation
Development
Adding a New Cleaning Module
- Create a new file in
nightmare_cleaner/modules/ - Inherit from
CleaningModule - Implement
scan()andclean()methods - 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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - 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
Metadata
Release files for nightmare-cleaner 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nightmare_cleaner-2.0.1.tar.gz | 33.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nightmare_cleaner-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.3 kB
Release files / nightmare_cleaner-2.0.1.tar.gz
| Download URL | nightmare_cleaner-2.0.1.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79a1575e411bf3946c62f3d31ffe25ee0ece8a029ba01bbfa92e9fcfa2bad68f
|
|
BLAKE2b-256 checksum How to use checksums |
fc28825b7f0c27110fed19fab503cd732b3b5d02350e3b5b1a19d83894e759b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / nightmare_cleaner-2.0.1-py3-none-any.whl
| Download URL | nightmare_cleaner-2.0.1-py3-none-any.whl |
|---|---|
| Size | 42.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81abd184ae53b295ff3551eaf5a4f7b908c173c057eec22a7fe63996d93a9da3
|
|
BLAKE2b-256 checksum How to use checksums |
9e4bbae44b13aa79eb5fb0f6c802be236b0df80a63d568162643167c0632cb5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|