Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: add support for unicorn engine #1

Closed
wants to merge 27 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
db13fa3
feat: init
henri2h Dec 14, 2022
dde3d3e
feat: update dep
henri2h Dec 15, 2022
6381be7
feat: make it run
henri2h Dec 15, 2022
d49fa88
feat: print read access
henri2h Dec 15, 2022
706a8ad
feat: properly register memory
henri2h Dec 15, 2022
7307b5b
feat: display block hook and write correctly memory data
henri2h Dec 21, 2022
579295d
fix: properly hook and display memory reads
henri2h Dec 21, 2022
2a57bf1
feat: added location tracker
henri2h Jan 3, 2023
ad3e69e
feat: added edge coverage
henri2h Jan 8, 2023
6a1a60c
feat: startingq hooking the fuzzer
henri2h Jan 8, 2023
79e6ddf
feat: discard state
henri2h Jan 9, 2023
022584a
Fix compilation
andreafioraldi Jan 10, 2023
e98f753
feat: rewritten the emulator to be less verbose and remove code dupli…
henri2h Jan 10, 2023
e09dda7
feat: reduce code duplication (again)
henri2h Jan 19, 2023
9f68628
feat: allow to run emulator only
henri2h Jan 19, 2023
5da5b93
feat: crash on wrong value
henri2h Jan 19, 2023
d3458ef
feat: replace debug and reset EDGES_MAP to 0 at start
henri2h Jan 19, 2023
c826fbf
fix: change generator type
henri2h Jan 19, 2023
71e579c
fix: set MAX_EDGES_NUM and reduce verbosity
henri2h Jan 19, 2023
97539ee
fix: properly initialize input
henri2h Jan 19, 2023
00cbe7f
Fix OOM
andreafioraldi Jan 19, 2023
20d70e3
feat: code re write
henri2h Feb 3, 2023
43f21bf
feat: add multiple architectures
henri2h Feb 3, 2023
e1a0e2c
feat: provide disassembly and fuzz x86 code
henri2h Feb 5, 2023
4a6e7f2
fix: add possibility to fuzz different CPU platform
henri2h Feb 5, 2023
6384d95
feat: change signal
henri2h Feb 6, 2023
cf92098
feat: clean library
henri2h Feb 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: print read access
henri2h committed Feb 9, 2023
commit d49fa88c728d66d001c6cb230472998523cd1a47
25 changes: 19 additions & 6 deletions libafl_unicorn/src/main.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ use std::fs::File;
use std::io::Read;

use unicorn_engine::unicorn_const::{Arch, HookType, MemType, Mode, Permission, SECOND_SCALE};
use unicorn_engine::{RegisterARM, RegisterARM64};
use unicorn_engine::{RegisterARM64};

fn callback(
_unicorn: &mut unicorn_engine::Unicorn<()>,
@@ -11,11 +11,7 @@ fn callback(
size: usize,
other_number: i64,
) -> bool {
println!(
"Bad registration done number: {}, size: {}, other_number: {}",
number, size, other_number
);
println!("MemType: {:?}", mem);
println!("Memory access type: {:?} number: {} size: {} other_number: {}", mem, number, size, other_number);
return true;
}

@@ -68,6 +64,23 @@ fn emulate() {
)
.expect("Failed to register watcher");


emu.add_mem_hook(
HookType::MEM_READ,
r_sp,
r_sp + (data_size) as u64,
callback,
)
.expect("Failed to register watcher");

emu.add_mem_hook(
HookType::MEM_FETCH,
r_sp,
r_sp + (data_size) as u64,
callback,
)
.expect("Failed to register watcher");

println!("SP: {:X}", emu.reg_read(RegisterARM64::SP).unwrap());

let result = emu.emu_start(