Defender Control

Joined
Sep 23, 2024
Messages
3
Reaction score
0
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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top