Skip to content
Back to search

idalib-rs

MarketplaceWorks with Claude CodeGitHub

Idiomatic Rust bindings for the IDA SDK, enabling the development of standalone analysis tools using IDA v9.x’s idalib

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/idalib-rs--idalib/badge.svg)](/listings/idalib-rs--idalib)

HTML

<a href="/listings/idalib-rs--idalib"><img src="/api/listings/idalib-rs--idalib/badge.svg" alt="findsafeskills safety rating" /></a>

Install

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 18 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "name": "idalib-rs",
  3. "owner": {
  4. "name": "Sam L. Thomas",
  5. "email": "s@ghost.sh"
  6. },
  7. "metadata": {
  8. "description": "Skills for contributing to IDALIB Rust bindings",
  9. "version": "1.0.0"
  10. },
  11. "pluginRoot": "./",
  12. "plugins": [
  13. {
  14. "name": "idalib-rust-skills",
  15. "source": "./skills"
  16. }
  17. ]
  18. }
README.md · README · 244 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # idalib
  2. [![crates.io](https://img.shields.io/crates/v/idalib)](https://crates.io/crates/idalib)
  3. [![documentation](https://img.shields.io/badge/documentation-0.11.1%2B9.5.261026-blue?link=https%3A%2F%2Fidalib.rs%2Fidalib)](https://idalib.rs/idalib/)
  4. [![license](https://img.shields.io/crates/l/idalib)](https://github.com/idalib-rs/idalib)
  5. [![crates.io downloads](https://img.shields.io/crates/d/idalib)](https://crates.io/crates/idalib)
  6. Idiomatic Rust bindings for the IDA SDK, enabling the development of standalone
  7. analysis tools using IDA v9.x’s idalib.
  8. ## IDA support and dependencies
  9. The bindings and examples support IDA Pro v9.5 on Windows, Linux, and macOS
  10. (Apple Silicon). The latest bindings are only guaranteed compatible with the
  11. latest official IDA Pro/SDK release. See the table below for compatibility:
  12. | IDA Pro version | Latest compatible idalib |
  13. | --------------- | ------------------------ |
  14. | v9.5 | 0.11.1 |
  15. | v9.4 | 0.10.1 |
  16. | v9.3sp1 | 0.9.0 |
  17. | v9.3 | 0.8.1 |
  18. | v9.2 | 0.7.2 |
  19. | v9.1 | 0.6.1 |
  20. | v9.0sp1 | 0.4.1 |
  21. | v9.0 | 0.3.0 |
  22. In addition to the latest IDA SDK and IDA itself, a recent version of
  23. LLVM/Clang is required (this is to help generate bindings from the SDK), it can
  24. be obtained from, e.g., [here](https://github.com/llvm/llvm-project/releases).
  25. See the [bindgen
  26. documentation](https://rust-lang.github.io/rust-bindgen/requirements.html) for
  27. extended instructions for each supported operating system/environment.
  28. ## Developing with idalib
  29. For development, only the IDA SDK is required, whereas to run tests, an IDA
  30. installation (with a valid license) is required. During build, the crates
  31. can locate an IDA installation using the following environment variable:
  32. - `IDADIR` (optional) set to the directory containing the `ida` executable
  33. (e.g., `/Applications/IDA Professional v9.x/Contents/macOS` for macOS, or
  34. `$HOME/ida-pro-9.x` for Linux). If not set, the build script will check
  35. common locations.
  36. ### Projects using idalib
  37. - [xorpse/idalib-mp](https://github.com/xorpse/idalib-mp): example project demonstrating idalib + multi-processing.
  38. - [xorpse/parascope](https://github.com/xorpse/parascope): mass-scan source/decompiled code using weggli rulesets.
  39. - [0xdea/rhabdomancer](https://github.com/0xdea/rhabdomancer): locate calls to insecure API functions in a binary file.
  40. - [0xdea/haruspex](https://github.com/0xdea/haruspex): extract pseudo-code from the IDA Hex-Rays decompiler.
  41. - [0xdea/augur](https://github.com/0xdea/augur): extract strings and related pseudo-code from a binary file.
  42. ### Examples
  43. A minimal project to working with `idalib` requires the following components:
  44. `Cargo.toml`:
  45. ```toml
  46. name = "example-analyser"
  47. # ...
  48. [dependencies]
  49. idalib = "0.11.1"
  50. [build-dependencies]
  51. idalib-build = "0.11.1"
  52. ```
  53. `build.rs`:
  54. ```rust
  55. fn main() -> Result<(), Box<dyn std::error::Error>> {
  56. idalib_build::configure_linkage()?;
  57. Ok(())
  58. }
  59. ```
  60. `src/main.rs`:
  61. ```rust
  62. fn main() -> Result<(), Box<dyn std::error::Error>> {
  63. let idb = idalib::IDB::open("/path/to/binary")?;
  64. // ...
  65. Ok(())
  66. }
  67. ```
  68. More comprehensive examples can be found in `idalib/examples`. To run them:
  69. Linux/macOS:
  70. ```sh
  71. export IDADIR=...
  72. cargo run --example=dump_ls
  73. ```
  74. Windows:
  75. ```powershell
  76. $env:PATH="C:\Program Files\IDA Professional 9.5;$env:PATH"
  77. $env:IDADIR="C:\Program Files\IDA Professional 9.5"
  78. cargo run --example=dump_ls
  79. ```
  80. ### Linking
  81. The `idalib-build` crate provides various build script helpers to simplify
  82. linking:
  83. - `idalib_build::configure_idalib_linkage`: links against `(lib)ida` and
  84. `(lib)idalib` in the IDA installation directory.
  85. - `idalib_build::configure_idasdk_linkage`: links against the `(lib)ida` and
  86. `(lib)idalib` stub libraries bundled with the SDK.
  87. - `idalib_build::configure_linkage`: links against the `(lib)ida` and
  88. `(lib)idalib` stub libraries and for Linux/macOS sets the RPATH to refer to
  89. the detected (or specified via `IDADIR`) installation directory.
  90. ⚠️ Warning: If you copy the `build.rs` from `idalib/examples`, you may encounter
  91. unexpected behaviour when IDA is installed in a non-default location and
  92. `IDADIR` is not set, for example:
  93. ```sh
  94. error while loading shared libraries: [libida.so]
  95. ```
  96. This issue can be worked around by ensuring `IDADIR` is correctly set at build
  97. time, or by ensuring the `(lib)ida` and `(lib)idalib` shared libraries are
  98. available to the dynamic linker at runtime, e.g., via `LD_LIBRARY_PATH` or
  99. `/etc/ld.so.conf{,.d}`. Note that using the stub libraries provided by the SDK,
  100. e.g., those located at `$IDASDK/lib/...` as opposed to the
  101. libraries in the IDA installation directory will result in
  102. [crashes](https://github.com/idalib-rs/idalib/issues/24).
  103. For users wanting to use the `build.rs` from `idalib/examples`, e.g., so builds
  104. succeed via GitHub Actions without an IDA installation, we recommend using the
  105. following `build.rs` which will help debug issues related to linking:
  106. ```rust
  107. fn main() -> Result<(), Box<dyn std::error::Error>> {
  108. let (_, ida_path, idalib_path) = idalib_build::idalib_install_paths_with(false);
  109. if !ida_path.exists() || !idalib_path.exists() {
  110. println!("cargo::warning=IDA installation not found.");
  111. idalib_build::configure_idasdk_linkage();
  112. } else {
  113. idalib_build::configure_linkage()?;
  114. }
  115. Ok(())
  116. }
  117. ```
  118. Note that for `idalib`-based tools being installed via
  119. [crates.io](https://crates.io), e.g.,
  120. [rhabdomancer](https://github.com/0xdea/rhabdomancer), the warning will only be
  121. visible when installing with `cargo -vv`, as explained
  122. in [the cargo documentation](https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargo-warning):
  123. > The warning instruction tells Cargo to display a warning after the build
  124. > script has finished running. Warnings are only shown for path dependencies
  125. > (that is, those you’re working on locally), so for example warnings printed
  126. > out in crates.io crates are not emitted by default. The -vv “very verbose”
  127. > flag may be used to have Cargo display warnings for all crates.
  128. ### Cross-compiling
  129. The build scripts select the IDA SDK configuration and stub libraries based on
  130. the target passed via `cargo build --target ...`, not on the host running the
  131. build. In addition to the Rust target (`rustup target add ...`), cross-compiling
  132. requires:
  133. - A C++ compiler and linker for the target, as picked up by the
  134. [cc](https://docs.rs/cc) crate (e.g., via `CXX_<target>`) and Cargo (via
  135. `CARGO_TARGET_<TRIPLE>_LINKER`).
  136. - The target's C++ standard library headers, so that Clang can parse the SDK
  137. headers. If they are not found automatically, pass a sysroot via
  138. `BINDGEN_EXTRA_CLANG_ARGS_<target>="--sysroot=..."`.
  139. - When using `idalib_build::configure_linkage`, `IDADIR` set to an IDA
  140. installation for the target: it must contain the target's `(lib)idalib` at
  141. build time, and it is used as the RPATH at runtime, so a copy at the same
  142. path as on the target machine works best. Alternatively, use the `build.rs`
  143. above, which falls back to the SDK stub libraries; in that case, IDA's
  144. libraries must be made available to the dynamic linker on the target machine
  145. at runtime (e.g., with `LD_LIBRARY_PATH=$HOME/ida-pro-9.5` or similar).
  146. For example, to build for Linux AArch64 on Linux x86_64 (Ubuntu):
  147. ```sh
  148. sudo apt install g++-aarch64-linux-gnu
  149. rustup target add aarch64-unknown-linux-gnu
  150. export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
  151. cargo build --target aarch64-unknown-linux-gnu
  152. ```
  153. Cross-compiling to Windows from other platforms requires an MSVC-compatible
  154. toolchain (e.g., [cargo-xwin](https://github.com/rust-cross/cargo-xwin)) and
  155. has not been tested.
  156. ## Extending idalib
  157. To expose unimplemented IDA SDK functionality, modify the `idasdk-sys` crate,
  158. add appropriate high-level wrappers in `idalib`, and submit a pull request.
  159. Ensure that the additions are portable and build with the latest SDK. We won't
  160. accept PRs to support older beta releases.
  161. ⚠️ Warning: The IDA SDK submodule should be checked out prior to starting
  162. development, otherwise the build will fail, e.g.:
  163. ```sh
  164. git submodule update --init --recursive
  165. ```
  166. ## Contributing (and AI-assisted development)
  167. For development with or without AI assistance via tools, such as Claude Code,
  168. OpenCode, or Codex, consult the `skills` directory, which contains
  169. [guidelines](https://github.com/idalib-rs/idalib/blob/master/skills/idalib-rust-style/SKILL.md)
  170. to keep contributed code consistent with the project's coding style and best
  171. practices.
  172. ## Contributors
  173. Please see [CONTRIBUTORS.md](https://github.com/idalib-rs/idalib/blob/master/CONTRIBUTORS.md) for a full list of
  174. acknowledgments.
  175. ## Support
  176. If you have any questions, issues, or suggestions related to IDALIB Rust
  177. bindings, join our [Slack
  178. workspace](https://join.slack.com/t/idalib-rs/shared_invite/zt-3qhdxe9af-wM4a0XbTDD85DpW9nPCNUQ)
  179. or open an issue.
  180. ## Acknowledgments
  181. This project's development has been supported by the following organisations:
  182. - [Binarly](https://binarly.io)
  183. - [Hex-Rays](https://hex-rays.com) via their [contributor program](https://hex-rays.com/contributor-program)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.