diff --git a/README.md b/README.md index b451b76..be96dbe 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,29 @@ Defendnot is a successor of [no-defender](https://github.com/es3n1n/no-defender) ![](https://i.imgur.com/VGE8g6a.jpeg) -## How it works +## Installation -There's a WSC (Windows Security Center) service in Windows which is used by antiviruses to let Windows know that there's some other antivirus in the hood and it should disable Windows Defender. -This WSC API is undocumented and furthermore requires people to sign an NDA with Microsoft to get its documentation. +### One-liner -The initial implementation of [no-defender](https://github.com/es3n1n/no-defender) used thirdparty code provided by other AVs to register itself in the WSC, while defendnot interacts with WSC directly. +Open the powershell as administrator and execute any of these: -## Limitations +```powershell +# Example 1: Basic installation +irm https://es3n1n.io/defendnot.ps1 | iex -Sadly, to keep this WSC stuff even after reboot, defendnot adds itself to the autorun. Thus, you would need to keep the defendnot binaries on your disk :( +# Example 2: With custom AV name +irm https://es3n1n.io/defendnot.ps1 | iex --name "Custom AV name" + +# Example 3: Without allocating console +irm https://es3n1n.io/defendnot.ps1 | iex --silent +``` + +> [!NOTE] +> You can pass arguments to iex and installer script will forward your arguments to `defendnot-loader` as seen in examples 2 and 3. For reference what commandline arguments are allowed, see the `Usage` section below. + +### Manual + +Download the [latest](https://github.com/es3n1n/defendnot/releases/latest) release, extract it somewhere and launch `defendnot-loader`. ## Usage @@ -33,6 +46,17 @@ Optional arguments: --disable-autorun disable autorun task creation ``` +## How it works + +There's a WSC (Windows Security Center) service in Windows which is used by antiviruses to let Windows know that there's some other antivirus in the hood and it should disable Windows Defender. +This WSC API is undocumented and furthermore requires people to sign an NDA with Microsoft to get its documentation. + +The initial implementation of [no-defender](https://github.com/es3n1n/no-defender) used thirdparty code provided by other AVs to register itself in the WSC, while defendnot interacts with WSC directly. + +## Limitations + +Sadly, to keep this WSC stuff even after reboot, defendnot adds itself to the autorun. Thus, you would need to keep the defendnot binaries on your disk :( + ## Writeup [How I ruined my vacation by reverse engineering WSC](https://blog.es3n1n.eu/posts/how-i-ruined-my-vacation/) diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..2eff870 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,56 @@ +$ErrorActionPreference = "Stop" +$InstallPath = "$env:ProgramData\defendnot" + +switch -Wildcard ($env:PROCESSOR_ARCHITECTURE) { + "AMD64" { $arch = "x64" } + "x86" { $arch = "x86" } + "ARM64" { $arch = "ARM64" } + default { + Write-Error "Unknown architecture: $($env:PROCESSOR_ARCHITECTURE)" + exit 1 + } +} + +$repo = "es3n1n/defendnot" +$apiReleaseUrl = "https://api.github.com/repos/$repo/releases/latest" +$headers = @{ 'User-Agent'="defendnot-install/1.0" } + +try { + $release = Invoke-RestMethod -Uri $apiReleaseUrl -Headers $headers +} catch { + Write-Error "Failed to get latest release info: $_" + exit 2 +} + +$zipAsset = $release.assets | Where-Object { $_.name -ieq "$arch.zip" } +if (-not $zipAsset) { + Write-Error "Release does not contain asset for $arch" + exit 3 +} + +$zipUrl = $zipAsset.browser_download_url +$zipPath = Join-Path $env:TEMP "defendnot-$arch.zip" + +Write-Host "Downloading $($zipAsset.name)..." +Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath + +If (!(Test-Path $InstallPath)) { + New-Item -Type Directory -Path $InstallPath -Force | Out-Null +} + +if (Test-Path $InstallPath) { + Write-Host "Removing previous installation..." + Remove-Item $InstallPath -Force -Recurse -ErrorAction SilentlyContinue +} + +New-Item -Type Directory -Path $InstallPath -ErrorAction SilentlyContinue | Out-Null + +Write-Host "Extracting to $InstallPath..." +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, $InstallPath) +Remove-Item $zipPath + +Write-Host "`nDefendnot installed to $InstallPath" +Write-Host "Starting..." +Write-Host "Args: $args" +& "$InstallPath\defendnot-loader.exe" @args