#bindings #assembly #latest-version

sys keystone-engine

Rust 对 Keystone Engine 汇编库的绑定

1 个不稳定版本

0.1.0 2022年11月14日

#30#汇编器

Download history • Rust 包仓库 16/week @ 2024-03-13 • Rust 包仓库 5/week @ 2024-03-20 • Rust 包仓库 17/week @ 2024-03-27 • Rust 包仓库 97/week @ 2024-04-03 • Rust 包仓库 106/week @ 2024-04-10 • Rust 包仓库 2/week @ 2024-04-17 • Rust 包仓库 31/week @ 2024-04-24 • Rust 包仓库 23/week @ 2024-05-01 • Rust 包仓库 7/week @ 2024-05-08 • Rust 包仓库 19/week @ 2024-05-15 • Rust 包仓库 78/week @ 2024-05-22 • Rust 包仓库 18/week @ 2024-05-29 • Rust 包仓库 31/week @ 2024-06-05 • Rust 包仓库 75/week @ 2024-06-12 • Rust 包仓库 68/week @ 2024-06-19 • Rust 包仓库 199/week @ 2024-06-26 • Rust 包仓库

375 每月下载量
2 crates 中使用

GPL-2.0 许可证

22MB
308K SLoC

Bitbake 226K SLoC // 0.0% comments • Rust 包仓库 C++ 64K SLoC // 0.1% comments • Rust 包仓库 OCaml 7K SLoC // 0.1% comments • Rust 包仓库 C 3.5K SLoC // 0.1% comments • Rust 包仓库 Python 3K SLoC // 0.3% comments • Rust 包仓库 Java 718 SLoC // 0.6% comments • Rust 包仓库 C# 575 SLoC // 0.2% comments • Rust 包仓库 VB6 540 SLoC // 0.3% comments • Rust 包仓库 Rust 454 SLoC // 0.1% comments • Rust 包仓库 Go 323 SLoC // 0.1% comments • Rust 包仓库 Shell 280 SLoC // 0.2% comments • Rust 包仓库 Assembly 271 SLoC // 0.1% comments • Rust 包仓库 PowerShell 237 SLoC // 0.3% comments • Rust 包仓库 JavaScript 222 SLoC // 0.1% comments • Rust 包仓库 Visual Studio Project 182 SLoC • Rust 包仓库 Ruby 180 SLoC // 0.1% comments • Rust 包仓库 Haskell 139 SLoC // 0.3% comments • Rust 包仓库 Visual Studio Solution 70 SLoC • Rust 包仓库 Batch 58 SLoC // 0.2% comments • Rust 包仓库 Cabal 34 SLoC // 0.1% comments • Rust 包仓库 Forge Config 4 SLoC • Rust 包仓库

包含 (静态库, 4KB) keystone/bindings/vb6/keystone.lib

KEYSTONE-ENGINE BINDINGS
Keystone Engine 的非官方 Rust 绑定


shields.io license shields.io version shields.io supported keystone version
shields.io crates.io shields.io crates.io


这些 Rust 绑定是官方仓库中可用的绑定的一种替代品,并支持 Keystone Engine 的 0.9.2 版本。

为什么在官方绑定存在的情况下还要发布新的绑定?

要在 crates.io 上发布一个 crate,它所有的依赖都必须也来自 crates.io。已经有一个提供 Keystone 绑定的 crate。然而,它支持的最新版本是 Keystone 的 0.9.0 版本。这个版本有错误,幸运的是,这些错误在 0.9.2 版本中已经修复了。因此,由于 Keystone 的当前 crate 多年未更新,可以使用这些绑定。

这些绑定深受官方绑定的启发,与原始版本相比,API 的更改并不太多。

示例

以下示例取自 官方仓库,应该可以直接运行。

将以下依赖项添加到 Cargo.toml

keystone_engine = { version = "0.1.0", features = ["build-from-src"] }

注意:您可以使用 build-from-src 来构建 Keystone Engine,或者如果您已经在系统上安装了 Keystone 库,则可以使用 use-system-lib

现在您应该能够运行以下代码

use keystone_engine::*;

fn main() {
    let engine =
        Keystone::new(Arch::X86, Mode::MODE_32).expect("Could not initialize Keystone engine");

    engine
        .option(OptionType::SYNTAX, OptionValue::SYNTAX_NASM)
        .expect("Could not set option to nasm syntax");

    let result = engine
        .asm("mov ah, 0x80".to_string(), 0)
        .expect("Could not assemble");

    println!("ASM result: {}", result);

    if let Err(err) = engine.asm("INVALID".to_string(), 0) {
        println!("Error: {}", err);
    }
}

致谢

依赖项