From 9dfdcd49362100877d0f159e086ebfda0de912fc Mon Sep 17 00:00:00 2001 From: Elliot Chernofsky Date: Fri, 13 Sep 2024 18:55:32 -0400 Subject: [PATCH] Update CyberChef to use CyberChef icon --- packages/common.vm/common.vm.nuspec | 2 +- .../common.vm/tools/vm.common/vm.common.psm1 | 17 +++++++++++++++++ packages/cyberchef.vm/cyberchef.vm.nuspec | 2 +- .../cyberchef.vm/tools/chocolateyinstall.ps1 | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/common.vm/common.vm.nuspec b/packages/common.vm/common.vm.nuspec index 57314a3f6..928c745c0 100755 --- a/packages/common.vm/common.vm.nuspec +++ b/packages/common.vm/common.vm.nuspec @@ -2,7 +2,7 @@ common.vm - 0.0.0.20240826 + 0.0.0.20240913 Common libraries for VM-packages Mandiant diff --git a/packages/common.vm/tools/vm.common/vm.common.psm1 b/packages/common.vm/tools/vm.common/vm.common.psm1 index 5cd59a6e9..0322e6e00 100755 --- a/packages/common.vm/tools/vm.common/vm.common.psm1 +++ b/packages/common.vm/tools/vm.common/vm.common.psm1 @@ -1798,4 +1798,21 @@ function VM-Set-Legal-Notice { $RegistryPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' New-ItemProperty -Path $RegistryPath -Name legalnoticecaption -Value "Terms and Conditions" -Force New-ItemProperty -Path $RegistryPath -Name legalnoticetext -Value $legalnoticetext -Force +} + +# Converts image file to .ico needed for file icons +function VM-Create-Ico { + param ( + [string]$imagePath + ) + Add-Type -AssemblyName System.Drawing + $imageDirPath = Split-Path -Path $imagePath -Parent + $filenameWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($imagePath) + $iconLocation = Join-Path $imageDirPath "$($filenameWithoutExtension).ico" + $bitmap = [System.Drawing.Bitmap]::FromFile($imagePath) + $icon = [System.Drawing.Icon]::FromHandle($bitmap.GetHicon()) + $fs = New-Object System.IO.FileStream($iconLocation, 'OpenOrCreate') + $icon.Save($fs) + $fs.Close() + return $iconLocation } \ No newline at end of file diff --git a/packages/cyberchef.vm/cyberchef.vm.nuspec b/packages/cyberchef.vm/cyberchef.vm.nuspec index 7951f60ed..4505658ae 100644 --- a/packages/cyberchef.vm/cyberchef.vm.nuspec +++ b/packages/cyberchef.vm/cyberchef.vm.nuspec @@ -2,7 +2,7 @@ cyberchef.vm - 10.19.0 + 10.19.0.20240913 GCHQ The Cyber Swiss Army Knife - a web app for encryption, encoding, compression, data analysis, and more. diff --git a/packages/cyberchef.vm/tools/chocolateyinstall.ps1 b/packages/cyberchef.vm/tools/chocolateyinstall.ps1 index ed068c961..50bea9ae0 100644 --- a/packages/cyberchef.vm/tools/chocolateyinstall.ps1 +++ b/packages/cyberchef.vm/tools/chocolateyinstall.ps1 @@ -25,7 +25,7 @@ try { $htmlPath = Join-Path $toolDir "CyberChef_v10.19.0.html" -Resolve $arguments = "start chrome $htmlPath && exit" $executableArgs = "/C $arguments" - $iconLocation = "%ProgramFiles%\Google\Chrome\Application\chrome.exe" + $iconLocation = VM-Create-Ico (Join-Path $toolDir "images\cyberchef-128x128.png") # Create .ico for cyberchef icon Install-ChocolateyShortcut -ShortcutFilePath $shortcut -TargetPath $executableCmd -Arguments $executableArgs -WorkingDirectory $toolDir -WindowStyle 7 -IconLocation $iconLocation