Skip to content

Commit 73997f2

Browse files
authored
Merge pull request #1229 from sreinhardt/binja
Create Binary Ninja package
2 parents 6b1b502 + dd2fb54 commit 73997f2

5 files changed

Lines changed: 85 additions & 7 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<id>binaryninja.vm</id>
5+
<version>4.2.6455.20250417</version>
6+
<authors>Vector 35, Inc.</authors>
7+
<description>Binary Ninja is an interactive decompiler, disassembler, debugger, and binary analysis platform built by reverse engineers, for reverse engineers.</description>
8+
<dependencies>
9+
<dependency id="common.vm" version="0.0.0.20250509" />
10+
<!-- vcbuildtools.vm installs signtool.exe needed by VM-Assert-Signature -->
11+
<dependency id="vcbuildtools.vm" />
12+
</dependencies>
13+
<tags>Disassemblers</tags>
14+
</metadata>
15+
</package>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
$ErrorActionPreference = 'Stop'
2+
Import-Module vm.common -Force -DisableNameChecking
3+
4+
$toolName = "binaryninja"
5+
$category = VM-Get-Category($MyInvocation.MyCommand.Definition)
6+
7+
try {
8+
$url = "https://cdn.binary.ninja/installers/$($toolName)_free_win64.exe"
9+
$executablePath = Join-Path ${Env:ProgramFiles} "Vector35\$toolName\$toolName.exe"
10+
11+
VM-Install-With-Installer -toolName $toolName `
12+
-category $category `
13+
-fileType 'EXE' `
14+
-silentArgs '/S /ALLUSERS=1' `
15+
-executablePath $executablePath `
16+
-url $url `
17+
-consoleApp $false `
18+
-verifySignature
19+
20+
} catch {
21+
VM-Write-Log-Exception $_
22+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$ErrorActionPreference = 'Continue'
2+
Import-Module vm.common -Force -DisableNameChecking
3+
4+
$toolName = "binaryninja"
5+
$category = VM-Get-Category($MyInvocation.MyCommand.Definition)
6+
7+
VM-Uninstall-With-Uninstaller -toolName $toolName `
8+
-category $category `
9+
-fileType "EXE" `
10+
-silentArgs "/S /ALLUSERS=1"

packages/common.vm/common.vm.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
33
<metadata>
44
<id>common.vm</id>
5-
<version>0.0.0.20250425</version>
5+
<version>0.0.0.20250509</version>
66
<description>Common libraries for VM-packages</description>
77
<authors>Mandiant</authors>
88
</metadata>

packages/common.vm/tools/vm.common/vm.common.psm1

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,14 +458,18 @@ function VM-Install-From-Zip {
458458
if ($verifySignature) {
459459
# Check signature of all executable files individually
460460
Get-ChildItem -Path "$toolDir\*.exe" | ForEach-Object {
461+
$file = $_
461462
try {
462463
# Check signature for each file
463-
VM-Assert-Signature $_.FullName
464+
VM-Assert-Signature $file.FullName
464465
} catch {
465-
# Remove the file with invalid signature
466-
Write-Warning "Removing file '$($_.FullName)' due to invalid signature"
467-
Remove-Item $_.FullName -Force -ea 0 | Out-Null
468466
VM-Write-Log-Exception $_
467+
if ($_.Exception.Message -like "INVALID SIGNATURE*")
468+
{
469+
# Remove the file with invalid signature
470+
VM-Write-Log "ERROR" "Removing file '$($file.FullName)' due to invalid signature"
471+
Remove-Item $file.FullName -Force -ea 0 | Out-Null
472+
}
469473
}
470474
}
471475
}
@@ -738,6 +742,8 @@ function VM-Install-With-Installer {
738742
[Parameter(Mandatory=$false)]
739743
[bool] $consoleApp=$false,
740744
[Parameter(Mandatory=$false)]
745+
[switch] $verifySignature,
746+
[Parameter(Mandatory=$false)]
741747
[string] $arguments = "",
742748
[Parameter(Mandatory=$false)]
743749
[string] $iconLocation
@@ -753,9 +759,15 @@ function VM-Install-With-Installer {
753759
$packageArgs = @{
754760
packageName = ${Env:ChocolateyPackageName}
755761
url = $url
756-
checksum = $sha256
757-
checksumType = "sha256"
758762
}
763+
764+
# Add checksum details only if signature verification is not requested
765+
if (-not $verifySignature)
766+
{
767+
$packageArgs.checksum = $sha256
768+
$packageArgs.checksumType = 'sha256'
769+
}
770+
759771
if ($ext -in @("zip", "7z")) {
760772
VM-Remove-PreviousZipPackage ${Env:chocolateyPackageFolder}
761773
$unzippedDir= Join-Path $toolDir "$($toolName)_installer"
@@ -781,6 +793,25 @@ function VM-Install-With-Installer {
781793
VM-Assert-Path $installerPath
782794
}
783795

796+
if ($verifySignature) {
797+
# Check signature of all executable files individually
798+
Get-ChildItem -path $toolDir -include *.msi, *.exe -recurse -File -ea 0 | ForEach-Object {
799+
$file = $_
800+
try {
801+
# Check signature for each file
802+
VM-Assert-Signature $file.FullName
803+
} catch {
804+
VM-Write-Log-Exception $_
805+
if ($_.Exception.Message -like "INVALID SIGNATURE*")
806+
{
807+
# Remove the file with invalid signature
808+
VM-Write-Log "ERROR" "Removing file '$($file.FullName)' due to invalid signature"
809+
Remove-Item $file.FullName -Force -ea 0 | Out-Null
810+
}
811+
}
812+
}
813+
}
814+
784815
# Install tool via native installer
785816
$packageArgs = @{
786817
packageName = ${Env:ChocolateyPackageName}

0 commit comments

Comments
 (0)