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

Update idafree to use ida_launcher #761

Merged
merged 1 commit into from
Dec 13, 2023
Merged
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
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
29 changes: 17 additions & 12 deletions packages/idafree.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ try {

$toolDir = Join-Path ${Env:ProgramFiles} "IDA Freeware 8.3" -Resolve
$executablePath = Join-Path $toolDir "ida64.exe" -Resolve
$shortcut = Join-Path $shortcutDir "$toolname.lnk"
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath
VM-Assert-Path $shortcut

Install-BinFile -Name $toolname -Path $executablePath

Expand All @@ -30,16 +27,24 @@ 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/773649e54aaea62f270c8416cb480020d6475065/ida_launcher/ida_launcher.exe'
$launcherPath = Join-Path ${Env:RAW_TOOLS_DIR} "$launcherName.exe"
$launcherChecksum = "ebebf8cf01253aab0562b42128f08fdb9b4452f1f49847c51673e5610063a8b5"
Write-Host "[+] Downloading '$launcherSource'"
Get-ChocolateyWebFile -PackageName $launcherName -FileFullPath $launcherPath -Url $launcherSource -Checksum $launcherChecksum -ChecksumType "sha256"

VM-Assert-Path $launcherPath

$launcherShortcut = Join-Path $shortcutDir "ida.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"
emtuls marked this conversation as resolved.
Show resolved Hide resolved
} catch {
VM-Write-Log-Exception $_
}
7 changes: 0 additions & 7 deletions packages/idafree.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@ $ErrorActionPreference = 'Continue'
Import-Module vm.common -Force -DisableNameChecking

$toolName = 'idafree'
$category = 'Disassemblers'

# Remove tool shortcut
VM-Remove-Tool-Shortcut $toolName $category

# Remove binary from PATH
Uninstall-BinFile -Name $toolName

# Manually silently uninstall
VM-Uninstall-With-Uninstaller "IDA Freeware*?8.3" "EXE" "--mode unattended"

VM-Remove-From-Right-Click-Menu $toolName
VM-Remove-From-Right-Click-Menu $toolName-64
1 change: 1 addition & 0 deletions scripts/test/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class UsesInvalidCategory(Lint):
"openjdk.vm",
"python3.vm",
"x64dbgpy.vm",
"idafree.vm",
]

root_path = os.path.abspath(os.path.join(__file__, "../../.."))
Expand Down
Loading