Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defender toggle #883

Merged
merged 70 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
f2c2905
refactor(requirements): DefenderDisabled -> Toggled
he3als Jul 27, 2023
710bbaf
Merge branch 'main' into na-defender-toggle
he3als Jul 28, 2023
3793ce6
feat(sxsc): init Defender Remover cfg
he3als Jul 28, 2023
2fa3fcd
fix(defender cfg): add version to component
he3als Jul 29, 2023
685ea40
feat(packages): add online-sxs script
he3als Jul 29, 2023
e30ffd7
fix: disable KProcessHacker2
he3als Jul 29, 2023
1aeb26e
feat(actions): automatic CBS package build
he3als Jul 30, 2023
d7c91f1
Revert "feat(actions): automatic CBS package build"
he3als Jul 30, 2023
a62cdf0
refactor(workflows): test CBS workflow
he3als Jul 30, 2023
d75294a
Merge branch 'main' into na-defender-toggle
he3als Jul 30, 2023
378c61a
refactor(workflows): test CBS workflow
he3als Jul 30, 2023
b55a8ff
feat: auto-update CAB packages (378c61a5)
actions-user Jul 30, 2023
053ae90
feat(features): uncomment Defender page
he3als Jul 31, 2023
72fad6b
feat(Defender): Security Tray tweak
he3als Jul 31, 2023
272dc42
Merge branch 'na-defender-toggle' of https://github.com/Atlas-OS/Atla…
he3als Jul 31, 2023
7fbe671
refactor(sxsc): add Z to package name to sort to bottom
he3als Jul 31, 2023
1ace818
feat: auto-update CAB packages (7fbe6714)
actions-user Jul 31, 2023
f23d0e2
refactor: remove old cab
he3als Jul 31, 2023
a310dbe
Merge branch 'main' into na-defender-toggle
he3als Jul 31, 2023
b6336b6
feat(Atlas-Defender-Remover): remove smartscreen
he3als Aug 1, 2023
c3e98de
feat: auto-update CAB packages (b6336b6f)
actions-user Aug 1, 2023
9dc81aa
feat(Defender): hide page & disable notifications
he3als Aug 1, 2023
76004da
feat: auto-update CAB packages (9dc81aa6)
actions-user Aug 1, 2023
44e64d8
feat(packages.yml): remove Defender & SmartScreen
he3als Aug 1, 2023
cdbd6e0
feat(Defender-Remover): webthreatdefense
he3als Aug 1, 2023
49e5563
feat(services): do not delete Defender
he3als Aug 1, 2023
53f45ac
feat(components): Defender option
he3als Aug 1, 2023
0e9b87f
feat(tweaks): hide unused security pages
he3als Aug 1, 2023
103d1e4
refactor: move Security Tray on Startup tweak to optional
he3als Aug 1, 2023
a3ef01a
feat: Toggle Defender script
he3als Aug 1, 2023
5de2413
fix(defender components): remove -Enable
he3als Aug 1, 2023
e793923
fix(appx): add Windows Security back
he3als Aug 1, 2023
6e3e6ba
fix(sxsc): trigger build
he3als Aug 1, 2023
96f80e8
feat: auto-update CAB packages (6e3e6bac)
actions-user Aug 1, 2023
e9b0452
fix(components): add Defender in Atlas registry
he3als Aug 2, 2023
7dbfba6
feat: move Defender scripts & tweaks
he3als Aug 2, 2023
7e43e7d
feat(Atlas-Defender-Remover): hide App & Browser page
he3als Aug 2, 2023
7eea519
feat: auto-update CAB packages (7e43e7dc)
actions-user Aug 2, 2023
f99a8f3
fix(Toggle Defender): typo EA -> -EA
he3als Aug 2, 2023
95f8be9
fix(appx.yml): don't remove SmartScreen
he3als Aug 2, 2023
d0d11a8
fix(Toggle Defender): make uninstalling package not prompt for restart
he3als Aug 2, 2023
fcb786e
fix(tweaks.yml): don't disable smartscreen
he3als Aug 2, 2023
48748e0
feat(sxsc): no telemetry package
he3als Aug 3, 2023
0a371c6
feat: auto-update CAB packages (48748e02)
actions-user Aug 3, 2023
27706a4
feat(components): no telemetry package
he3als Aug 3, 2023
3a4def6
fix: comment packages
he3als Aug 3, 2023
3353e38
fix(Atlas-NoTelemetry): Automatic Repair loop
he3als Aug 3, 2023
73b4218
feat: auto-update CAB packages (3353e381)
actions-user Aug 3, 2023
aab4a57
Merge branch 'dev' into na-defender-toggle
he3als Aug 3, 2023
bb137f5
refactor: remove packages.yml
he3als Aug 3, 2023
0924388
fix(custom.yml): remove packages.yml again
he3als Aug 3, 2023
7727fc7
fix(Toggle Defender): GetValue issues
he3als Aug 3, 2023
d375b5a
Merge remote-tracking branch 'origin/dev' into na-defender-toggle
he3als Aug 4, 2023
e229356
Merge branch 'dev' into na-defender-toggle
he3als Aug 4, 2023
c7e527e
Merge branch 'dev' into na-defender-toggle
he3als Aug 4, 2023
5030227
Merge branch 'dev' into defender-toggle
he3als Aug 4, 2023
f601d5d
Merge branch 'dev' into defender-toggle
he3als Aug 5, 2023
0ae7793
refactor(components): remove note
he3als Aug 5, 2023
1fce737
Merge branch 'dev' into defender-toggle
he3als Aug 5, 2023
d992bd4
Merge branch 'main' into defender-toggle
he3als Aug 5, 2023
3e604c5
feat(Atlas-Defender-Remover): registry keys & values
he3als Aug 5, 2023
fed0d7d
feat: auto-update CAB packages (3e604c51)
actions-user Aug 5, 2023
d36a405
fix(SmartScreen): fix SmartScreen not working (1)
he3als Aug 6, 2023
9377062
fix(SmartScreen): fix SmartScreen not working (2)
he3als Aug 6, 2023
c86b61e
refactor(Atlas-Defender-Remover): improve comment
he3als Aug 6, 2023
d0b094b
feat: auto-update CAB packages (c86b61ea)
actions-user Aug 6, 2023
3c49544
fix(Toggle Defender): general improvements & fixes
he3als Aug 6, 2023
81ae46f
fix(Toggle Defender): disabling Defender
he3als Aug 6, 2023
24329b0
Merge branch 'dev' into defender-toggle
he3als Aug 6, 2023
dae2a23
refactor(components): remove deprecated flags
he3als Aug 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/playbook/Configuration/atlas/appx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ actions:
- !appx: {name: '*Microsoft.Windows.OOBENetworkCaptivePortal*', type: family}
- !appx: {name: '*Microsoft.Windows.OOBENetworkConnectionFlow*', type: family}

