diff --git a/README.md b/README.md index e09cb28..32d2ebe 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ fuzz "My Web App" do data "JSON generated from a template" do t = FuzzBert::Template.new '{ user: { id: ${id}, name: "${name}" } }' t.set(:id, FuzzBert::Generators.cycle(1..10000)) - t.set(:name) { "fixed" + FuzzBert::Generators.random_fixlen(2).call } + t.set(:name) { "Fixed text plus two random bytes: #{FuzzBert::Generators.random_fixlen(2).call}" } t.generator end diff --git a/examples/custom_handler.rb b/examples/custom_handler.rb index 8e75df1..53d62f1 100644 --- a/examples/custom_handler.rb +++ b/examples/custom_handler.rb @@ -15,21 +15,16 @@ def handle(error_data) end end -fuzz "OpenSSL command line (asn1parse)" do +fuzz "Some application" do deploy do |data| - IO.popen("openssl asn1parse -inform DER -noout", "w") do |io| - io.write(data) - end - status = $? - unless status.exited? && status.success? - raise RuntimeError.new("bug!") - end + #send the generated data to your application here instead + p data end data("completely random") { FuzzBert::Generators.random } - data "Indefinite length sequence" do + data "Payload" do c = FuzzBert::Container.new c << FuzzBert::Generators.fixed("\x30\x80") c << FuzzBert::Generators.random diff --git a/examples/template.rb b/examples/template.rb index 716ab62..524e0bc 100644 --- a/examples/template.rb +++ b/examples/template.rb @@ -2,7 +2,8 @@ fuzz "Web App" do deploy do |data| - #send JSON data via HTTP + #send JSON data via HTTP here instead + p data end data "template" do @@ -10,8 +11,11 @@ { user: { id: ${id}, name: "${name}", text: "${text}" } } EOS t.set(:id, FuzzBert::Generators.cycle(1..10000)) - t.set(:name) { "fixed" + FuzzBert::Generators.random.call } - t.set(:text, FuzzBert::Generators.random) + name = FuzzBert::Container.new + name << FuzzBert::Generators.fixed("fixed") + name << FuzzBert::Generators.random_fixlen(2) + t.set(:name, name.generator) + t.set(:text) { "Fixed text plus two random bytes: #{FuzzBert::Generators.random_fixlen(2).call}" } t.generator end end