Files
metasploit-gs/documentation/samples/framework/dump_module_info.rb
T

35 lines
744 B
Ruby
Raw Normal View History

2005-12-17 06:46:23 +00:00
#!/usr/bin/env ruby
2005-11-28 14:26:33 +00:00
#
2010-05-03 17:13:09 +00:00
# $Id$
#
2005-11-28 14:26:33 +00:00
# This sample demonstrates how a module's information can be easily serialized
# to a readable format.
#
2010-05-03 17:13:09 +00:00
# $Revision$
#
2005-11-28 14:26:33 +00:00
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib'))
require 'msf/base'
if (ARGV.empty?)
2013-09-30 13:47:53 -05:00
puts "Usage: #{File.basename(__FILE__)} module_name"
exit
2005-11-28 14:26:33 +00:00
end
modname = ARGV.shift
2005-11-28 14:26:33 +00:00
framework = Msf::Simple::Framework.create
begin
2013-09-30 13:47:53 -05:00
# Create the module instance.
mod = framework.modules.create(modname)
if not mod
puts "Error: The specified Msf::Module, \"#{modname}\", was not found."
else
# Dump the module's information in readable text format.
puts Msf::Serializer::ReadableText.dump_module(mod)
end
2005-11-28 14:26:33 +00:00
rescue
2013-09-30 13:47:53 -05:00
puts "Error: #{$!}\n\n#{$@.join("\n")}"
2005-11-28 14:26:33 +00:00
end