Skip to content

lushun2014/lushibo-skills / ida-reverse

ida-reverse

Verified

IDA Pro 逆向分析辅助技能(binary reverse engineering)。能力:通过 idalib-mcp 的 idapro_* 工具做反编译、反汇编、交叉引用与数据流追踪、类型恢复、批量改名注释与 patch,并用自带 scripts/start.ps1、scripts/open.ps1 稳定管理服务器与打开文件,避免手写临时命令。Use when 用户提到逆向、反编译、破解、找密码、注册机、漏洞分析、病毒分析、固件分析、IDA、idapro、idalib,或需要分析 exe、dll、so、elf、macho、sys、apk、dex 等任意二进制;即使用户只说看看这个exe、分析这个dll、帮我破解、找一下密码、这个软件怎么注册,也应使用本 skill。交付物:函数与结构体分析结论、重命名与注释后的 IDB、关键算法还原说明与 report.md 分析报告。

FileKindSize
SKILL.mdskill md14.9 KB
references/ida-mcp-cheatsheet.mdmarkdown10.8 KB
scripts/open.ps1script7.9 KB
scripts/start.ps1script6.0 KB

scripts/start.ps1

View on GitHub
<#
.SYNOPSIS
Start IDA Pro MCP HTTP server (background, non-blocking)

.DESCRIPTION
1. Kill old process
2. Start idalib-mcp HTTP server in hidden window mode
3. Wait for service ready (max 15 seconds)
4. Output result

Usage: run without parameters
#>

param(
    [string]$IdaDir,
    [int]$Port = 13337,
    [string]$ServerPath
)

function Get-InstalledIdaDir {
    $registryPaths = @(
        'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
        'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*',
        'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
    )

    $fromRegistry = $registryPaths |
        ForEach-Object {
            Get-ItemProperty $_ -ErrorAction SilentlyContinue
        } |
        Where-Object {
            ($_.DisplayName -match 'IDA|Hex-Rays') -and
            -not [string]::IsNullOrWhiteSpace($_.InstallLocation) -and
            (Test-Path -LiteralPath $_.InstallLocation)
        } |
        Select-Object -ExpandProperty InstallLocation -First 1

    if ($fromRegistry) {
        return $fromRegistry
    }

    $idaCandidates = @(
        'C:\Program Files\IDA Pro',
        'C:\Program Files\IDA',
        'C:\IDA Pro',
        'C:\IDA',
        'D:\IDA',
        'E:\Program Files\IDA',
        (Join-Path $env:USERPROFILE 'Tools\IDA')
    ) | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }

    return $idaCandidates | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1
}

if ([string]::IsNullOrWhiteSpace($IdaDir)) {
    if (-not [string]::IsNullOrWhiteSpace($env:IDADIR)) {
        $IdaDir = $env:IDADIR
    } else {
        $persistedIdaDir = [Environment]::GetEnvironmentVariable('IDADIR', 'User')
        if ([string]::IsNullOrWhiteSpace($persistedIdaDir)) {
            $persistedIdaDir = [Environment]::GetEnvironmentVariable('IDADIR', 'Machine')
        }

        if (-not [string]::IsNullOrWhiteSpace($persistedIdaDir) -and (Test-Path -LiteralPath $persistedIdaDir)) {
            $IdaDir = $persistedIdaDir
        } else {
            # Search registry install records and common fallback paths
            $foundIda = Get-InstalledIdaDir
            if ($foundIda) {
                $IdaDir = $foundIda
            } else {
                Write-Output "ERR:IDADIR not set and IDA Pro not found. Set IDADIR environment variable."
                exit 1
            }
        }
    }
}
$env:IDADIR = $IdaDir

