-
Notifications
You must be signed in to change notification settings - Fork 68
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 #666 from Ana06/plugins
Add ida.plugin.capa.vm
- Loading branch information
Showing
7 changed files
with
84 additions
and
11 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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>ida.plugin.capa.vm</id> | ||
<version>6.1.0</version> | ||
<description>capa explorer is an IDAPython plugin that integrates capa with IDA Pro.</description> | ||
<authors>@mike-hunhoff, @williballenthin, @mr-tz</authors> | ||
<dependencies> | ||
<dependency id="common.vm" /> | ||
<dependency id="libraries.python3.vm" version="0.0.0.20230927" /> | ||
</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,43 @@ | ||
$ErrorActionPreference = 'Stop' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
try { | ||
# Install plugin | ||
$pluginUrl = "https://raw.githubusercontent.com/mandiant/capa/v6.1.0/capa/ida/plugin/capa_explorer.py" | ||
$pluginSha256 = "a9a60d9066c170c4e18366eb442f215009433bcfe277d3c6d0c4c9860824a7d3" | ||
$pluginsDir = New-Item "$Env:APPDATA\Hex-Rays\IDA Pro\plugins" -ItemType "directory" -Force | ||
$pluginPath = Join-Path $pluginsDir "capa_explorer.py" | ||
$packageArgs = @{ | ||
packageName = ${Env:ChocolateyPackageName} | ||
url = $pluginUrl | ||
checksum = $pluginSha256 | ||
checksumType = "sha256" | ||
fileFullPath = $pluginPath | ||
forceDownload = $true | ||
} | ||
Get-ChocolateyWebFile @packageArgs | ||
VM-Assert-Path $pluginPath | ||
|
||
# Download capa rules | ||
$rulesUrl = "https://github.com/mandiant/capa-rules/archive/refs/tags/v6.1.0.zip" | ||
$rulesSha256 = "d87240475b2989e919f65381556f28b455a2f7d6cd35d95acdbbbe9f04f86c84" | ||
$packageArgs = @{ | ||
packageName = ${Env:ChocolateyPackageName} | ||
unzipLocation = $pluginsDir | ||
url = $rulesUrl | ||
checksum = $rulesSha256 | ||
checksumType = 'sha256' | ||
} | ||
Install-ChocolateyZipPackage @packageArgs | ||
$rulesDir = Join-Path $pluginsDir "capa-rules-6.1.0" -Resolve | ||
|
||
# Set capa rules in the capa plugin | ||
$registryPath = 'HKCU:\SOFTWARE\IDAPython\IDA-Settings\capa' | ||
New-Item $registryPath -Force | Out-Null | ||
# ida_settings expects '/' in the rule path | ||
$value = $rulesDir.replace("\", "/") | ||
Set-ItemProperty $registryPath -Name "rule_path" -Value "`"$value`"" -Force | Out-Null | ||
} 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,15 @@ | ||
$ErrorActionPreference = 'Continue' | ||
Import-Module vm.common -Force -DisableNameChecking | ||
|
||
$pluginsDir = "$Env:APPDATA\Hex-Rays\IDA Pro\plugins" | ||
|
||
# Uninstall plugin | ||
$pluginPath = Join-Path $pluginsDir "capa_explorer.py" | ||
Remove-Item $pluginPath | ||
|
||
# Delete capa rules | ||
$rulesDir = Join-Path $pluginsDir "capa-rules-6.1.0" | ||
Remove-Item $rulesDir | ||
|
||
# Delete registry information | ||
Remove-Item 'HKCU:\SOFTWARE\IDAPython\IDA-Settings\capa' |
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
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
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
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