Extract Msf::Module::UI::*::Verbose and shared examples

MSP-11126
bug/bundler_fix
Luke Imhoff 2014-10-16 10:05:45 -05:00
parent a3afb92ee2
commit c50cb2eb8a
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
10 changed files with 54 additions and 31 deletions

View File

@ -176,31 +176,6 @@ class Module
obj obj
end end
# Verbose version of #print_status
def vprint_status(msg)
print_status(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_error
def vprint_error(msg)
print_error(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_good
def vprint_good(msg)
print_good(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_line
def vprint_line(msg)
print_line(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_debug
def vprint_debug(msg)
print_debug(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_warning
def vprint_warning(msg)
print_warning(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# #
# Returns the module's framework full reference name. This is the # Returns the module's framework full reference name. This is the
# short name that end-users work with (refname) plus the type # short name that end-users work with (refname) plus the type

View File

@ -1,4 +1,8 @@
module Msf::Module::UI::Line module Msf::Module::UI::Line
autoload :Verbose, 'msf/core/module/ui/line/verbose'
include Msf::Module::UI::Line::Verbose
def print_line(msg='') def print_line(msg='')
super(print_line_prefix + msg) super(print_line_prefix + msg)
end end

View File

@ -0,0 +1,6 @@
module Msf::Module::UI::Line::Verbose
# Verbose version of #print_line
def vprint_line(msg)
print_line(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
end

View File

@ -1,5 +1,9 @@
# Methods for print messages with status indicators # Methods for print messages with status indicators
module Msf::Module::UI::Message module Msf::Module::UI::Message
autoload :Verbose, 'msf/core/module/ui/message/verbose'
include Msf::Module::UI::Message::Verbose
def print_error(msg='') def print_error(msg='')
super(print_prefix + msg) super(print_prefix + msg)
end end

View File

@ -0,0 +1,26 @@
module Msf::Module::UI::Message::Verbose
# Verbose version of #print_debug
def vprint_debug(msg)
print_debug(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_error
def vprint_error(msg)
print_error(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_good
def vprint_good(msg)
print_good(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_status
def vprint_status(msg)
print_status(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
# Verbose version of #print_warning
def vprint_warning(msg)
print_warning(msg) if datastore['VERBOSE'] || framework.datastore['VERBOSE']
end
end

View File

@ -96,12 +96,6 @@ describe Msf::Module do
it { is_expected.to respond_to :type } it { is_expected.to respond_to :type }
it { is_expected.to respond_to :update_info } it { is_expected.to respond_to :update_info }
it { is_expected.to respond_to :validate } it { is_expected.to respond_to :validate }
it { is_expected.to respond_to :vprint_debug }
it { is_expected.to respond_to :vprint_error }
it { is_expected.to respond_to :vprint_good }
it { is_expected.to respond_to :vprint_line }
it { is_expected.to respond_to :vprint_status }
it { is_expected.to respond_to :vprint_warning }
it { is_expected.to respond_to :workspace } it { is_expected.to respond_to :workspace }
it_should_behave_like 'Msf::Module::Compatibility' it_should_behave_like 'Msf::Module::Compatibility'

View File

@ -1,4 +1,6 @@
shared_examples_for 'Msf::Module::UI::Line' do shared_examples_for 'Msf::Module::UI::Line' do
it_should_behave_like 'Msf::Module::UI::Line::Verbose'
it { is_expected.to respond_to :print_line } it { is_expected.to respond_to :print_line }
it { is_expected.to respond_to :print_line_prefix } it { is_expected.to respond_to :print_line_prefix }
end end

View File

@ -0,0 +1,3 @@
shared_examples_for 'Msf::Module::UI::Line::Verbose' do
it { is_expected.to respond_to :vprint_line }
end

View File

@ -1,4 +1,6 @@
shared_examples_for 'Msf::Module::UI::Message' do shared_examples_for 'Msf::Module::UI::Message' do
it_should_behave_like 'Msf::Module::UI::Message::Verbose'
it { is_expected.to respond_to :print_error } it { is_expected.to respond_to :print_error }
it { is_expected.to respond_to :print_good } it { is_expected.to respond_to :print_good }
it { is_expected.to respond_to :print_prefix } it { is_expected.to respond_to :print_prefix }

View File

@ -0,0 +1,7 @@
shared_examples_for 'Msf::Module::UI::Message::Verbose' do
it { is_expected.to respond_to :vprint_debug }
it { is_expected.to respond_to :vprint_error }
it { is_expected.to respond_to :vprint_good }
it { is_expected.to respond_to :vprint_status }
it { is_expected.to respond_to :vprint_warning }
end