if ([string]::IsNullOrWhiteSpace($ServerPath)) {
    # Try both possible executable names (idalib-mcp is the HTTP server, ida-pro-mcp is the installer CLI)
    $resolved = Get-Command idalib-mcp -ErrorAction SilentlyContinue
    if (-not $resolved) {
        $resolved = Get-Command ida-pro-mcp -ErrorAction SilentlyContinue
    }
    if ($resolved) {
        $ServerPath = $resolved.Source
    }
    else {
        $roamingPython = Join-Path $env:APPDATA 'Python'
        if (Test-Path -LiteralPath $roamingPython) {
            $candidate = Get-ChildItem -LiteralPath $roamingPython -Directory -ErrorAction SilentlyContinue |
                ForEach-Object {
                    $scripts = Join-Path $_.FullName 'Scripts'
                    @('idalib-mcp.exe', 'ida-pro-mcp.exe') | ForEach-Object { Join-Path $scripts $_ }
                } |
                Where-Object { Test-Path -LiteralPath $_ } |
                Select-Object -First 1
            if ($candidate) {
                $ServerPath = $candidate
            }
        }
    }
}

# Auto-bootstrap if still not found
if ([string]::IsNullOrWhiteSpace($ServerPath)) {
    $bootstrapScript = Join-Path $PSScriptRoot '..\..\scripts\bootstrap-reverse.ps1'
    if (Test-Path -LiteralPath $bootstrapScript) {
        Write-Output "INFO: ida-pro-mcp not found, attempting auto-bootstrap (installing mrexodia/ida-pro-mcp)..."
        & powershell.exe -NoProfile -ExecutionPolicy Bypass -File $bootstrapScript -Capability @('idalib-mcp') -SkipRefresh
        $resolved = Get-Command ida-pro-mcp -ErrorAction SilentlyContinue
        if (-not $resolved) {
            $resolved = Get-Command idalib-mcp -ErrorAction SilentlyContinue
        }
        if ($resolved) {
            $ServerPath = $resolved.Source
        }
        else {
            $roamingPython = Join-Path $env:APPDATA 'Python'
            if (Test-Path -LiteralPath $roamingPython) {
                $candidate = Get-ChildItem -LiteralPath $roamingPython -Directory -ErrorAction SilentlyContinue |
                    ForEach-Object {
                        $scripts = Join-Path $_.FullName 'Scripts'
                        @('ida-pro-mcp.exe', 'idalib-mcp.exe') | ForEach-Object { Join-Path $scripts $_ }
                    } |
                    Where-Object { Test-Path -LiteralPath $_ } |
                    Select-Object -First 1
                if ($candidate) {
                    $ServerPath = $candidate
                }
            }
        }
    }
}

if ([string]::IsNullOrWhiteSpace($ServerPath)) {
    throw 'Missing required CLI tool: ida-pro-mcp — auto-bootstrap failed. Install manually: pip install git+https://github.com/mrexodia/ida-pro-mcp.git && ida-pro-mcp --install'
}

# 清理旧进程(杀进程树,包括 worker 子进程)
$old = Get-Process -Name "ida-pro-mcp" -ErrorAction SilentlyContinue
if (-not $old) { $old = Get-Process -Name "idalib-mcp" -ErrorAction SilentlyContinue }
if ($old) { taskkill /F /T /PID $old.Id 2>$null | Out-Null; Start-Sleep 2 }

# 后台启动
Start-Process -WindowStyle Hidden -FilePath $ServerPath -ArgumentList "--host 127.0.0.1 --port $Port"

# 等待就绪
$ready = $false
for ($i = 0; $i -lt 15; $i++) {
    Start-Sleep -Seconds 1
    try {
        $r = Invoke-RestMethod "http://127.0.0.1:$Port/mcp" -Method Post `
            -Body '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' `
            -ContentType "application/json" -ErrorAction Stop
        if ($r.result.tools.Count -gt 0) {
            Write-Output "OK:$($r.result.tools.Count)"
            $ready = $true
            break
        }
    } catch {}
}
if (-not $ready) {
    Write-Output "ERR:timeout"
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall