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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79a1575e411bf3946c62f3d31ffe25ee0ece8a029ba01bbfa92e9fcfa2bad68f
|
|
| MD5 |
dd7113d12aca74957100bf7eb385f735
|
|
| BLAKE2b-256 |
fc28825b7f0c27110fed19fab503cd732b3b5d02350e3b5b1a19d83894e759b5
|
File details
Details for the file nightmare_cleaner-2.0.1-py3-none-any.whl.
File metadata
- Download URL: nightmare_cleaner-2.0.1-py3-none-any.whl
- Upload date:
- Size: 42.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81abd184ae53b295ff3551eaf5a4f7b908c173c057eec22a7fe63996d93a9da3
|
|
| MD5 |
164fe1d4ecf4817b714f8556718a2274
|
|
| BLAKE2b-256 |
9e4bbae44b13aa79eb5fb0f6c802be236b0df80a63d568162643167c0632cb5b
|