All Projects → capstone-rust → Capstone Rs

capstone-rust / Capstone Rs

Licence: mit
high-level Capstone system bindings for Rust

Programming Languages

c
50402 projects - #5 most used programming language
rust
11053 projects

Labels

Projects that are alternatives of or similar to Capstone Rs

Nano-Degree-Projects
🎓 Udacity Nano Degree Android Projects. All Needed projects you can check out my work here. Submitted and accepted projects.
Stars: ✭ 68 (-46.03%)
Mutual labels:  capstone
KeyPlexer
Capstone: Keylogger Trojan
Stars: ✭ 32 (-74.6%)
Mutual labels:  capstone
Baresifter
A bare-metal x86 instruction set fuzzer a la Sandsifter
Stars: ✭ 33 (-73.81%)
Mutual labels:  capstone
ror-capstone-lifestyle
RoR Capstone Project required at the end of Rails module in Microverse Curriculum. It is an app to create articles. It allows to edit profile, comment, vote and bookmark an article for future reads.
Stars: ✭ 13 (-89.68%)
Mutual labels:  capstone
Artisto capstone
This is Capstone Project of Android Developer Nanodegree program.
Stars: ✭ 36 (-71.43%)
Mutual labels:  capstone
Makin
makin - reveal anti-debugging and anti-VM tricks [This project is not maintained anymore]
Stars: ✭ 645 (+411.9%)
Mutual labels:  capstone
BlindAid
Capstone Project: Assist the blind in moving around safely by warning them of impending obstacles using depth sensing, computer vision, and tactile glove feedback.
Stars: ✭ 14 (-88.89%)
Mutual labels:  capstone
Allstate capstone
Allstate Kaggle Competition ML Capstone Project
Stars: ✭ 72 (-42.86%)
Mutual labels:  capstone
Springboard-DataScienceTrack-Student
Springboard Program: Data Science Career Track - NLP
Stars: ✭ 92 (-26.98%)
Mutual labels:  capstone
Chiasm Shell
Python-based interactive assembler/disassembler CLI, powered by Keystone/Capstone.
Stars: ✭ 24 (-80.95%)
Mutual labels:  capstone
pointer-sequence-reversal
No description or website provided.
Stars: ✭ 22 (-82.54%)
Mutual labels:  capstone
ftrace
Simple Function calls tracer
Stars: ✭ 65 (-48.41%)
Mutual labels:  capstone
Cemu
Cheap EMUlator: lightweight multi-architecture assembly playground
Stars: ✭ 666 (+428.57%)
Mutual labels:  capstone
PEDetour
modify binary Portable Executable to hook its export functions
Stars: ✭ 59 (-53.17%)
Mutual labels:  capstone
Easyrop
A Python tool to generate ROP chains
Stars: ✭ 54 (-57.14%)
Mutual labels:  capstone
Capstone.NET
.NET Core and .NET Framework binding for the Capstone Disassembly Framework
Stars: ✭ 108 (-14.29%)
Mutual labels:  capstone
Plasma
Plasma is an interactive disassembler for x86/ARM/MIPS. It can generates indented pseudo-code with colored syntax.
Stars: ✭ 2,956 (+2246.03%)
Mutual labels:  capstone
Kcshell
Simple Python3 based interactive assembly/disassembly shell for various architectures powered by Keystone/Capstone.
Stars: ✭ 104 (-17.46%)
Mutual labels:  capstone
Unidbg
Allows you to emulate an Android ARM32 and/or ARM64 native library, and an experimental iOS emulation
Stars: ✭ 1,168 (+826.98%)
Mutual labels:  capstone
Shellen
🌸 Interactive shellcoding environment to easily craft shellcodes
Stars: ✭ 799 (+534.13%)
Mutual labels:  capstone

capstone-rs

Crates.io Badge

Linux/MacOS Travis CI Badge | Windows Appveyor CI Badge | FreeBSD Cirrus CI Badge

codecov

API Documentation

Bindings to the capstone library disassembly framework.

Requirements

capstone-rs uses the capstone-sys crate to provide the low-level bindings to the Capstone C library.

See the capstone-sys page for the requirements and supported platforms.

  • Minimum Rust Version: 1.36.0

Example

extern crate capstone;

use capstone::prelude::*;

const X86_CODE: &'static [u8] =
    b"\x55\x48\x8b\x05\xb8\x13\x00\x00\xe9\x14\x9e\x08\x00\x45\x31\xe4";

/// Print register names
fn reg_names<T, I>(cs: &Capstone, regs: T) -> String
where
    T: Iterator<Item = I>,
    I: Into<RegId>,
{
    let names: Vec<String> = regs.map(|x| cs.reg_name(x.into()).unwrap()).collect();
    names.join(", ")
}

/// Print instruction group names
fn group_names<T, I>(cs: &Capstone, regs: T) -> String
where
    T: Iterator<Item = I>,
    I: Into<InsnGroupId>,
{
    let names: Vec<String> = regs.map(|x| cs.group_name(x.into()).unwrap()).collect();
    names.join(", ")
}

fn example() -> CsResult<()> {
    let cs = Capstone::new()
        .x86()
        .mode(arch::x86::ArchMode::Mode64)
        .syntax(arch::x86::ArchSyntax::Att)
        .detail(true)
        .build()?;

    let insns = cs.disasm_all(X86_CODE, 0x1000)?;
    println!("Found {} instructions", insns.len());
    for i in insns.iter() {
        println!("");
        println!("{}", i);

        let detail: InsnDetail = cs.insn_detail(&i)?;
        let output: &[(&str, String)] =
            &[
                ("read regs:", reg_names(&cs, detail.regs_read())),
                ("write regs:", reg_names(&cs, detail.regs_write())),
                ("insn groups:", group_names(&cs, detail.groups())),
            ];

        for &(ref name, ref message) in output.iter() {
            println!("    {:12} {}", name, message);
        }
    }
    Ok(())
}

fn main() {
    if let Err(err) = example() {
        println!("Error: {}", err);
    }
}

Produces:

Found 4 instructions

0x1000: pushq %rbp
    read regs:   rsp
    write regs:  rsp
    insn groups: mode64

0x1001: movq 0x13b8(%rip), %rax
    read regs:
    write regs:
    insn groups:

0x1008: jmp 0x8ae21
    read regs:
    write regs:
    insn groups: jump

0x100d: xorl %r12d, %r12d
    read regs:
    write regs:  rflags
    insn groups:

To see more demos, see the examples/ directory. More complex demos welcome!

Features

  • use_bindgen: run bindgen to generate Rust bindings to Capstone C library instead of using pre-generated bindings (not recommended).

Reporting Issues

Please open a Github issue

Author

You may find a full list of contributors on Github.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].