event trait
This commit is contained in:
parent
a98b94e818
commit
6b6e2a8907
@ -58,11 +58,9 @@ pub extern "C" fn afl_libfuzzer_main() {
|
|||||||
engine.add_stage(Box::new(stage));
|
engine.add_stage(Box::new(stage));
|
||||||
|
|
||||||
for i in 0..1000 {
|
for i in 0..1000 {
|
||||||
println!("Fuzzer corpus iteration #{}", i);
|
engine
|
||||||
let idx = engine
|
|
||||||
.fuzz_one(&mut state)
|
.fuzz_one(&mut state)
|
||||||
.expect(&format!("Error in iter {}", i));
|
.expect(&format!("Error in iter {}", i));
|
||||||
println!("Fuzzed entry #{}", idx);
|
|
||||||
}
|
}
|
||||||
println!("OK");
|
println!("OK");
|
||||||
}
|
}
|
||||||
|
@ -199,6 +199,7 @@ where
|
|||||||
|
|
||||||
fn fuzz_one(&mut self, state: &mut S) -> Result<usize, AflError> {
|
fn fuzz_one(&mut self, state: &mut S) -> Result<usize, AflError> {
|
||||||
let (testcase, idx) = state.corpus_mut().next()?;
|
let (testcase, idx) = state.corpus_mut().next()?;
|
||||||
|
println!("Cur entry: {}\tExecutions: {}", idx, state.executions());
|
||||||
for stage in self.stages_mut() {
|
for stage in self.stages_mut() {
|
||||||
stage.perform(testcase.clone(), state)?;
|
stage.perform(testcase.clone(), state)?;
|
||||||
}
|
}
|
||||||
|
24
src/events/mod.rs
Normal file
24
src/events/mod.rs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
use core::any::TypeId;
|
||||||
|
use core::fmt::Debug;
|
||||||
|
|
||||||
|
use crate::AflError;
|
||||||
|
|
||||||
|
pub trait Event: Debug {}
|
||||||
|
|
||||||
|
pub trait EventManager {
|
||||||
|
/// Check if this EventaManager support a given Event type
|
||||||
|
fn enabled<E: Event>(&self) -> bool;
|
||||||
|
/* fn enabled<E: Event>() -> bool {
|
||||||
|
match TypeId::of::<E>() {
|
||||||
|
TypeId::of::<MyEvent>() => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
} */
|
||||||
|
|
||||||
|
/// Fire an Event
|
||||||
|
fn fire<E: Event>(&mut self) -> Result<(), AflError>;
|
||||||
|
|
||||||
|
/// Lookup for incoming events and process them.
|
||||||
|
/// Return the number of processes events or an error
|
||||||
|
fn lookup(&mut self) -> Result<usize, AflError>;
|
||||||
|
}
|
@ -7,11 +7,10 @@ pub mod corpus;
|
|||||||
pub mod engines;
|
pub mod engines;
|
||||||
pub mod executors;
|
pub mod executors;
|
||||||
pub mod feedbacks;
|
pub mod feedbacks;
|
||||||
|
pub mod generators;
|
||||||
pub mod inputs;
|
pub mod inputs;
|
||||||
pub mod monitors;
|
|
||||||
pub mod mutators;
|
pub mod mutators;
|
||||||
pub mod observers;
|
pub mod observers;
|
||||||
pub mod generators;
|
|
||||||
pub mod stages;
|
pub mod stages;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user