Skip to content

Commit

Permalink
Merge pull request #32 from mandiant/add_idafree
Browse files Browse the repository at this point in the history
Add idafree.vm package
  • Loading branch information
MalwareMechanic authored Oct 26, 2021
2 parents 97dbf4b + 39416b2 commit 8e89ad7
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/idafree.vm/idafree.vm.nuspec
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>
33 changes: 33 additions & 0 deletions packages/idafree.vm/tools/chocolateyInstall.ps1
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 $_
}
32 changes: 32 additions & 0 deletions packages/idafree.vm/tools/chocolateyUninstall.ps1
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."
}

0 comments on commit 8e89ad7

Please sign in to comment.