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 May 24, 2024
1 parent caf4585 commit 00083ea
Show file tree
Hide file tree
Showing 4 changed files with 20 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.20240516</version>
<version>0.0.0.20240524</version>
<description>Common libraries for VM-packages</description>
<authors>Mandiant</authors>
</metadata>
Expand Down
17 changes: 17 additions & 0 deletions packages/common.vm/tools/vm.common/vm.common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
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.18.3</version>
<version>10.18.3.20240523</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 @@ -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

Expand Down

0 comments on commit 00083ea

Please sign in to comment.