From 8d127df9480f43fa51cdd73e2951eebc3e7f504b 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 | 16 ++++++++++++++++ packages/cyberchef.vm/cyberchef.vm.nuspec | 2 +- .../cyberchef.vm/tools/chocolateyinstall.ps1 | 2 +- 4 files changed, 19 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 479520929..2c05469a3 100755 --- a/packages/common.vm/tools/vm.common/vm.common.psm1 +++ b/packages/common.vm/tools/vm.common/vm.common.psm1 @@ -1800,3 +1800,19 @@ function VM-Set-Legal-Notice { 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 +} 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