# Windows Security (Defender)
- !appx: {name: '*Microsoft.Windows.SecHealthUI*', type: family}
# SmartScreen
- !appx: {name: '*Microsoft.Windows.Apprep.ChxApp*', type: family}

# Mail and Calendar
- !appx: {name: '*microsoft.windowscommunicationsapps*', type: family}

Expand Down
34 changes: 11 additions & 23 deletions src/playbook/Configuration/atlas/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,17 @@ description: Removes certain Windows components
privilege: TrustedInstaller
actions:
# Windows Defender
- !writeStatus: {status: 'Removing Windows Defender'}
- !taskKill: {name: 'NisSrv'}
- !taskKill: {name: 'SecurityHealthHost'}
- !taskKill: {name: 'SecurityHealthService'}
- !taskKill: {name: 'SecurityHealthSystray'}
- !taskKill: {name: 'SkypeBackgroundHost'}
- !taskKill: {name: 'MsMpEng'}
- !taskKill: {name: 'msiexec'}
- !file: {path: 'C:\Windows\System32\smartscreen.exe'}
- !file: {path: 'C:\Windows\System32\SecurityHealthSystray.exe'}
- !file: {path: 'C:\Windows\System32\SecurityHealthService.exe'}
- !file: {path: 'C:\Windows\System32\SecurityHealthAgent.dll'}
- !file: {path: 'C:\Windows\System32\SecurityHealthHost.exe'}
- !file: {path: 'C:\Windows\System32\SecurityHealthSSO.dll'}
- !file: {path: 'C:\Windows\System32\SecurityHealthCore.dll'}
- !file: {path: 'C:\Windows\System32\SecurityHealthProxyStub.dll'}
- !file: {path: 'C:\Windows\System32\SecurityHealthUdk.dll'}
- !file: {path: 'C:\Program Files\Windows Defender', weight: 30}
- !file: {path: 'C:\ProgramData\Microsoft\Windows Defender', weight: 30}
- !file: {path: 'C:\Program Files (x86)\Windows Defender', weight: 30}
- !file: {path: 'C:\Windows\System32\drivers\WdNisDrv.sys'}
- !file: {path: 'C:\Program Files\Windows Defender Advanced Threat Protection'}
- !file: {path: 'C:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection'}
- !writeStatus: {status: 'Removing Windows Defender', option: 'defender-disable'}
- !run:
exe: 'C:\Users\Default\Desktop\Atlas\3. Configuration\5. Security\Defender\Toggle Defender.cmd'
args: '-Disable'
wait: true
option: 'defender-disable'
- !run:
exe: 'C:\Users\Default\Desktop\Atlas\3. Configuration\5. Security\Defender\Toggle Defender.cmd'
args: '-Disable'
wait: true
option: 'defender-disable'
# Remove Security Center startup item
- !registryValue: {path: 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', value: 'SecurityHealth', operation: delete}

Expand Down
10 changes: 10 additions & 0 deletions src/playbook/Configuration/atlas/kill-kph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Kill & Disable KProcessHacker2
description: Kills, removes and disables ProcessHacker using its kernel mode driver to prevent conflicts with Memory Integrity and the Microsoft Vulnerable Driver Blocklist
privilege: TrustedInstaller
actions:
- !run:
exe: 'powershell.exe'
args: '-NoP -Ex Unrestricted -File KILLKPH.ps1'
exeDir: true
wait: true
1,257 changes: 0 additions & 1,257 deletions src/playbook/Configuration/atlas/packages.yml

This file was deleted.

16 changes: 0 additions & 16 deletions src/playbook/Configuration/atlas/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,6 @@ actions:
- !service: {name: 'AssignedAccessManagerSvc', operation: delete}
- !service: {name: 'RetailDemo', operation: delete}

# Defender
- !taskKill: {name: 'SecurityHealthSystray'}
- !taskKill: {name: 'SecurityHealthService'}
- !service: {name: 'WpcMonSvc', operation: delete}
- !service: {name: 'wisvc', operation: delete}
- !service: {name: 'Sense', operation: delete}
- !service: {name: 'webthreatdefusersvc*', operation: delete}
- !service: {name: 'webthreatdefsvc', operation: delete}
- !service: {name: 'UevAgentService', operation: delete}
- !service: {name: 'wscsvc', operation: delete}
- !service: {name: 'SecurityHealthService', operation: delete}
- !registryKey: {path: 'HKLM\SYSTEM\CurrentControlSet\Services\WdNisDrv'}
- !registryKey: {path: 'HKLM\SYSTEM\CurrentControlSet001\Services\WdNisDrv'}
- !registryKey: {path: 'HKLM\SYSTEM\CurrentControlSet\Services\WdNisSvc'}
- !registryKey: {path: 'HKLM\SYSTEM\CurrentControlSet001\Services\WdNisSvc'}

# Backup default Windows serivces & drivers
- !run: {exe: 'BACKUP1.cmd', exeDir: true}

Expand Down
2 changes: 1 addition & 1 deletion src/playbook/Configuration/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ actions: []
features:
# Configure PowerShell first so that other PowerShell scripts work
- tweaks\qol\config-powershell.yml
- atlas\kill-kph.yml
- atlas\start.yml
- atlas\services.yml
- atlas\components.yml
- atlas\appx.yml
- atlas\packages.yml
- tweaks.yml
5 changes: 2 additions & 3 deletions src/playbook/Configuration/tweaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ features:
# -------------------------------------------------------------------------- #
# qol\security #
# -------------------------------------------------------------------------- #
- tweaks\qol\security\disable-online-file-security-warn.yml
- tweaks\qol\security\disable-smartscreen.yml
- tweaks\qol\disable-uac-secure-desktop.yml
- tweaks\qol\security\disable-uac-secure-desktop.yml

# -------------------------------------------------------------------------- #
# qol\shell #
Expand Down Expand Up @@ -314,6 +312,7 @@ features:
- tweaks\debloat\legacy-photo-viewer.yml
- tweaks\debloat\prevent-edge-update.yml
- tweaks\debloat\scheduled-tasks.yml
- tweaks\debloat\hide-unused-security-pages.yml
- tweaks\debloat\config-storage-sense.yml

# -----------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Hide Unused Windows Security Pages
description: Hides Windows Security pages that are not commonly needed/used to have a more clean UI
privilege: TrustedInstaller
actions:
# Remove bloat pages
- !registryValue:
path: 'HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Family options'
value: 'UILockdown'
data: '1'
type: REG_DWORD
- !registryValue:
path: 'HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Device performance and health'
value: 'UILockdown'
data: '1'
type: REG_DWORD
- !registryValue:
path: 'HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Account protection'
value: 'UILockdown'
data: '1'
type: REG_DWORD

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection]
"UILockdown"=dword:00000001
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection]
"UILockdown"=-
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"SecurityHealth"=-
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<# : batch portion
@echo off

