$npx -y skills add vulhunt-re/skills --skill decompilerDecompile a function to C-like pseudocode for human-readable analysis. Use to understand function logic, review control flow, or prepare for code pattern matching.
| 1 | # Decompiler |
| 2 | |
| 3 | Decompile a function in a binary to C-like pseudocode. |
| 4 | |
| 5 | ## When to use |
| 6 | |
| 7 | - View the decompiled source code of a function |
| 8 | - Analyze function logic and control flow |
| 9 | - Understand what a function does before deeper analysis |
| 10 | |
| 11 | ## Instructions |
| 12 | |
| 13 | Using the VulHunt MCP tools, open the project (`open_project`) and run the following Lua query (`query_project`), adapting it as needed: |
| 14 | ```lua |
| 15 | local d = project:decompile(<target_function>) |
| 16 | |
| 17 | return tostring(d) |
| 18 | ``` |
| 19 | |
| 20 | Possible values for `<target_function>`: |
| 21 | - A string, e.g. `"system"` |
| 22 | - An AddressValue |
| 23 | - VulHunt APIs return addresses as an AddressValue |
| 24 | - To build an AddressValue, use for example: `AddressValue.new(0x1234)` |
| 25 | - A regex, e.g. `{matching = "<regex>", kind = "symbol", all = true}` |
| 26 | - A byte pattern, e.g. `{matching = "41544155", kind = "bytes", all = true}` |
| 27 | |
| 28 | > `all` is a boolean. If set to `true`, it returns a table containing all matching functions. If `false` (default), it returns only the first matching value. The for loop is not necessary if the function target is only one (i.e. `all` is not set to true) |
| 29 | |
| 30 | |
| 31 | Returns the decompiled C-like pseudocode as a string. |
| 32 | |
| 33 | ## Related Skills |
| 34 | |
| 35 | - **functions** (`/functions`) — Use this skill to locate specific functions by name, address, pattern, or behavioral criteria (e.g., functions that call a particular API) before decompiling them. |
| 36 | - **code-pattern-matching** (`/code-pattern-matching`) - Search for specific code patterns in the decompiled output |