1
1
$ErrorActionPreference = ' Stop'
2
2
Import-Module vm.common - Force - DisableNameChecking
3
3
4
- try {
5
- $toolName = ' binaryninja'
6
- $category = ' Disassemblers'
7
-
8
- $packageArgs = @ {
9
- packageName = ${Env: ChocolateyPackageName}
10
- fileType = ' exe'
11
- silentArgs = ' /S /ALLUSERS=1'
12
- url = ' https://cdn.binary.ninja/installers/binaryninja_free_win64.exe'
13
- checksum = ' 426aa8219415a64df90562274ae7e420471934c60f3a19c459e982467469cf55'
14
- checksumType = ' sha256'
15
- }
4
+ $installFile = " binaryninja_free_win64.exe"
16
5
17
- Install-ChocolateyPackage @packageArgs
6
+ function Get-CurrentHash {
7
+ param (
8
+ [string ]$url = " https://binary.ninja/js/hashes.json" ,
9
+ [string ]$installFile = $installFile
10
+ )
11
+ $json = Invoke-WebRequest - Uri $url
12
+ $json = ConvertFrom-Json $json
13
+ return $json.Hashes .$installFile
14
+ }
18
15
19
- $toolDir = Join-Path ${Env: ProgramFiles} " Vector35" - Resolve
20
- $toolDir = Join-Path $toolDir " BinaryNinja" - Resolve
21
- $executablePath = Join-Path $toolDir " binaryninja.exe" - Resolve
16
+ try {
17
+ $url = " https://cdn.binary.ninja/installers/$installFile "
18
+ $hash = Get-CurrentHash
19
+ $toolDir = Join-Path ${Env: ProgramFiles} " Vector35"
20
+ $toolDir = Join-Path $toolDir " BinaryNinja"
21
+ $executablePath = Join-Path $toolDir " binaryninja.exe"
22
22
23
- Install-BinFile - Name $toolname - Path $executablePath
24
- $executableIcon = Join-Path $toolDir " icon.ico" - Resolve
25
- VM- Install-Shortcut - toolName " binja" - category $category - executablePath $executablePath - IconLocation $executableIcon
23
+ VM- Install-With - Installer - toolName ' binaryninja' `
24
+ - category ' Disassemblers' `
25
+ - fileType ' EXE' `
26
+ - silentArgs ' /S /ALLUSERS=1' `
27
+ - executablePath $executablePath `
28
+ - url $url `
29
+ - sha256 $hash `
30
+ - consoleApp $false
26
31
27
32
} catch {
28
33
VM- Write-Log - Exception $_
29
- }
34
+ }
0 commit comments