-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from mandiant/add_idafree
Add idafree.vm package
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>idafree.vm</id> | ||
<version>7.6</version> | ||
<authors>hex-rays</authors> | ||
<description>Free version of IDA, a powerful Interactive DisAssembler and debugger</description> | ||
<dependencies> | ||
<dependency id="common.vm" /> | ||
</dependencies> | ||
</metadata> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
$ErrorActionPreference = 'Stop' | ||
Import-Module VM.common -Force -DisableNameChecking | ||
|
||
try { | ||
$toolName = 'idafree' | ||
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} 'Disassemblers' | ||
|
||
$packageArgs = @{ | ||
packageName = ${Env:ChocolateyPackageName} | ||
fileType = 'exe' | ||
silentArgs = '--mode unattended' | ||
url = 'https://out7.hex-rays.com/files/idafree76_windows.exe' | ||
checksum = '2ecc5b2f5329c4e7a4243634801180be38a397c31a330324c8abc605f5dffb9e' | ||
checksumType = 'sha256' | ||
} | ||
Install-ChocolateyPackage @packageArgs | ||
|
||
$toolDir = Join-Path ${Env:ProgramFiles} "IDA Freeware 7.6" -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 | ||
|
||
# Delete Desktop shortcut | ||
$desktopShortcut = Join-Path ${Env:Public} "Desktop\IDA Freeware 7.6.lnk" | ||
if (Test-Path $desktopShortcut) { | ||
Remove-Item $desktopShortcut -Force -ea 0 | ||
} | ||
} catch { | ||
VM-Write-Log-Exception $_ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
$ErrorActionPreference = 'Continue' | ||
Import-Module VM.common -Force -DisableNameChecking | ||
|
||
$toolName = 'idafree' | ||
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} 'Disassemblers' | ||
|
||
# Remove shortcut file | ||
$shortcut = Join-Path $shortcutDir "$toolName.lnk" | ||
Remove-Item $shortcut -Force -ea 0 | ||
|
||
# Remove binary from PATH | ||
Uninstall-BinFile -Name $toolName | ||
|
||
# Attempt to find and execute the uninstaller | ||
[array]$key = Get-UninstallRegistryKey -SoftwareName 'IDA Freeware*?7.6' | ||
if ($key.Count -eq 1) { | ||
$packageArgs = @{ | ||
packageName = ${Env:ChocolateyPackageName} | ||
fileType = 'exe' | ||
silentArgs = '--mode unattended' | ||
file = $key[0].UninstallString | ||
} | ||
Uninstall-ChocolateyPackage @packageArgs | ||
} elseif ($key.Count -eq 0) { | ||
VM-Write-Log "WARN" "${Env:ChocolateyPackageName} has already been uninstalled by other means." | ||
} elseif ($key.Count -gt 1) { | ||
VM-Write-Log "WARN" "$($key.Count) matches found!" | ||
VM-Write-Log "WARN" "To prevent accidental data loss, no targeted uninstallation will occur." | ||
VM-Write-Log "WARN" "The following installation values were found:" | ||
$key | % {VM-Write-Log "WARN" " - $($_.DisplayName)"} | ||
VM-Write-Log "WARN" "Now allowing Chocolatey's auto uninstaller a chance to run." | ||
} |