Skip to content

Commit

Permalink
Update CyberChef to use CyberChef icon
Browse files Browse the repository at this point in the history
  • Loading branch information
emtuls committed Sep 13, 2024
1 parent 6b95e46 commit 8d127df
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/common.vm/common.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>common.vm</id>
<version>0.0.0.20240826</version>
<version>0.0.0.20240913</version>
<description>Common libraries for VM-packages</description>
<authors>Mandiant</authors>
</metadata>
Expand Down
16 changes: 16 additions & 0 deletions packages/common.vm/tools/vm.common/vm.common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion packages/cyberchef.vm/cyberchef.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>cyberchef.vm</id>
<version>10.19.0</version>
<version>10.19.0.20240913</version>
<authors>GCHQ</authors>
<description>The Cyber Swiss Army Knife - a web app for encryption, encoding, compression, data analysis, and more.</description>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion packages/cyberchef.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8d127df

Please sign in to comment.