Files
metasploit-gs/documentation/samples/framework/dump_module_info.rb
T
Joshua Drake a731efa5ce add a more specific error message when the module creation fails
git-svn-id: file:///home/svn/framework3/trunk@9766 4d416f70-5f16-0410-b530-b9f4589650da
2010-07-10 16:10:38 +00:00

35 lines
730 B
Ruby
Executable File

#!/usr/bin/env ruby
#
# $Id$
#
# This sample demonstrates how a module's information can be easily serialized
# to a readable format.
#
# $Revision$
#
$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib'))
require 'msf/base'
if (ARGV.empty?)
puts "Usage: #{File.basename(__FILE__)} module_name"
exit
end
modname = ARGV.shift
framework = Msf::Simple::Framework.create
begin
# 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
rescue
puts "Error: #{$!}\n\n#{$@.join("\n")}"
end