fn run_target(
    target: String,
    fuzzer: fuzzers::Fuzzer,
    config: fuzzers::FuzzerConfig,
) -> Result<(), Error> {
    let target = match targets::Targets::iter().find(|x| x.name() == target) {
        None => bail!(
            "Don't know target `{}`. {}",
            target,
            if let Some(alt) = utils::did_you_mean(&target, &targets::get_targets()) {
                format!("Did you mean `{}`?", alt)
            } else {
                "".into()
            }
        ),
        Some(t) => t,
    };

    use fuzzers::Fuzzer::*;
    match fuzzer {
        Afl => {
            let afl = rust_fuzzers::FuzzerAfl::new(config)?;
            afl.run(target)?;
        }
        Honggfuzz => {
            let hfuzz = rust_fuzzers::FuzzerHfuzz::new(config)?;
            hfuzz.run(target)?;
        }
        Libfuzzer => {
            let lfuzz = rust_fuzzers::FuzzerLibfuzzer::new(config)?;
            lfuzz.run(target)?;
        }
    }
    Ok(())
}
/// Run fuzzing on only one target
Run fuzzing on only one target
Run fuzzing on only one target
fn run_target(
    target: String,
    fuzzer: fuzzers::Fuzzer,
    config: fuzzers::FuzzerConfig,
) -> Result<(), Error> {
    let target = match targets::Targets::iter().find(|x| x.name() == target) {
        None => bail!(
            "Don't know target `{}`. {}",
            target,
            if let Some(alt) = utils::did_you_mean(&target, &targets::get_targets()) {
                format!("Did you mean `{}`?", alt)
            } else {
                "".into()
            }
        ),
        Some(t) => t,
    };
    use fuzzers::Fuzzer::*;
    match fuzzer {
        Afl => {
            let afl = rust_fuzzers::FuzzerAfl::new(config)?;
            afl.run(target)?;
        }
        Honggfuzz => {
            let hfuzz = rust_fuzzers::FuzzerHfuzz::new(config)?;
            hfuzz.run(target)?;
        }
        Libfuzzer => {
            let lfuzz = rust_fuzzers::FuzzerLibfuzzer::new(config)?;
            lfuzz.run(target)?;
        }
    }
    Ok(())
}
fn run_target ( target : String , fuzzer : fuzzers :: Fuzzer , config : fuzzers :: FuzzerConfig , ) -> Result < ( ) , Error > { let target = match targets :: Targets :: iter ( ) . find ( | x | x . name ( ) == target ) { None => bail ! ( " " target if let Some ( alt ) utils did_you_mean ( target targets get_targets ( ) ) { format ( " " alt ) } else { " " into ( ) } ) , Some ( t ) => t , } ; use fuzzers :: Fuzzer :: * ; match fuzzer { Afl => { let afl = rust_fuzzers :: FuzzerAfl :: new ( config ) ? ; afl . run ( target ) ? ; } Honggfuzz => { let hfuzz = rust_fuzzers :: FuzzerHfuzz :: new ( config ) ? ; hfuzz . run ( target ) ? ; } Libfuzzer => { let lfuzz = rust_fuzzers :: FuzzerLibfuzzer :: new ( config ) ? ; lfuzz . run ( target ) ? ; } } Ok ( ( ) ) }
Run fuzzing on only one target
Run fuzzing on only one target
target
String
fuzzer
fuzzers::Fuzzer
config
fuzzers::FuzzerConfig
target
String
fuzzer
fuzzers::Fuzzer
config
fuzzers::FuzzerConfig