From d4ae8fde5deb9aeecb0d8c036c593589161106d0 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Wed, 1 Dec 2021 15:45:22 +0100 Subject: New unicornafl rust bindings (#1188) * uc bindings * fixed new uc rust bindings * updated to latest uc1 * updated rust bindings --- unicorn_mode/UNICORNAFL_VERSION | 2 +- unicorn_mode/samples/speedtest/rust/Cargo.toml | 4 ++-- unicorn_mode/samples/speedtest/rust/src/main.rs | 6 ++++-- unicorn_mode/unicornafl | 2 +- unicorn_mode/update_uc_ref.sh | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/unicorn_mode/UNICORNAFL_VERSION b/unicorn_mode/UNICORNAFL_VERSION index d6acbf91..dbe3999f 100644 --- a/unicorn_mode/UNICORNAFL_VERSION +++ b/unicorn_mode/UNICORNAFL_VERSION @@ -1 +1 @@ -94617f5b +9df92d6868e8b219886e4b7458e5e134c48ff2c9 diff --git a/unicorn_mode/samples/speedtest/rust/Cargo.toml b/unicorn_mode/samples/speedtest/rust/Cargo.toml index c19ee0a1..9b81be0b 100644 --- a/unicorn_mode/samples/speedtest/rust/Cargo.toml +++ b/unicorn_mode/samples/speedtest/rust/Cargo.toml @@ -11,5 +11,5 @@ panic = "abort" [dependencies] unicornafl = { path = "../../../unicornafl/bindings/rust/", version="1.0.0" } -capstone="0.6.0" -libc="0.2.66" \ No newline at end of file +capstone="0.10.0" +libc="0.2.66" diff --git a/unicorn_mode/samples/speedtest/rust/src/main.rs b/unicorn_mode/samples/speedtest/rust/src/main.rs index 89e10833..cded1a3c 100644 --- a/unicorn_mode/samples/speedtest/rust/src/main.rs +++ b/unicorn_mode/samples/speedtest/rust/src/main.rs @@ -11,6 +11,7 @@ use std::{ }; use unicornafl::{ + afl::afl_fuzz, unicorn_const::{uc_error, Arch, Mode, Permission}, RegisterX86::*, Unicorn, @@ -87,7 +88,7 @@ fn main() { } fn fuzz(input_file: &str) -> Result<(), uc_error> { - let mut uc = Unicorn::new(Arch::X86, Mode::MODE_64, 0)?; + let mut uc = Unicorn::new(Arch::X86, Mode::MODE_64)?; let binary = read_file(BINARY).unwrap_or_else(|_| panic!("Could not read modem image: {}", BINARY)); @@ -212,7 +213,8 @@ fn fuzz(input_file: &str) -> Result<(), uc_error> { let end_addrs = parse_locs("main_ends").unwrap(); - let ret = uc.afl_fuzz( + let ret = afl_fuzz( + &mut uc, input_file, place_input_callback, &end_addrs, diff --git a/unicorn_mode/unicornafl b/unicorn_mode/unicornafl index d4915053..9df92d68 160000 --- a/unicorn_mode/unicornafl +++ b/unicorn_mode/unicornafl @@ -1 +1 @@ -Subproject commit d4915053d477dd827b3fe4b494173d3fbf9f456e +Subproject commit 9df92d6868e8b219886e4b7458e5e134c48ff2c9 diff --git a/unicorn_mode/update_uc_ref.sh b/unicorn_mode/update_uc_ref.sh index 7c1c7778..6e809a7b 100755 --- a/unicorn_mode/update_uc_ref.sh +++ b/unicorn_mode/update_uc_ref.sh @@ -21,10 +21,10 @@ fi git submodule init && git submodule update unicornafl || exit 1 cd ./unicornafl || exit 1 -git fetch origin dev 1>/dev/null || exit 1 +git fetch origin uc1 1>/dev/null || exit 1 git stash 1>/dev/null 2>/dev/null git stash drop 1>/dev/null 2>/dev/null -git checkout dev +git checkout uc1 if [ -z "$NEW_VERSION" ]; then # No version provided, take HEAD. -- cgit 1.4.1