# coding=utf-8
import sys
import os
# Идея в том, чтобы запретить всем доступ к exe:
# takeown /f "c:\Windows\*\MusNotification.exe"
# takeown /f "c:\Windows\*\MusNotificationUx.exe"
# icacls "c:\Windows\*\MusNotification.exe" /deny Everyone:(X)
# icacls "c:\Windows\*\MusNotificationUx.exe" /deny Everyone:(X)
def findMusNotificationExeFiles():
lstrFilepaths = []
for (root, _dirs, files) in os.walk("c:\\Windows\\"):
for file in files:
strLFile = file.lower()
if ('musnotification.exe' == strLFile) or ('musnotificationux.exe' == strLFile):
lstrFilepaths.append((os.path.join(root, file)))
return lstrFilepaths
def main():
try:
print("\tsearching...")
lFiles = findMusNotificationExeFiles()
print("\t" + str(len(lFiles)) + ' files found')
for strFilepath in lFiles:
os.system('takeown /f "'+strFilepath+'"')
os.system('icacls "'+strFilepath+'" /deny Everyone:(X)')
return 0
except BaseException as e:
print(str(e))
return 1
if __name__ == "__main__":
sys.exit(main())