Skip to content

Instantly share code, notes, and snippets.

@ntfshard
Created April 19, 2017 14:03
Show Gist options
  • Save ntfshard/32e20fbef39fc00793ebb3c1b4cd02ed to your computer and use it in GitHub Desktop.
Save ntfshard/32e20fbef39fc00793ebb3c1b4cd02ed to your computer and use it in GitHub Desktop.
Simple file fuzzer: args: filename and count of iterations
#! ruby
def main(fname, count)
f = IO.binread(fname)
sz = f.size
count.to_i.times {
f[ rand (sz) ] = rand(256).chr
}
File.open(fname, 'wb') {|fd| fd << f}
end
main(ARGV[0], ARGV[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment