vtil-parser

Read/write VTIL files in Rust

10 releases (6 breaking)

0.7.0 May 21, 2021
0.6.1 May 10, 2021
0.5.0 May 7, 2021
0.4.0 May 5, 2021
0.1.1 Oct 11, 2020

31 downloads per month

BSD-3-Clause

120KB
2.5K SLoC

VTIL-RustParser Travis docs.rs

An in-place parser for VTIL files written in Rust.

References


lib.rs:

VTIL-RustParser

Read/write VTIL files in Rust.

You can learn more about VTIL here on the main GitHub page.

Examples

For a simple example of loading a VTIL routine and reading out some basic data:

use vtil_parser::{Routine, ArchitectureIdentifier};

let routine = Routine::from_path("resources/big.vtil")?;
assert_eq!(routine.header.arch_id, ArchitectureIdentifier::Amd64);

For a more complex example, iterating over IL instructions:

use vtil_parser::{Routine, Op, Operand, RegisterDesc, ImmediateDesc, RegisterFlags};

let routine = Routine::from_path("resources/big.vtil")?;

for (_, basic_block) in routine.explored_blocks.iter().take(1) {
    for instr in basic_block.instructions.iter().take(1) {
        match &instr.op {
            Op::Ldd(_, Operand::RegisterDesc(op2), Operand::ImmediateDesc(op3)) => {
                assert!(op2.flags.contains(RegisterFlags::PHYSICAL));
                assert!(op3.i64() == 0);
            }
            _ => assert!(false)
        }

        assert_eq!(instr.vip.0, 0x9b833);
    }
}

Dependencies

~1.4–2.2MB
~40K SLoC