This commit is contained in:
van Hauser 2020-12-20 16:38:44 +01:00
parent b26da86525
commit e2342a2bbb
2 changed files with 6 additions and 23 deletions

View File

@ -83,7 +83,7 @@ where
let attr = attributes?; let attr = attributes?;
if attr.is_file() && attr.len() > 0 { if attr.is_file() && attr.len() > 0 {
println!("Load file {:?}", &path); println!("Loading file {:?} ...", &path);
let bytes = std::fs::read(&path)?; let bytes = std::fs::read(&path)?;
let input = BytesInput::new(bytes); let input = BytesInput::new(bytes);
let fitness = self.evaluate_input(&input, engine.executor_mut())?; let fitness = self.evaluate_input(&input, engine.executor_mut())?;
@ -118,7 +118,7 @@ where
} }
manager.log( manager.log(
0, 0,
format!("Loaded {} initial testcases", in_dirs.len()), // get corpus count format!("Loaded {} initial testcases.", corpus.count()), // get corpus count
)?; )?;
manager.process(self, corpus)?; manager.process(self, corpus)?;
Ok(()) Ok(())

View File

@ -104,25 +104,14 @@ pub extern "C" fn afl_libfuzzer_main() {
println!("Information: the first process started is the broker and only processes the \'-p PORT\' option if present."); println!("Information: the first process started is the broker and only processes the \'-p PORT\' option if present.");
} }
// debug prints println!("Workdir: {:?}", workdir);
println!("workdir: {:?}", workdir);
match dictionary {
Some(x) => for file in x {
println!("dic: {:?}", file);
},
None => (),
}
// original code
let mut rand = StdRand::new(0); let mut rand = StdRand::new(0);
let mut corpus = InMemoryCorpus::new(); let mut corpus = InMemoryCorpus::new();
let mut generator = RandPrintablesGenerator::new(32); let mut generator = RandPrintablesGenerator::new(32);
let stats = SimpleStats::new(|s| println!("{}", s)); let stats = SimpleStats::new(|s| println!("{}", s));
let mut mgr = LlmpEventManager::new_on_port(broker_port, stats).unwrap(); let mut mgr = LlmpEventManager::new_on_port(broker_port, stats).unwrap();
if mgr.is_broker() { if mgr.is_broker() {
println!("Doing broker things."); println!("Doing broker things.");
mgr.broker_loop().unwrap(); mgr.broker_loop().unwrap();
@ -148,15 +137,9 @@ pub extern "C" fn afl_libfuzzer_main() {
} }
match input { match input {
Some(x) => { Some(x) => state
for indir in &x {
println!("in: {:?}", indir);
};
state
.load_initial_inputs(&mut corpus, &mut generator, &mut engine, &mut mgr, &x) .load_initial_inputs(&mut corpus, &mut generator, &mut engine, &mut mgr, &x)
.expect("Failed to load initial corpus") .expect("Failed to load initial corpus"),
},
None => (), None => (),
} }