Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
isemennikov committed May 15, 2024
1 parent ace22de commit 5101dd3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Byte-compiled / optimized / DLL files
.idea_
.idea*
__pycache__/
*.py[cod]
*$py.class
Expand Down
32 changes: 32 additions & 0 deletions DetectAntivirusService.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import winreg

def check_auto_start_services(av_list_file):
with open(av_list_file, "r") as file:
av_list_file = [line.strip() for line in file if line.strip()]

regheve = winreg.HKEY_LOCAL_MACHINE
regpath = r"SYSTEMCurrentControlSetServices"

try:
with winreg.OpenKey(regheve, regpath, access=winreg.KEY_READ) as key:
num_keys = winreg.QueryInfoKey(key)[0]

for i in range(num_keys):
try:
subkey_name = winreg.EnumKey(key, i)
if any(av_name in subkey_name for av_name in av_list):
sub_path = fr"{regpath}{subkey_name}"
with winreg.OpenKey(regheve, sub_path, access=winreg.KEY_READ) as subkey:
start_type = winreg.QueryValueEx(subkey, 'Start')[0]
if start_type == 2:
print(f"Services {subkey_name} set to run automatically")
except FileNotFoundError:
continue
except Exception as e:
print(f"An error occured: {e}")

# File with AV services identifiers to check
av_list_file = "av_services.txt"



Empty file added av_services.txt
Empty file.

0 comments on commit 5101dd3

Please sign in to comment.