The world's first agentic reverse engineer.
impl rust v1
Amruthe4f2090e3173
diff --git a/.gitignore b/.gitignoreindex ccc1adc..3c33bb8 100644--- a/.gitignore+++ b/.gitignore@@ -227,4 +227,8 @@ docs/corpus/-tools/xda/data/\ No newline at end of file+tools/xda/data/++# Added by cargo++/targetdiff --git a/Cargo.lock b/Cargo.locknew file mode 100644index 0000000..f77e72f--- /dev/null+++ b/Cargo.lock@@ -0,0 +1,114 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "itoa"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"++[[package]]+name = "kong-ml"+version = "1.0.0"+dependencies = [+ "serde",+]++[[package]]+name = "kong-types"+version = "1.0.0"+dependencies = [+ "serde",+ "serde_json",+]++[[package]]+name = "memchr"+version = "2.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"++[[package]]+name = "proc-macro2"+version = "1.0.106"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "quote"+version = "1.0.45"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "serde"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_core"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "serde_json"+version = "1.0.149"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"+dependencies = [+ "itoa",+ "memchr",+ "serde",+ "serde_core",+ "zmij",+]++[[package]]+name = "syn"+version = "2.0.117"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "unicode-ident"+version = "1.0.24"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"++[[package]]+name = "zmij"+version = "1.0.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"diff --git a/Cargo.toml b/Cargo.tomlnew file mode 100644index 0000000..b4af69b--- /dev/null+++ b/Cargo.toml@@ -0,0 +1,15 @@+[workspace]+members = [+ "crates/kong-types",+ "crates/kong-ml",+]+resolver = "2"++[workspace.package]+version = "1.0.0"+edition = "2021"+license = "MIT"++[workspace.dependencies]+serde = { version = "1", features = ["derive"] }+serde_json = "1"\ No newline at end of filediff --git a/crates/kong-ml/Cargo.toml b/crates/kong-ml/Cargo.tomlnew file mode 100644index 0000000..05b24bc--- /dev/null+++ b/crates/kong-ml/Cargo.toml@@ -0,0 +1,8 @@+[package]+name = "kong-ml"+version.workspace = true+edition.workspace = true+license.workspace = true++[dependencies]+serde.workspace = true\ No newline at end of filediff --git a/crates/kong-ml/src/main.rs b/crates/kong-ml/src/main.rsnew file mode 100644index 0000000..e7a11a9--- /dev/null+++ b/crates/kong-ml/src/main.rs@@ -0,0 +1,3 @@+fn main() {+ println!("Hello, world!");+}diff --git a/crates/kong-types/Cargo.toml b/crates/kong-types/Cargo.tomlnew file mode 100644index 0000000..6e8f72b--- /dev/null+++ b/crates/kong-types/Cargo.toml@@ -0,0 +1,9 @@+[package]+name = "kong-types"+version.workspace = true+edition.workspace = true+license.workspace = true++[dependencies]+serde.workspace = true+serde_json.workspace = truediff --git a/crates/kong-types/src/binary.rs b/crates/kong-types/src/binary.rsnew file mode 100644index 0000000..81a7011--- /dev/null+++ b/crates/kong-types/src/binary.rs@@ -0,0 +1,27 @@+use serde::{Deserialize, Serialize};+use serde_json::to_string;++#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]+#[serde(rename_all = "snake_case")]+pub enum Arch {+ X86_64,+ X86,+ Aarch64,+ Arm,+ Mips,+ Mips64,+ Riscv64,+ PowerPc,+}++impl Arch {+ pub fn model_name(&self) -> String {+ to_string(self).unwrap()+ }+}++impl std::fmt::Display for Arch {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ f.write_str(&self.model_name())+ }+}\ No newline at end of filediff --git a/crates/kong-types/src/function.rs b/crates/kong-types/src/function.rsnew file mode 100644index 0000000..aed1a4f--- /dev/null+++ b/crates/kong-types/src/function.rs@@ -0,0 +1,33 @@+use serde::{Deserialize, Serialize};++#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct FunctionBoundary {+ pub start: u64,+ pub end: u64,+ pub confidence: f32,+ pub source: DetectionSource,+}++#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "snake_case")]+pub enum DetectionSource {+ Symbol, // from symbol table+ Heuristic, // from prologue/call-target analysis+ Ml, // from XDA model+ ExceptionInfo, // from .eh_frame / .pdata+}++#[derive(Debug, Clone)]+pub struct AmbiguousRegion {+ pub start: u64,+ pub bytes: Vec<u8>,+ pub reason: AmbiguityReason,+}++#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum AmbiguityReason {+ NoPrologue, // reachable but no recognizable prologue+ IndirectTarget, // suspected indirect call/jump target+ GapRegion, // unreached .text gap between known functions+ OptimizedCode, // code region with non-standard patterns+}\ No newline at end of filediff --git a/crates/kong-types/src/lib.rs b/crates/kong-types/src/lib.rsnew file mode 100644index 0000000..2b1bb62--- /dev/null+++ b/crates/kong-types/src/lib.rs@@ -0,0 +1,2 @@+pub mod binary;+pub mod function;\ No newline at end of filediff --git a/crates/kong-types/src/main.rs b/crates/kong-types/src/main.rsnew file mode 100644index 0000000..e7a11a9--- /dev/null+++ b/crates/kong-types/src/main.rs@@ -0,0 +1,3 @@+fn main() {+ println!("Hello, world!");+}