Python:
import os
import tkinter as tk
from tkinter import messagebox
def disable_defender():
result = os.system("powershell -Command \"Start-Process powershell -ArgumentList 'Set-MpPreference -DisableRealtimeMonitoring $true' -Verb RunAs\"")
if result == 0:
messagebox.showinfo("Defender Control", "Windows Defender has been disabled.")
else:
messagebox.showerror("Defender Control", "Failed to disable Windows Defender. Try running as Administrator.")
def enable_defender():
result = os.system("powershell -Command \"Start-Process powershell -ArgumentList 'Set-MpPreference -DisableRealtimeMonitoring $false' -Verb RunAs\"")
if result == 0:
messagebox.showinfo("Defender Control", "Windows Defender has been enabled.")
else:
messagebox.showerror("Defender Control", "Failed to enable Windows Defender. Try running as Administrator.")
def check_defender_status():
status = os.popen("powershell -Command \"(Get-MpPreference).DisableRealtimeMonitoring\"").read().strip()
if status == "True":
messagebox.showinfo("Defender Control", "Windows Defender is currently disabled.")
else:
messagebox.showinfo("Defender Control", "Windows Defender is currently enabled.")
root = tk.Tk()
root.title("Defender Control v1.0")
root.geometry("300x150")
btn_disable = tk.Button(root, text="Disable Defender", width=25, command=disable_defender)
btn_disable.pack(pady=10)
btn_enable = tk.Button(root, text="Enable Defender", width=25, command=enable_defender)
btn_enable.pack(pady=10)
btn_check_status = tk.Button(root, text="Check Defender Status", width=25, command=check_defender_status)
btn_check_status.pack(pady=10)
root.mainloop()