Implementation:3641397194 wq Gpt6 Astra ida toolbox
| Knowledge Sources | |
|---|---|
| Domains | Installer, IDA_Integration |
| Last Updated | 2026-10-26 14:00 GMT |
Overview
Concrete tool for installing, status-checking, and uninstalling the IDA Pro Chinese-localization plugin into the platform-correct IDA plugins directory, provided by the ColdBrew Zero desktop lib.
Description
The ida-toolbox module resolves the target IDA plugins directory across platforms (IDAUSR env var, macOS/Linux/Windows user dirs, or an explicit override), then copies the vendored `ida_zh_cn.py` and `zh_cn.json` files with SHA-256 verification. On install, existing files that differ from the source are timestamped-backed-up before overwrite. On uninstall, all plugin artifacts (including the conf and missing-words log) are removed. Path safety guards ensure only a directory named `plugins` is written to and the disk root is never targeted.
The source plugin files are located either in the Electron `resourcesPath` (packaged app) or the repo `tools/ida-zh-cn/plugin` directory (development).
Usage
- One-click IDA 汉化 install: the desktop workbench calls `install()` to deploy the Chinese localization plugin into the user's IDA.
- Check status: call `status()` to see whether the plugin is installed, present, and hash-matching.
- Uninstall: `uninstall()` removes all plugin files and restores the prior state (files are simply removed; backups remain).
- Override target: pass `{ target: '/path/to/plugins' }` to install into a non-default directory.
Code Reference
Source Location
- Repository: ColdBrew Zero
- File: desktop/src/lib/ida-toolbox.js
- Lines: 1-154
Signature
const CORE_FILES = ["ida_zh_cn.py", "zh_cn.json"];
const REMOVABLE_FILES = ["ida_zh_cn.py", "zh_cn.json", "ida_zh_cn.conf.json", "ida_zh_cn_missing.txt"];
function pluginSourceDir() -> string
function resolveTarget(options?: { target?, env?, home?, platform? }) -> { target: string, targetSource: string }
function status(options?: object) -> StatusResult
function install(options?: object) -> InstallResult
function uninstall(options?: object) -> UninstallResult
module.exports = { CORE_FILES, REMOVABLE_FILES, pluginSourceDir, resolveTarget, status, install, uninstall };
Import
const ida = require('./ida-toolbox');
// Status check
const result = ida.status();
console.log(result.installed); // true if plugin files are present and hash-match
// Install
const res = ida.install();
console.log(res.action); // 'install'
console.log(res.backups); // array of backup paths (if any were overwritten)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| options.target | string | No | Explicit plugins directory (overrides IDAUSR/platform defaults) |
| options.env | object | No | Environment object (default: process.env), reads IDAUSR |
| options.home | string | No | Home directory (default: os.homedir()) |
| options.platform | string | No | Platform (default: process.platform) |
| options.sourceDir | string | No | Source plugin directory (default: auto-detected) |
Outputs
| Name | Type | Description |
|---|---|---|
| status returns | object | { ok, action: 'status', sourceDir, sourceReady, target, targetSource, targetExists, installed, present, files } |
| install returns | object | { ...status, action: 'install', backups: string[] } |
| uninstall returns | object | { ...status, action: 'uninstall', removed: string[] } |
Usage Examples
Check and Install
const ida = require('./ida-toolbox');
// 1. Check current status
const before = ida.status();
console.log(before.installed); // false if not yet installed
console.log(before.targetSource); // 'IDAUSR' or 'macOS 用户目录' etc.
// 2. Install the plugin
const result = ida.install();
console.log(result.action); // 'install'
console.log(result.installed); // true
console.log(result.backups); // [] or list of backed-up file paths
// 3. Verify
const after = ida.status();
console.log(after.files); // [{ name: 'ida_zh_cn.py', present: true, match: true }, ...]
Uninstall
const ida = require('./ida-toolbox');
const res = ida.uninstall();
console.log(res.action); // 'uninstall'
console.log(res.removed); // ['/path/to/plugins/ida_zh_cn.py', ...]
Override Target Directory
const ida = require('./ida-toolbox');
// Install into a custom plugins directory
const res = ida.install({ target: '/opt/ida/plugins' });
console.log(res.target); // '/opt/ida/plugins'