Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # Filename: get_sysinternals_suite.py
- # Version: 1.01
- # Author: Jeoi Reqi
- """
- GET SYSINTERNALS SUITE:
- - This script automates the download and extraction process for the Sysinternals Suite, a comprehensive package of advanced system utilities tailored for Windows OS.
- - These utilities are developed by Sysinternals, a company now owned by Microsoft since they acquired Winternals and its assets on July 18, 2006 .
- - They provide powerful tools for system administrators, IT professionals, and advanced users to manage, troubleshoot, diagnose, and optimize Windows-based systems.
- Requirements:
- - Python 3.x
- - Internet connectivity
- Usage:
- 1. Run the script using Python 3.
- 2. Ensure the download directory exists.
- 3. The script will download the Sysinternals Suite as a ZIP file to the specified download directory and extract it to the specified extraction directory.
- 4. The ZIP file will be removed after extraction.
- Notes:
- - Internet connectivity is required to download the Sysinternals Suite.
- - Elevated administrator permissions might be needed to write to certain directories.
- """
- import os
- import ssl
- import shutil
- import urllib.request
- def download_sysinternals_suite(download_dir):
- """
- Download the Sysinternals Suite ZIP file.
- Args:
- download_dir (str): The directory to save the downloaded ZIP file.
- Returns:
- str: The path to the downloaded ZIP file.
- """
- # Ensure the download directory exists
- if not os.path.exists(download_dir):
- os.makedirs(download_dir)
- url = "https://download.sysinternals.com/files/SysinternalsSuite.zip"
- download_path = os.path.join(download_dir, "SysinternalsSuite.zip")
- # Disable SSL certificate verification
- ssl_context = ssl.create_default_context()
- ssl_context.check_hostname = False
- ssl_context.verify_mode = ssl.CERT_NONE
- # Download the ZIP file
- with urllib.request.urlopen(url, context=ssl_context) as response, open(download_path, 'wb') as out_file:
- shutil.copyfileobj(response, out_file)
- return download_path
- # Function to extract SysInternals Suite (.zip) from path
- def extract_sysinternals_suite(zip_path, extract_dir):
- """
- Extract the Sysinternals Suite ZIP file.
- Args:
- zip_path (str): The path to the ZIP file.
- extract_dir (str): The directory to extract the contents to.
- """
- # Ensure the extraction directory exists
- if not os.path.exists(extract_dir):
- os.makedirs(extract_dir)
- # Extract the ZIP file
- shutil.unpack_archive(zip_path, extract_dir)
- def main():
- """
- Main function to download and extract the Sysinternals Suite.
- """
- # Directories
- download_dir = "C:\\Temp"
- extract_dir = "C:\\Sysinternals"
- # Download Sysinternals Suite
- print("\n\nDownloading the Sysinternals Suite...")
- zip_path = download_sysinternals_suite(download_dir)
- print(f"The Sysinternals Suite ZIP file has been successfully downloaded to: {zip_path}!")
- # Extract Sysinternals Suite
- print(f"\nExtracting the Sysinternals Suite ZIP file to: {extract_dir}...")
- extract_sysinternals_suite(zip_path, extract_dir)
- print(f"The Sysinternals Suite has been successfully extracted to: {extract_dir}!")
- # Remove the ZIP file
- print("\nRemoving the .zip file from {zip_path}...")
- os.remove(zip_path)
- print("The Sysinternals Suite ZIP file has been removed!")
- # Goodbye!
- print("\nThe program finished successfully.")
- print("Goodbye!\n\n")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement