diff --git a/Cargo.toml b/Cargo.toml index 43b0854..0d8b375 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" [dependencies] wasmi = "0.9.1" wabt = "0.10.0" -clap = "3.0.0-beta.2" +clap = "3.0.0-beta.5" parity-wasm = "0.42.2" diff --git a/README.md b/README.md new file mode 100644 index 0000000..bf058bc --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Substrate WASM fuzzer + +Community project for fuzzing WASM in Substrate. + +Attack model: Attacker payload -> TX -> WASM Execution + + +## Example +# ./wasmfuzz -f -n -c -i + + +## Dev tasks +- Fuzzer logic/engine +- Fuzzer input + +## Good question +Why don't we just use AFL? We could inject from TX entry func... +https://github.com/rust-fuzz/afl.rs +https://aflplus.plus/ diff --git a/src/main.rs b/src/main.rs index b18f271..7540c03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,39 @@ +extern crate clap; + use clap::{Arg, App}; fn main() { - + let app = App::new("hello-clap"); + let iternum = Arg::with_name("n") + .long("num") + .takes_value(true) + .help("You need to specify the max number of iterations.") + .required(true); + let funcatk = Arg::with_name("f") + .long("func") + .takes_value(true) + .help("You need to specify the function to attack.") + .required(true); + + let contractf = Arg::with_name("c") + .long("contract") + .takes_value(true) + .help("You need to specify the contract file's name.") + .required(true); + + let app = app.arg(iternum); + let app = app.arg(funcatk); + let app = app.arg(contractf); + + let matches = app.get_matches(); + + let iternumout = matches.value_of("iternum") + .expect("Required option."); + let funcatkout = matches.value_of("funcatk") + .expect("Required option."); + let contractfout = matches.value_of("contractf") + .expect("Required option."); + + println!("Your options are: {} {} {}!", iternumout, funcatkout, contractfout); }