adding a flag to inspect a binary blob file

This commit is contained in:
Vincent Batts 2012-11-15 16:54:26 -05:00
parent eb2fd6d8ee
commit 0e93acb328

View file

@ -136,13 +136,16 @@ def parse_args(args)
opts.on('--contents FILE', "use FILE instead of #{options[:content_list]}") do |o|
options[:content_list] = o
end
opts.on('--cert FILE', "read contents from certificate FILE") do |o|
opts.on('--cert FILE', 'read contents from certificate FILE') do |o|
options[:certificate] = o
end
opts.on('--binary FILE', 'read contents from packed binary FILE') do |o|
options[:binary_file] = o
end
opts.on('--test PATH', "validate PATH, instead of [#{options[:test_url]}]") do |o|
options[:test_url] = o
end
opts.on('--print', "print the tree of contents") do |o|
opts.on('--print', 'print the tree of contents') do |o|
options[:printTree] = o
end
opts.on('--gen-payload', 'generate the binary payload from the content sets') do |o|
@ -181,6 +184,11 @@ def main(args)
_puts(options, pt.toList())
return
end
if options[:binary_file]
pt = Trie::PathTree.new(File.read(options[:binary_file]).to_java_bytes)
_puts(options, pt.toList())
return
end
if options[:payload]
_puts(options, pt(options[:content_list]).getPayload())
return