2012-06-29 05:18:28 +00:00
|
|
|
# -*- coding: binary -*-
|
2010-02-11 18:36:38 +00:00
|
|
|
|
|
|
|
msfbase = __FILE__
|
|
|
|
while File.symlink?(msfbase)
|
2013-08-30 21:28:33 +00:00
|
|
|
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
2010-02-11 18:36:38 +00:00
|
|
|
end
|
|
|
|
path = File.expand_path(File.dirname(msfbase))
|
|
|
|
path += "/../../../"
|
|
|
|
$:.unshift(path)
|
|
|
|
|
|
|
|
|
|
|
|
require 'rex/ole'
|
|
|
|
|
|
|
|
if (ARGV.length < 1)
|
2013-08-30 21:28:33 +00:00
|
|
|
$stderr.puts "usage: dir <file>"
|
|
|
|
exit(1)
|
2010-02-11 18:36:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
document = ARGV.shift
|
|
|
|
|
|
|
|
|
|
|
|
# recursive printer :)
|
|
|
|
def show_entries(ent, spaces=0)
|
2013-08-30 21:28:33 +00:00
|
|
|
spstr = " " * spaces
|
2010-02-11 18:36:38 +00:00
|
|
|
|
2013-08-30 21:28:33 +00:00
|
|
|
puts "%s + #{ent.name}" % spstr
|
|
|
|
ent.each { |el|
|
|
|
|
show_entries(el, spaces+2)
|
|
|
|
}
|
2010-02-11 18:36:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if (stg = Rex::OLE::Storage.new(document))
|
2013-08-30 21:28:33 +00:00
|
|
|
show_entries(stg)
|
|
|
|
stg.close
|
2010-02-11 18:36:38 +00:00
|
|
|
end
|