if "%~1"=="-Help" (goto help) else (if "%~1"=="-help" (goto help) else (if "%~1"=="/h" (goto help) else (goto main)))

:help
echo Usage = Toggle Defender.cmd [-Help] [-Enable] [-Disable]
exit /b

:main
if "%*"=="" (
fltmc >nul 2>&1 || (
echo Administrator privileges are required.
PowerShell Start -Verb RunAs '%0' 2> nul || (
echo You must run this script as admin.
pause & exit /b 1
)
exit /b 0
)
)

set args= & set "args1=%*"
if defined args1 set "args=%args1:"='%"
powershell -nop "& ([Scriptblock]::Create((Get-Content '%~f0' -Raw))) %args%"
exit /b %errorlevel%
: end batch / begin PowerShell #>

param (
[switch]$Enable,
[switch]$Disable
)

$AtlasPackageName = 'Z-Atlas-NoDefender-Package'

$AtlasModules = "$env:windir\AtlasModules"
$onlineSxS = "$AtlasModules\Scripts\online-sxs.cmd"
$packagesPath = "$AtlasModules\Packages"
$ProgressPreference = 'SilentlyContinue'

if ($Enable -or $Disable) {$Silent = $true}

function PauseNul ($message = "Press any key to exit... ") {
Write-Host $message -NoNewLine
$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') | Out-Null
}

