-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathav_check.py
More file actions
56 lines (50 loc) · 2.11 KB
/
av_check.py
File metadata and controls
56 lines (50 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import platform
import subprocess
import winreg
#script para verificar se o antivirus esta instalado
#antivirus detect para windows
def get_installed_antivirus():
try:
antivirus_list = []
# Conecta ao registro para verificar antivírus instalados
reg_path = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, reg_path) as key:
for i in range(0, winreg.QueryInfoKey(key)[0]):
subkey_name = winreg.EnumKey(key, i)
with winreg.OpenKey(key, subkey_name) as subkey:
try:
display_name = winreg.QueryValueEx(subkey, "DisplayName")[0]
if any(av in display_name.lower() for av in ["avast", "kaspersky", "mcafee", "bitdefender", "eset", "norton", "sophos"]):
antivirus_list.append(display_name)
except FileNotFoundError:
pass
return antivirus_list
except Exception as e:
print(f"Erro ao acessar o registro: {e}")
return []
def check_windows_defender():
try:
# Verifica o status do Windows Defender
command = [
"powershell",
"Get-MpComputerStatus | Select-Object -Property AMRunningMode,AMServiceEnabled"
]
result = subprocess.run(command, capture_output=True, text=True)
if result.returncode == 0 and "AMRunningMode" in result.stdout:
return "Windows Defender está ativo."
return "Windows Defender não está ativo."
except Exception as e:
return f"Erro ao verificar o Windows Defender: {e}"
if platform.system() == "Windows":
print("Verificando antivírus instalados...")
antiviruses = get_installed_antivirus()
if antiviruses:
print("Antivírus detectados:")
for av in antiviruses:
print(f"- {av}")
else:
print("Nenhum antivírus de terceiros detectado.")
print("\nVerificando Windows Defender...")
print(check_windows_defender())
else:
print("Este script é apenas para sistemas Windows.")