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
+ $toolName = " binaryninja"
5
+ $category = " Disassemblers"
6
+ $installFile = " binaryninja_free_win64.exe"
16
7
17
- Install-ChocolateyPackage @packageArgs
8
+ function Get-CurrentHash {
9
+ param (
10
+ [string ]$url = " https://binary.ninja/js/hashes.json" ,
11
+ [string ]$installFile = $installFile
12
+ )
13
+ $json = Invoke-WebRequest - Uri $url
14
+ $json = ConvertFrom-Json $json
15
+ return $json.Hashes .$installFile
16
+ }
18
17
19
- $toolDir = Join-Path ${Env: ProgramFiles} " Vector35" - Resolve
20
- $toolDir = Join-Path $toolDir " BinaryNinja" - Resolve
21
- $executablePath = Join-Path $toolDir " binaryninja.exe" - Resolve
18
+ try {
19
+ $url = " https://cdn.binary.ninja/installers/$installFile "
20
+ $hash = Get-CurrentHash
21
+ $toolDir = Join-Path ${Env: ProgramFiles} " Vector35"
22
+ $toolDir = Join-Path $toolDir " BinaryNinja"
23
+ $executablePath = Join-Path $toolDir " binaryninja.exe"
22
24
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
25
+ VM- Install-With - Installer - toolName $toolName `
26
+ - category $category `
27
+ - fileType ' EXE' `
28
+ - silentArgs ' /S /ALLUSERS=1' `
29
+ - executablePath $executablePath `
30
+ - url $url `
31
+ - sha256 $hash `
32
+ - consoleApp $false
26
33
27
34
} catch {
28
35
VM- Write-Log - Exception $_
29
- }
36
+ }
0 commit comments