diff --git a/packages/common.vm/common.vm.nuspec b/packages/common.vm/common.vm.nuspec index e38b9ce4f..a54b777da 100755 --- a/packages/common.vm/common.vm.nuspec +++ b/packages/common.vm/common.vm.nuspec @@ -2,7 +2,7 @@ common.vm - 0.0.0.20240516 + 0.0.0.20240524 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 d7d043e7a..41916c807 100755 --- a/packages/common.vm/tools/vm.common/vm.common.psm1 +++ b/packages/common.vm/tools/vm.common/vm.common.psm1 @@ -1744,3 +1744,20 @@ function VM-Pip-Install { Invoke-Expression "py -3.10 -m pip install $package --disable-pip-version-check 2>&1 >> $outputFile" } + +# 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 32d14e5c2..81e70ef0d 100644 --- a/packages/cyberchef.vm/cyberchef.vm.nuspec +++ b/packages/cyberchef.vm/cyberchef.vm.nuspec @@ -2,7 +2,7 @@ cyberchef.vm - 10.18.3 + 10.18.3.20240523 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 a9ae3e84e..a9af83f35 100644 --- a/packages/cyberchef.vm/tools/chocolateyinstall.ps1 +++ b/packages/cyberchef.vm/tools/chocolateyinstall.ps1 @@ -19,13 +19,13 @@ try { Install-ChocolateyZipPackage @packageArgs VM-Assert-Path $toolDir + $iconLocation = VM-Create-Ico (Join-Path $toolDir "images\cyberchef-128x128.png") # Create .ico for cyberchef icon $shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category $shortcut = Join-Path $shortcutDir "$toolName.lnk" $executableCmd = Join-Path ${Env:WinDir} "system32\cmd.exe" -Resolve $htmlPath = Join-Path $toolDir "CyberChef_v10.18.3.html" -Resolve $arguments = "start chrome $htmlPath && exit" $executableArgs = "/C $arguments" - $iconLocation = "%ProgramFiles%\Google\Chrome\Application\chrome.exe" Install-ChocolateyShortcut -ShortcutFilePath $shortcut -TargetPath $executableCmd -Arguments $executableArgs -WorkingDirectory $toolDir -WindowStyle 7 -IconLocation $iconLocation