debloat_download_scripts.py

Path: /debloat_components/debloat_download_scripts.py

Overview

This component downloads a predefined set of PowerShell debloat scripts from the Raven Development Team’s remote repository into a temporary directory for later execution.

Purpose & Use Cases

Automate retrieval of the latest debloat scripts before applying system tweaks.

Ensure required PowerShell scripts are present locally, even in offline or restricted environments.

Dependencies

utilities.util_download_handler — handles downloading files from URLs.

utilities.util_error_popup — displays error dialogs on failure.

Configuration & Parameters

Parameter Type Description Default
TEMP (environment variable) string Directory in which scripts are downloaded (under a “talon” subfolder). System temporary directory

Usage Example

python debloat_download_scripts.py

Behavior & Implementation

When executed, the script defines a mapping of script filenames to their remote URLs. It determines a download directory by reading the TEMP environment variable (falling back to Python’s tempfile directory) and appending a talon subfolder. For each entry, it logs the download action, invokes download_file to fetch and save the file, then verifies the file’s existence. Upon success, it logs completion; otherwise it surfaces an error dialog and exits.

Error Handling

Nonzero return from download_file triggers sys.exit(1). Missing downloaded files or exceptions during download invoke show_error_popup (blocking the user if allowed) and then exit. All errors are also logged at the ERROR level.

Security Considerations

Scripts are fetched over HTTPS from a trusted Raven Development Team host. Ensure the download URLs are correct and HTTPS is enforced to prevent man-in-the-middle tampering. Downloads occur in a temporary directory; running the scripts later requires appropriate execution policy and elevated privileges.

Logging

Uses INFO level to report download start, successful completion of each script, and final success. Uses ERROR level to report missing config, download failures, or verification errors. Example messages:

INFO – Downloading https://…/edge_vanisher.ps1 -> edge_vanisher.ps1

ERROR – Downloaded file not found: C:\Temp\talon\edge_vanisher.ps1

Testing & Validation

Run python debloat_download_scripts.py and confirm the four PowerShell scripts appear in your %TEMP%\talon folder. To automate tests, mock download_file to simulate success and failure scenarios and assert correct exit codes and popups.

Author

Author: Raven Development Team