Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Binary Ninja package #1229

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/binaryninja.vm/binaryninja.vm.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>binaryninja.vm</id>
<version>4.2.6455</version>
<authors>Vector 35, Inc.</authors>
<description>Binary Ninja is an interactive decompiler, disassembler, debugger, and binary analysis platform built by reverse engineers, for reverse engineers.</description>
<dependencies>
<dependency id="common.vm" />
</dependencies>
</metadata>
</package>
36 changes: 36 additions & 0 deletions packages/binaryninja.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

$toolName = "binaryninja"
$category = "Disassemblers"
$installFile = "binaryninja_free_win64.exe"

function Get-CurrentHash {
param (
[string]$url = "https://binary.ninja/js/hashes.json",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sreinhardt thanks for the changes. But I think this is an issue, as fetching the hash during the installation is the same as not checking the hash. Two options:

  1. Use VM-Install-With-Installer hardcoding the hash. We won't be able to add the package the the FLARE-VM default configuration (because we know the hash will eventually change) but you and others can still select to install it in the FLARE-VM installer GUI (or providing a modified config).
  2. Use VM-assert-signature, as you say that this works for this tool. This allows us to add the package to FLARE-VM default configuration. Two options to implement this:
      2.1. Duplicate most of the code in VM-Install-With-Installer in this package to add VM-assert-signature.
       2.2 Extend VM-Install-With-Installer adding a switch -verifySignature, similarly as we have done in Use SigCheck w/ Zimmerman Tools #1199 with VM-Install-From-Zip. This implementation avoid code duplication and allow us to use signature verification for other installers as well.

I prefer 2.2 as it is the most robust option which also enhance the project by extending VM-Install-With-Installer to support signature verification. But I understand this requires more work than the other options. So I would be ok with any of the proposed options if you don't have the time to implement 2.2.

[string]$installFile = $installFile
)
$json = Invoke-WebRequest -Uri $url
$json = ConvertFrom-Json $json
return $json.Hashes.$installFile
}

try {
$url = "https://cdn.binary.ninja/installers/$installFile"
$hash = Get-CurrentHash
$toolDir = Join-Path ${Env:ProgramFiles} "Vector35"
$toolDir = Join-Path $toolDir "BinaryNinja"
$executablePath = Join-Path $toolDir "binaryninja.exe"

VM-Install-With-Installer -toolName $toolName `
-category $category `
-fileType 'EXE' `
-silentArgs '/S /ALLUSERS=1' `
-executablePath $executablePath `
-url $url `
-sha256 $hash `
-consoleApp $false

} catch {
VM-Write-Log-Exception $_
}
10 changes: 10 additions & 0 deletions packages/binaryninja.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$ErrorActionPreference = 'Continue'
Import-Module vm.common -Force -DisableNameChecking

$toolName = "binaryninja"
$category = "Disassemblers"

VM-Uninstall-With-Uninstaller -toolName $toolName `
-category $category `
-fileType "EXE" `
-silentArgs "/S /ALLUSERS=1"
Loading