Advertisement
Python253

edge_neuter_cleanup

May 26th, 2025
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.33 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # Filename: edge_neuter_cleanup.py
  3. # Version: 1.1
  4. # Author: Jeoi Reqi
  5. # Description: Follow-up cleanup & verification script for the Edge Neutering Suite 2025.
  6.  
  7. import os
  8. import shutil
  9. import subprocess
  10. import time
  11.  
  12. EDGE_DIRS = [
  13.     os.path.join(os.getenv("ProgramFiles(x86)"), "Microsoft", "Edge"),
  14.     os.path.join(os.getenv("ProgramFiles"), "Microsoft", "Edge"),
  15.     os.path.join(os.getenv("LocalAppData"), "Microsoft", "Edge")
  16. ]
  17.  
  18. MSEDGE_PATH = os.path.join(os.getenv("ProgramFiles(x86)"), "Microsoft", "Edge", "Application", "msedge.exe")
  19. NOTEPAD_PATH = os.path.join(os.getenv("SystemRoot"), "System32", "notepad.exe")
  20.  
  21. def cleanup_edge_files():
  22.     print("[*] Attempting deep cleanup of Edge folders...")
  23.     for path in EDGE_DIRS:
  24.         if os.path.exists(path):
  25.             try:
  26.                 shutil.rmtree(path)
  27.                 print(f"[+] Deleted: {path}")
  28.             except Exception as e:
  29.                 print(f"[!] Could not delete: {path} — {e}")
  30.         else:
  31.             print(f"[-] Not found: {path}")
  32.     print("[*] Cleanup completed.")
  33.  
  34. def verify_neutering():
  35.     print("[*] Verifying Edge neutering status...")
  36.  
  37.     # Check if msedge.exe points to Notepad
  38.     if os.path.exists(MSEDGE_PATH):
  39.         try:
  40.             edge_stat = os.stat(MSEDGE_PATH)
  41.             note_stat = os.stat(NOTEPAD_PATH)
  42.  
  43.             if edge_stat.st_ino == note_stat.st_ino or edge_stat.st_size == note_stat.st_size:
  44.                 print("[+] msedge.exe is neutered (Notepad).")
  45.             else:
  46.                 print("[!] msedge.exe is NOT Notepad. Replacing...")
  47.                 replace_with_notepad()
  48.         except Exception as e:
  49.             print(f"[!] Error verifying msedge.exe: {e}")
  50.     else:
  51.         print("[-] msedge.exe not found. Likely removed.")
  52.  
  53. def replace_with_notepad():
  54.     try:
  55.         if os.path.exists(MSEDGE_PATH):
  56.             os.remove(MSEDGE_PATH)
  57.         shutil.copyfile(NOTEPAD_PATH, MSEDGE_PATH)
  58.         print("[+] Replaced msedge.exe with Notepad.")
  59.     except Exception as e:
  60.         print(f"[!] Failed to replace msedge.exe: {e}")
  61.  
  62. if __name__ == "__main__":
  63.     print("\n=== Edge Neutering Suite 2025 — Post-Reboot Cleanup Mode ===\n")
  64.     cleanup_edge_files()
  65.     time.sleep(1)
  66.     verify_neutering()
  67.     print("\n[*] Post-reboot cleanup completed.\n")
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement