Skip to content

Ghidrust provides a hyper fast, AI native reverse engineering platform built in Rust, inspired by Ghidra. Includes experimental GPU kernels to rapidly decompile large files, a decryption suite, and network monitor for packet to binary reverse engineering.

Add GitHub Actions CI and v0.1.0 release workflow.

oofzaa037c3cf80a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..8ed398a
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,49 @@
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+concurrency:
+ group: ci-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+env:
+ CARGO_TERM_COLOR: always
+
+jobs:
+ linux:
+ name: Test (Linux)
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: dtolnay/rust-toolchain@stable
+
+ - uses: Swatinem/rust-cache@v2
+
+ - name: Test workspace libraries
+ run: cargo test --workspace --exclude ghidrust-gui --lib
+
+ - name: Build CLI release
+ run: cargo build --release -p ghidrust-cli
+
+ windows:
+ name: Test + build (Windows)
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: dtolnay/rust-toolchain@stable
+
+ - uses: Swatinem/rust-cache@v2
+
+ - name: Test workspace libraries
+ run: cargo test --workspace --lib
+
+ - name: Integration smoke (crypto fixtures)
+ run: cargo test -p ghidrust-cli --test eval_crypto_fixtures
+
+ - name: Build release binaries
+ run: cargo build --release -p ghidrust-cli -p ghidrust-gui
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..7b0444b
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,95 @@
+name: Release
+
+on:
+ push:
+ tags: ["v*"]
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: "Release tag (e.g. v0.1.0)"
+ required: true
+ default: v0.1.0
+
+permissions:
+ contents: write
+
+concurrency:
+ group: release-${{ github.ref }}
+ cancel-in-progress: false
+
+env:
+ CARGO_TERM_COLOR: always
+
+jobs:
+ build-windows:
+ name: Build Windows x64
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: dtolnay/rust-toolchain@stable
+
+ - uses: Swatinem/rust-cache@v2
+
+ - name: Resolve release version
+ id: meta
+ shell: bash
+ run: |
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
+ echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
+ else
+ echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Test workspace libraries
+ run: cargo test --workspace --lib
+
+ - name: Integration smoke (crypto fixtures)
+ run: cargo test -p ghidrust-cli --test eval_crypto_fixtures
+
+ - name: Build release binaries
+ run: cargo build --release -p ghidrust-cli -p ghidrust-gui
+
+ - name: Package Windows zip
+ shell: pwsh
+ run: |
+ $tag = "${{ steps.meta.outputs.tag }}"
+ $ver = $tag -replace '^v',''
+ New-Item -ItemType Directory -Force release | Out-Null
+ Copy-Item target/release/ghidrust.exe release/
+ Copy-Item target/release/ghidrust-gui.exe release/
+ Compress-Archive -Path release/* -DestinationPath "ghidrust-$ver-windows-x64.zip" -Force
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: ghidrust-windows-x64
+ path: ghidrust-*-windows-x64.zip
+ if-no-files-found: error
+
+ publish:
+ name: Publish GitHub Release
+ needs: [build-windows]
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/download-artifact@v4
+ with:
+ path: artifacts
+
+ - name: Resolve release tag
+ id: meta
+ shell: bash
+ run: |
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
+ echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
+ else
+ echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
+ fi
+
+ - uses: softprops/action-gh-release@v2
+ with:
+ tag_name: ${{ steps.meta.outputs.tag }}
+ name: Ghidrust ${{ steps.meta.outputs.tag }}
+ files: artifacts/**/*
+ generate_release_notes: true
+ draft: false
+ prerelease: false
diff --git a/Cargo.toml b/Cargo.toml
index b520db1..a60b4d5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ default-members = ["crates/ghidrust-cli"]
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
-repository = "https://github.com/example/ghidrust"
+repository = "https://github.com/oofz/Ghidrust"
[workspace.dependencies]
ghidrust-ir = { path = "crates/ghidrust-ir" }
diff --git a/crates/ghidrust-core/src/process/mod.rs b/crates/ghidrust-core/src/process/mod.rs
index 38953e3..ffbcd39 100644
--- a/crates/ghidrust-core/src/process/mod.rs
+++ b/crates/ghidrust-core/src/process/mod.rs
@@ -903,6 +903,7 @@ pub fn process_export_snapshot(
#[cfg(test)]
mod tests {
use super::*;
+ use std::path::PathBuf;
#[test]
fn launch_command_line_quotes_paths_with_spaces() {
diff --git a/crates/ghidrust-decomp/src/bench.rs b/crates/ghidrust-decomp/src/bench.rs
index 4d1e8c5..cfd7ba9 100644
--- a/crates/ghidrust-decomp/src/bench.rs
+++ b/crates/ghidrust-decomp/src/bench.rs
@@ -374,13 +374,7 @@ mod tests {
use ghidrust_core::{fixture_path, load_path, Instruction};
fn insn(addr: u64, mnem: &str, ops: &str, len: u8) -> Instruction {
- Instruction {
- address: addr,
- bytes: vec![0; len as usize],
- mnemonic: mnem.into(),
- operands: ops.into(),
- length: len,
- }
+ Instruction::with_text(addr, vec![0; len as usize], mnem, ops, len)
}
#[test]
diff --git a/crates/ghidrust-decomp/src/ir_emit.rs b/crates/ghidrust-decomp/src/ir_emit.rs
index ceb6c8b..00d55e4 100644
--- a/crates/ghidrust-decomp/src/ir_emit.rs
+++ b/crates/ghidrust-decomp/src/ir_emit.rs
@@ -454,13 +454,7 @@ mod tests {
// `hlt` is a lifted `Trap` op — Stage-0.5 emits an honest trap
// comment rather than fabricating a C statement. A truly unlifted
// opcode falls back to Stage-0 scaffolding (`/* mnemonic operands */;`).
- let insn = Instruction {
- address: 0x3000,
- bytes: vec![0xf4],
- mnemonic: "hlt".into(),
- operands: String::new(),
- length: 1,
- };
+ let insn = Instruction::with_text(0x3000, vec![0xf4], "hlt", "", 1);
let d = decompile_instructions("halted", 0x3000, &[insn.clone()]);
let seq = lift_instructions(&[insn]);
let text = emit_ir_pseudo_c(&d.name, d.entry, &d.blocks, &seq);
@@ -471,13 +465,7 @@ mod tests {
// A truly unhandled mnemonic (never lifted, never decoded) still
// survives via the Stage-0 fallback branch of emit_ir_pseudo_c.
- let unknown = Instruction {
- address: 0x3010,
- bytes: vec![0xff, 0xff],
- mnemonic: "wibble".into(),
- operands: "42".into(),
- length: 2,
- };
+ let unknown = Instruction::with_text(0x3010, vec![0xff, 0xff], "wibble", "42", 2);
let d2 = decompile_instructions("wibbler", 0x3010, &[unknown.clone()]);
let seq2 = lift_instructions(&[unknown]);
let text2 = emit_ir_pseudo_c(&d2.name, d2.entry, &d2.blocks, &seq2);
diff --git a/crates/ghidrust-decomp/src/lib.rs b/crates/ghidrust-decomp/src/lib.rs
index a003c8d..fe5b052 100644
--- a/crates/ghidrust-decomp/src/lib.rs
+++ b/crates/ghidrust-decomp/src/lib.rs
@@ -613,13 +613,7 @@ mod tests {
use ghidrust_core::{fixture_path, load_path};
fn insn(addr: u64, mnem: &str, ops: &str, len: u8) -> Instruction {
- Instruction {
- address: addr,
- bytes: vec![0; len as usize],
- mnemonic: mnem.into(),
- operands: ops.into(),
- length: len,
- }
+ Instruction::with_text(addr, vec![0; len as usize], mnem, ops, len)
}
#[test]
diff --git a/crates/ghidrust-decomp/src/stage1.rs b/crates/ghidrust-decomp/src/stage1.rs
index b938e46..6315748 100644
--- a/crates/ghidrust-decomp/src/stage1.rs
+++ b/crates/ghidrust-decomp/src/stage1.rs
@@ -1041,13 +1041,7 @@ mod tests {
// hand-building the instruction sequence, then wrap in a Stage-0
// decomp. We call emit_stage1 through the front door.
use ghidrust_decode::Instruction;
- let mnem = |m: &str, o: &str, l: u8| Instruction {
- address: 0,
- bytes: vec![0; l as usize],
- mnemonic: m.into(),
- operands: o.into(),
- length: l,
- };
+ let mnem = |m: &str, o: &str, l: u8| Instruction::with_text(0, vec![0; l as usize], m, o, l);
// jmp 0x2; test eax,eax; je 0x8; jmp 0x2; ret
let mut insns = vec![
mnem("jmp", "0x2", 2),
@@ -1100,12 +1094,8 @@ mod tests {
// cases land at four different `ret` blocks. The lifter only turns
// this into a BranchInd + Returns; the hint tells the structurer
// which case targets correspond to which selector.
- let mnem = |addr, m: &str, o: &str, l: u8| Instruction {
- address: addr,
- bytes: vec![0; l as usize],
- mnemonic: m.into(),
- operands: o.into(),
- length: l,
+ let mnem = |addr, m: &str, o: &str, l: u8| {
+ Instruction::with_text(addr, vec![0; l as usize], m, o, l)
};
// 0x0: jmp rax
// 0x2: ret (case 0)
@@ -1257,13 +1247,7 @@ mod tests {
use ghidrust_decode::Instruction;
// `hlt` now lifts to a `Trap` op — Stage-1 preserves that as a
// trap comment so the output stays honest without fabricating C.
- let insn = Instruction {
- address: 0x4000,
- bytes: vec![0xf4],
- mnemonic: "hlt".into(),
- operands: String::new(),
- length: 1,
- };
+ let insn = Instruction::with_text(0x4000, vec![0xf4], "hlt", "", 1);
let d = decompile_instructions("halted", 0x4000, &[insn.clone()]);
let rep = emit_stage1(&d.name, d.entry, &d.blocks, &[insn], CallConv::SystemV);
assert!(
@@ -1275,13 +1259,7 @@ mod tests {
// A genuinely-unlifted mnemonic still surfaces via
// `OpCode::Unimplemented` so we never invent C.
- let unknown = Instruction {
- address: 0x4010,
- bytes: vec![0xff, 0xff],
- mnemonic: "wibble".into(),
- operands: String::new(),
- length: 2,
- };
+ let unknown = Instruction::with_text(0x4010, vec![0xff, 0xff], "wibble", "", 2);
let d2 = decompile_instructions("wibbler", 0x4010, &[unknown.clone()]);
let rep2 = emit_stage1(
&d2.name,
@@ -1303,20 +1281,14 @@ mod tests {
use ghidrust_decode::Instruction;
use std::collections::BTreeMap;
// call 0x401000 — named via EmitHints
- let call = Instruction {
- address: 0x1000,
- bytes: vec![0xe8, 0x00, 0x00, 0x00, 0x00],
- mnemonic: "call".into(),
- operands: "0x401000".into(),
- length: 5,
- };
- let ret = Instruction {
- address: 0x1005,
- bytes: vec![0xc3],
- mnemonic: "ret".into(),
- operands: String::new(),
- length: 1,
- };
+ let call = Instruction::with_text(
+ 0x1000,
+ vec![0xe8, 0x00, 0x00, 0x00, 0x00],
+ "call",
+ "0x401000",
+ 5,
+ );
+ let ret = Instruction::with_text(0x1005, vec![0xc3], "ret", "", 1);
let d = decompile_instructions("caller", 0x1000, &[call.clone(), ret.clone()]);
let mut hints = EmitHints::default();
hints.call_names = BTreeMap::from([(0x401000u64, "CreateFileW".into())]);
diff --git a/crates/ghidrust-lift/src/lib.rs b/crates/ghidrust-lift/src/lib.rs
index b952bcc..c7b5f9d 100644
--- a/crates/ghidrust-lift/src/lib.rs
+++ b/crates/ghidrust-lift/src/lib.rs
@@ -1765,13 +1765,7 @@ mod tests {
// decode may not support c1 in current tables — if empty, skip: the test then
// verifies lift_shift directly via a synthetic instruction.
let insn = if insns.is_empty() {
- Instruction {
- address: 0x7000,
- bytes: vec![0xc1, 0xe0, 0x03],
- mnemonic: "shl".into(),
- operands: "eax, 0x3".into(),
- length: 3,
- }
+ Instruction::with_text(0x7000, vec![0xc1, 0xe0, 0x03], "shl", "eax, 0x3", 3)
} else {
insns[0].clone()
};
@@ -1781,13 +1775,7 @@ mod tests {
#[test]
fn lift_jcc_and_pop() {
- let je = Instruction {
- address: 0x2000,
- bytes: vec![0x74, 0x00],
- mnemonic: "je".into(),
- operands: "0x2010".into(),
- length: 2,
- };
+ let je = Instruction::with_text(0x2000, vec![0x74, 0x00], "je", "0x2010", 2);
let pop = decode_one(&[0x58], 0x2002).unwrap();
let mut seq = IrSequence::new();
let mut ctx = LiftCtx::default();
@@ -1804,13 +1792,7 @@ mod tests {
#[test]
fn unhandled_becomes_unimplemented_and_coverage_reflects() {
- let insn = Instruction {
- address: 0,
- bytes: vec![0xff],
- mnemonic: "wibble".into(),
- operands: String::new(),
- length: 1,
- };
+ let insn = Instruction::with_text(0, vec![0xff], "wibble", "", 1);
let ops = lift_instruction(&insn);
assert_eq!(ops.len(), 1);
assert_eq!(ops[0].opcode, OpCode::Unimplemented);