Skip to content

Commit

Permalink
fix(account ads): use ViVe (issue #1140)
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Jul 14, 2024
1 parent 99c0ad3 commit cef5ab8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 29 deletions.
21 changes: 20 additions & 1 deletion src/playbook/Executables/AtlasModules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Some of the Playbook contains binary executables. This file provides some verifi
The root of the file paths listed here starts in `src\playbook\Executables`.

### Multi-Choice

- Path: `\AtlasModules\Tools\multichoice.exe`
- SHA256 Hash: `6AB2FF0163AFE0FAC4E7506F9A63293421A1880076944339700A59A06578927D`
- Source: https://github.com/Atlas-OS/Atlas-Utilities/releases/download/multichoice-v0.4/multichoice-compressed.exe
Expand All @@ -14,6 +15,7 @@ The root of the file paths listed here starts in `src\playbook\Executables`.
- Last Verified: 5/24/2024 by Xyueta

## SetTimerResolution & MeasureSleep

- Path: `\AtlasModules\Tools\SetTimerResolution.exe`
- SHA256 Hash: `0515C2428E8960C751AD697ACA1C8D03BD43E2F0F1A0C0D2B4D998361C35EB57`
- Source: https://github.com/deaglebullet/TimerResolution/releases/download/SetTimerResolution-v1.0.0/SetTimerResolution.exe
Expand All @@ -24,4 +26,21 @@ The root of the file paths listed here starts in `src\playbook\Executables`.
- Version: v1.0.0
- Repository: https://github.com/deaglebullet/TimerResolution
- License: [GNU General Public License v3.0](https://github.com/adeaglebullet/TimerResolution/blob/main/LICENSE)
- Last Verified: 5/24/2024 by Xyueta
- Last Verified: 5/24/2024 by Xyueta

## ViVeTool

> [!NOTE]
> This is included in the Playbook and isn't in the AtlasModules.
- Path: `Executables\ViVeTool-v0.3.3.zip`
- SHA256 hash: `59D1E792EDCC001A319C16435A03D203975BF50EB38BD55CA34370900606F9F0`
- Source: https://github.com/thebookisclosed/ViVe/releases/download/v0.3.3/ViVeTool-v0.3.3.zip
- Version: v0.3.3
- Path: `Executables\ViVeTool-v0.3.3-ARM64CLR.zip`
- SHA256 hash: `37708C95C5053539CD068460E28E565D6B25A33C87F09B6B91A4F82A18E30132`
- Source: https://github.com/thebookisclosed/ViVe/releases/download/v0.3.3/ViVeTool-v0.3.3-ARM64CLR.zip
- Version: v0.3.3
- Repository: https://github.com/thebookisclosed/ViVe
- License: [GNU General Public License v3.0](https://github.com/thebookisclosed/ViVe/blob/master/LICENSE)
- Last Verified: 7/14/2024 by he3als
52 changes: 24 additions & 28 deletions src/playbook/Executables/CLIENTCBS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$windir = [Environment]::GetFolderPath('Windows')
$cbsPublic = "$windir\SystemApps\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\Public"
$settingsExtensions = "$cbsPublic\wsxpacks\Account\SettingsExtensions.json"
$arm = ((Get-CimInstance -Class Win32_ComputerSystem).SystemType -match 'ARM64') -or ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64')
if (!(Test-Path $settingsExtensions)) {
Write-Output "Settings extensions ($settingsExtensions) not found."
Write-Output "User is likely on Windows 10, nothing to do. Exiting..."
Expand Down Expand Up @@ -49,38 +50,33 @@ if ($ids.Count -le 0) {
# If the velocity IDs aren't set, then the account page disappears
& "$windir\AtlasModules\Scripts\settingsPages.cmd" /hide account

# Obfuscate velocity IDs
# Rewritten in PowerShell from ViVE
# https://github.com/thebookisclosed/ViVe/blob/master/ViVe/ObfuscationHelpers.cs
class ObfuscationHelpers {
static [uint32] SwapBytes([uint32] $x) {
$x = ($x -shr 16) -bor ($x -shl 16)
return (($x -band 0xFF00FF00) -shr 8) -bor (($x -band 0x00FF00FF) -shl 8)
}

static [uint32] RotateRight32([uint32] $value, [int] $shift) {
return ($value -shr $shift) -bor ($value -shl (32 - $shift))
}

static [uint32] ObfuscateFeatureId([uint32] $featureId) {
return [ObfuscationHelpers]::RotateRight32(([ObfuscationHelpers]::SwapBytes($featureId -bxor 0x74161A4E) -bxor 0x8FB23D4F), -1) -bxor 0x833EA8FF
}
# Extract ViVeTool https://github.com/thebookisclosed/ViVe
# Not done in PowerShell as it's too complicated, it's just easiest to use the actual tool
$viveZip = Get-ChildItem "ViVeTool-*.zip" -Name
if ($arm) {
$viveZip = $viveZip | Where-Object { $_ -match '-ARM64CLR' }
} else {
$viveZip = $viveZip | Where-Object { $_ -notmatch '-ARM64CLR' }
}

static [uint32] DeobfuscateFeatureId([uint32] $featureId) {
return [ObfuscationHelpers]::SwapBytes(([ObfuscationHelpers]::RotateRight32($featureId -bxor 0x833EA8FF, 1) -bxor 0x8FB23D4F)) -bxor 0x74161A4E
# Extract & setup ViVeTool
if ($viveZip) {
$viveFolder = Join-Path -Path (Get-Location) -ChildPath "vivetool"
if (!(Test-Path -Path $viveFolder)) {
New-Item -ItemType Directory -Path $viveFolder | Out-Null
}
Expand-Archive -Path $viveZip -DestinationPath $viveFolder -Force
} else {
throw "ViVeTool not found!"
}
$env:PATH += ";$viveFolder"
if (!(Get-Command 'vivetool' -EA 0)) {
throw "ViVeTool EXE not found in ZIP!"
}

# Disable velocity IDs
# Disable feature IDs
# Applies next reboot
$featureKey = "HKLM:\SYSTEM\CurrentControlSet\Control\FeatureManagement\Overrides\8"
foreach ($id in $($ids | Sort-Object -Unique)) {
$veloId = "$featureKey\$([ObfuscationHelpers]::ObfuscateFeatureId($id))"
Write-Output "Disabling velocity ID '$veloId'..."
New-Item $veloId -Force | Out-Null
Set-ItemProperty -Path $veloId -Name "EnabledStateOptions" -Value 0 -Force
Set-ItemProperty -Path $veloId -Name "EnabledState" -Value 1 -Force
Set-ItemProperty -Path $veloId -Name "VariantPayload" -Value 0 -Force
Set-ItemProperty -Path $veloId -Name "Variant" -Value 0 -Force
Set-ItemProperty -Path $veloId -Name "VariantPayloadKind" -Value 0 -Force
Write-Output "Disabling feature ID $id..."
ViVeTool.exe /disable /id:$id | Out-Null
}
Binary file not shown.
Binary file added src/playbook/Executables/ViVeTool-v0.3.3.zip
Binary file not shown.

0 comments on commit cef5ab8

Please sign in to comment.