Created
April 19, 2017 14:03
-
-
Save ntfshard/32e20fbef39fc00793ebb3c1b4cd02ed to your computer and use it in GitHub Desktop.
Simple file fuzzer: args: filename and count of iterations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! 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