-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>chrome.extensions.vm</id> | ||
<version>0.0.1.20240930</version> | ||
<authors>Mandiant</authors> | ||
<description>A package for multiple useful chrome extensions from the Chrome webstore.</description> | ||
<dependencies> | ||
<dependency id="common.vm" /> | ||
<dependency id="googlechrome.vm" /> | ||
</dependencies> | ||
</metadata> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
$ErrorActionPreference = 'Stop' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
try { | ||
$extensions = @( | ||
# MetaMask | ||
'nkbihfbeogaeaoehlefnkodbefgpgknn' | ||
# Phantom | ||
'bfnaelmomeimhlpmgjnjophhpkkoljpa' | ||
# BNB Chain Wallet | ||
'fhbohimaelbohpjbbldcngcnapndodjp' | ||
# Avira Password Manager | ||
'caljgklbbfbcjjanaijlacgncafpegll' | ||
# KeePassXC-Browser | ||
'oboonakemofpalcgghocfoadofidjkkk' | ||
# Yoroi | ||
'ffnbelfdoeiohenkjibnmadjiehjhajb' | ||
# XDEFI Wallet | ||
'hmeobnfnfcmdkdcmlblgagmfpfboieaf' | ||
# ... | ||
) | ||
|
||
# Installing the extensions under `ExtensionInstallForcelist` so | ||
# it can be installed and enabled silently, without user interaction. | ||
# By default, this registry key does not exist and it is not used within Flare-VM. | ||
# Ref: https://chromeenterprise.google/policies/?policy=ExtensionInstallForcelist | ||
|
||
$regKeyPath = "HKLM:\SOFTWARE\WOW6432Node\Policies\Google\Chrome\ExtensionInstallForcelist" | ||
$updateUrl = "https://clients2.google.com/service/update2/crx" | ||
|
||
New-Item -Path $regKeyPath -Force -ea 0 | Out-Null | ||
$valueName = 1 | ||
Foreach ($extensionId in $extensions) | ||
{ | ||
New-ItemProperty -Path "$regKeyPath" -Name "$valueName" -Type String -Value "$extensionId;$updateUrl" -Force -ea 0 | Out-Null | ||
$valueName += 1 | ||
} | ||
|
||
$chromePath = "${Env:ProgramFiles}\Google\Chrome\Application\chrome.exe" | ||
$extensionsDir = "${Env:LocalAppData}\Google\Chrome\User Data\Default\Extensions" | ||
|
||
$loaded = $false | ||
while (-not $loaded) | ||
{ | ||
# Restart Chrome. | ||
Stop-Process -Force -Name Chrome -ea 0 | ||
$chromeProcess = Start-Process -FilePath $chromePath -passthru | ||
|
||
# Wait for the extensions to be loaded. | ||
Start-Sleep -Seconds 120 | ||
|
||
# Close Chrome gracefully. | ||
if ($chromeProcess.CloseMainWindow()) | ||
{ | ||
Wait-Process -Id $chromeProcess.Id | Out-Null | ||
} | ||
else | ||
{ | ||
# Force kill the process instead. | ||
Stop-Process -Force -Id $chromeProcess.Id | Out-Null | ||
} | ||
|
||
# Make sure all of the extensions are loaded. | ||
$loaded = $true | ||
Foreach ($extensionId in $extensions) | ||
{ | ||
$extensionPath = Join-Path $extensionsDir $extensionId | ||
if (-not (Test-Path -Path $extensionPath)) | ||
{ | ||
$loaded = $false | ||
break | ||
} | ||
} | ||
} | ||
|
||
} catch { | ||
VM-Write-Log-Exception $_ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$ErrorActionPreference = 'Continue' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$regKeyPath = "HKLM:\SOFTWARE\WOW6432Node\Policies\Google\Chrome\ExtensionInstallForcelist" | ||
Remove-Item -Path $regKeyPath -Recurse -Force -ea 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters