Skip to content

Commit

Permalink
Update idafree to use ida_launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
emtuls committed Nov 30, 2023
1 parent c3bf82d commit ad254ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/idafree.vm/idafree.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>idafree.vm</id>
<version>8.3</version>
<version>8.3.0.20231129</version>
<authors>hex-rays</authors>
<description>Free version of IDA, a powerful Interactive DisAssembler and debugger</description>
<dependencies>
Expand Down
25 changes: 16 additions & 9 deletions packages/idafree.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@ try {
Remove-Item $desktopShortcut -Force -ea 0
}

# Download ida_launcher.exe to assist with taskbar and right click option and store it in %RAW_TOOLS_DIR%
# ida_launcher.exe is a custom binary that searches for the latest ida64.exe and executes it
$launcherName = 'ida_launcher'
$launcherSource = 'https://raw.githubusercontent.com/mandiant/vm-packages/main/ida_launcher/ida_launcher.exe'
$launcherPath = Join-Path ${Env:RAW_TOOLS_DIR} "$launcherName.exe"
Write-Host "[+] Downloading '$launcherSource'"
(New-Object System.Net.WebClient).DownloadFile($launcherSource, $launcherPath)

VM-Assert-Path $launcherPath

$launcherShortcut = Join-Path ${Env:RAW_TOOLS_DIR} "$launcherName.lnk"
$menuIcon = Join-Path $toolDir "ida.ico" -Resolve
# Run a Powershell script to open with last IDA Pro version which is likely installed after the IDA free package.
# It takes slightly longer than using an static path but it works after installing IDA Pro and every time you update it.
# The "-WindowStyle hidden" still shows the Powershell Window briefly: https://github.com/PowerShell/PowerShell/issues/3028
# We could use the run-hidden wrapper, which won't display the Window but is likely slightly slower.
$script = "`$idaExecutable = Get-Item '$Env:programfiles\IDA Pro *\ida.exe' | Select-Object -Last 1; if (!`$idaExecutable) { `$idaExecutable = '$executablePath' }; & `$idaExecutable '%1'"
VM-Add-To-Right-Click-Menu $toolName 'Open with IDA' "powershell.exe -WindowStyle hidden `"$script`"" "$menuIcon"
# Repeat for x64
$script = "`$idaExecutable = Get-Item '$Env:programfiles\IDA Pro *\ida64.exe' | Select-Object -Last 1; if (!`$idaExecutable) { `$idaExecutable = '$executablePath' }; & `$idaExecutable '%1'"
VM-Add-To-Right-Click-Menu $toolName-64 'Open with IDA (x64)' "powershell.exe -WindowStyle hidden `"$script`"" "$executablePath"

Install-ChocolateyShortcut -shortcutFilePath $launcherShortcut -targetPath $launcherPath -IconLocation $menuIcon

# ida64.exe supports both 32 bit and 64 bit in IDA >= 8.2
VM-Add-To-Right-Click-Menu $launcherName 'Open with IDA' "`"$launcherPath`" `"%1`"" "$menuIcon"
} catch {
VM-Write-Log-Exception $_
}

0 comments on commit ad254ce

Please sign in to comment.