Sha256: d84c8f53b9af43591f23cfe79048ef3a0bbd2338d7677d1eb9ee9810b0d2c5d8

Contents?: true

Size: 1.25 KB

Versions: 17

Compression:

Stored size: 1.25 KB

Contents

#! /usr/bin/ruby

require 'optparse'
require 'ole/storage'

def oletool
	opts = {:verbose => false, :action => :tree}
	op = OptionParser.new do |op|
		op.banner = "Usage: oletool [options] [files]"
		op.separator ''
		op.on('-t', '--tree', 'Dump ole trees for files (default)') { opts[:action] = :tree }
		op.on('-r', '--repack', 'Repack the ole files in canonical form') { opts[:action] = :repack }
		op.on('-m', '--mimetype', 'Print the guessed mime types') { opts[:action] = :mimetype }
		op.on('-y', '--metadata', 'Dump the internal meta data as YAML') { opts[:action] = :metadata }
		op.separator ''
		op.on('-v', '--[no-]verbose', 'Run verbosely') { |v| opts[:verbose] = v }
		op.on_tail('-h', '--help', 'Show this message') { puts op; exit }
	end
	files = op.parse ARGV
	if files.empty?
		puts 'Must specify 1 or more msg files.'
		puts op
		exit 1
	end
	Ole::Log.level = opts[:verbose] ? Logger::WARN : Logger::FATAL
	files.each do |file|
		case opts[:action]
		when :tree
			Ole::Storage.open(file) { |ole| puts ole.root.to_tree }
		when :repack
			Ole::Storage.open file, 'rb+', &:repack
		when :metadata
			Ole::Storage.open(file) { |ole| y ole.meta_data.to_h }
		when :mimetype
			puts Ole::Storage.open(file) { |ole| ole.meta_data.mime_type }
		end
	end
end

oletool

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
ruby-ole-1.2.12.2 bin/oletool
ruby-ole-1.2.12.1 bin/oletool
ruby-ole-1.2.12 bin/oletool
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/ruby-ole-1.2.11.8/bin/oletool
ruby-ole-1.2.11.8 bin/oletool
keeguon-ruby-ole-1.2.11.8 bin/oletool
keeguon-ruby-ole-1.2.11.7 bin/oletool
ruby-ole-1.2.11.7 bin/oletool
ruby-ole-1.2.11.6 bin/oletool
ruby-ole-1.2.11.5 bin/oletool
ruby-ole-1.2.11.4 bin/oletool
ruby-ole-1.2.11.3 bin/oletool
ruby-ole-1.2.11.2 bin/oletool
ruby-ole-1.2.11.1 bin/oletool
ruby-ole-1.2.11 bin/oletool
ruby-ole-patched-for-home_run-1.2.10.1.1 bin/oletool
ruby-ole-1.2.10.1 bin/oletool