$packages = (Get-WindowsPackage -online | Where-Object { $_.PackageName -like "*$AtlasPackageName*" }).PackageName
if (!($?)) {
Write-Host "Failed to get packages!" -ForegroundColor Red
if (!($Silent)) {PauseNul}; exit 1
}
if ($null -eq $packages) {$DefenderEnabled = '(current)'} else {$DefenderDisabled = '(current)'}

function UninstallPackage {
param (
[switch]$Disable
)
foreach ($package in $packages) {
try {
Remove-WindowsPackage -Online -PackageName $package -NoRestart -LogLevel 1 *>$null
} catch {
Write-Host "Something went wrong removing the package: $package" -ForegroundColor Red
Write-Host "$_`n" -ForegroundColor Red
if (!($Silent)) {PauseNul}; exit 1
}
}
}

function InstallPackage {
$latestCabPath = (Get-ChildItem -Path $packagesPath -Filter "*$AtlasPackageName*.cab" | Sort-Object | Select-Object -Last 1).FullName
Write-Warning "Installing package to remove Defender..."
try {
& $onlineSxS "$latestCabPath" -Silent
} catch {
Write-Host "`nSomething went wrong whilst adding the Defender package.`nPlease report the error above to the Atlas team." -ForegroundColor Yellow
if (!($Silent)) {PauseNul}; exit 1
}
}

function Finish {
Write-Host "`nCompleted!" -ForegroundColor Green
choice /c yn /n /m "Would you like to restart now to apply the changes? [Y/N] "
if ($lastexitcode -eq 1) {Restart-Computer} else {
Write-Host "`nChanges will apply after next restart." -ForegroundColor Yellow
Start-Sleep 2; exit
}
}

if ($Disable) {InstallPackage; exit} elseif ($Enable) {UninstallPackage; exit}

function Menu {
Clear-Host
$ColourDisable = 'White'; $ColourEnable = $ColourDisable
if ($DefenderDisabled) {$ColourDisable = 'Gray'} else {$ColourEnable = 'Gray'}

Write-Host "1) Disable Defender $DefenderDisabled" -ForegroundColor $ColourDisable
Write-Host "2) Enable Defender $DefenderEnabled`n" -ForegroundColor $ColourEnable

Write-Host "Choose 1 or 2: " -NoNewline -ForegroundColor Yellow
$pageInput = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')

switch ($pageInput.Character) {
# Disable Defender
1 {
if ($DefenderDisabled) {Menu}
Clear-Host
Write-Host "Are you sure that you want to disable Defender?" -ForegroundColor Red
Write-Host "Although disabling Windows Defender will improve performance and convienience, it's important for security.`n"

Pause
Clear-Host
InstallPackage
Finish
}
# Enable Defender
2 {
if ($DefenderEnabled) {Menu}
Clear-Host
UninstallPackage
Finish
}
default {
# Do nothing
Menu
}
}
}

Menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://github.com/he3als/online-sxs
Binary file not shown.
Binary file not shown.
Loading