cleans up numerous superfluous returns in msf/core/module
parent
304bc9b6a8
commit
5b1a207377
|
@ -34,11 +34,11 @@ class Module
|
||||||
end
|
end
|
||||||
|
|
||||||
def fullname
|
def fullname
|
||||||
return type + '/' + refname
|
type + '/' + refname
|
||||||
end
|
end
|
||||||
|
|
||||||
def shortname
|
def shortname
|
||||||
return refname.split('/')[-1]
|
refname.split('/').last
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -84,7 +84,7 @@ class Module
|
||||||
# Returns the class reference to the framework
|
# Returns the class reference to the framework
|
||||||
#
|
#
|
||||||
def framework
|
def framework
|
||||||
return self.class.framework
|
self.class.framework
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -178,6 +178,7 @@ class Module
|
||||||
#
|
#
|
||||||
|
|
||||||
def print_prefix
|
def print_prefix
|
||||||
|
ret = ''
|
||||||
if (datastore['TimestampOutput'] =~ /^(t|y|1)/i) || (
|
if (datastore['TimestampOutput'] =~ /^(t|y|1)/i) || (
|
||||||
framework && framework.datastore['TimestampOutput'] =~ /^(t|y|1)/i
|
framework && framework.datastore['TimestampOutput'] =~ /^(t|y|1)/i
|
||||||
)
|
)
|
||||||
|
@ -189,10 +190,9 @@ class Module
|
||||||
prefix << "[%04d] " % xn
|
prefix << "[%04d] " % xn
|
||||||
end
|
end
|
||||||
|
|
||||||
return prefix
|
ret = prefix
|
||||||
else
|
|
||||||
return ''
|
|
||||||
end
|
end
|
||||||
|
ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_status(msg='')
|
def print_status(msg='')
|
||||||
|
@ -257,7 +257,7 @@ class Module
|
||||||
# payloads/windows/shell/reverse_tcp
|
# payloads/windows/shell/reverse_tcp
|
||||||
#
|
#
|
||||||
def fullname
|
def fullname
|
||||||
return self.class.fullname
|
self.class.fullname
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -267,28 +267,28 @@ class Module
|
||||||
# windows/shell/reverse_tcp
|
# windows/shell/reverse_tcp
|
||||||
#
|
#
|
||||||
def refname
|
def refname
|
||||||
return self.class.refname
|
self.class.refname
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the module's rank.
|
# Returns the module's rank.
|
||||||
#
|
#
|
||||||
def rank
|
def rank
|
||||||
return self.class.rank
|
self.class.rank
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the module's rank in string format.
|
# Returns the module's rank in string format.
|
||||||
#
|
#
|
||||||
def rank_to_s
|
def rank_to_s
|
||||||
return self.class.rank_to_s
|
self.class.rank_to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the module's rank in display format.
|
# Returns the module's rank in display format.
|
||||||
#
|
#
|
||||||
def rank_to_h
|
def rank_to_h
|
||||||
return self.class.rank_to_h
|
self.class.rank_to_h
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -299,14 +299,14 @@ class Module
|
||||||
# reverse_tcp
|
# reverse_tcp
|
||||||
#
|
#
|
||||||
def shortname
|
def shortname
|
||||||
return self.class.shortname
|
self.class.shortname
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the unduplicated class associated with this module.
|
# Returns the unduplicated class associated with this module.
|
||||||
#
|
#
|
||||||
def orig_cls
|
def orig_cls
|
||||||
return self.class.orig_cls
|
self.class.orig_cls
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -366,30 +366,14 @@ class Module
|
||||||
# Returns the address of the last target host (rough estimate)
|
# Returns the address of the last target host (rough estimate)
|
||||||
#
|
#
|
||||||
def target_host
|
def target_host
|
||||||
if(self.respond_to?('rhost'))
|
self.respond_to?('rhost') ? rhost : self.datastore['RHOST']
|
||||||
return rhost()
|
|
||||||
end
|
|
||||||
|
|
||||||
if(self.datastore['RHOST'])
|
|
||||||
return self.datastore['RHOST']
|
|
||||||
end
|
|
||||||
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the address of the last target port (rough estimate)
|
# Returns the address of the last target port (rough estimate)
|
||||||
#
|
#
|
||||||
def target_port
|
def target_port
|
||||||
if(self.respond_to?('rport'))
|
self.respond_to?('rport') ? rport : self.datastore['RPORT']
|
||||||
return rport()
|
|
||||||
end
|
|
||||||
|
|
||||||
if(self.datastore['RPORT'])
|
|
||||||
return self.datastore['RPORT']
|
|
||||||
end
|
|
||||||
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -516,7 +500,7 @@ class Module
|
||||||
# Return a comma separated list of author for this module.
|
# Return a comma separated list of author for this module.
|
||||||
#
|
#
|
||||||
def author_to_s
|
def author_to_s
|
||||||
return author.collect { |author| author.to_s }.join(", ")
|
author.collect { |author| author.to_s }.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -530,7 +514,7 @@ class Module
|
||||||
# Return a comma separated list of supported architectures, if any.
|
# Return a comma separated list of supported architectures, if any.
|
||||||
#
|
#
|
||||||
def arch_to_s
|
def arch_to_s
|
||||||
return arch.join(", ")
|
arch.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -544,16 +528,18 @@ class Module
|
||||||
# Return whether or not the module supports the supplied architecture.
|
# Return whether or not the module supports the supplied architecture.
|
||||||
#
|
#
|
||||||
def arch?(what)
|
def arch?(what)
|
||||||
return true if (what == ARCH_ANY)
|
if (what == ARCH_ANY)
|
||||||
|
true
|
||||||
return arch.index(what) != nil
|
else
|
||||||
|
arch.index(what) != nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return a comma separated list of supported platforms, if any.
|
# Return a comma separated list of supported platforms, if any.
|
||||||
#
|
#
|
||||||
def platform_to_s
|
def platform_to_s
|
||||||
return ((platform.all?) ? [ "All" ] : platform.names).join(", ")
|
platform.all? ? "All" : platform.names.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -567,7 +553,7 @@ class Module
|
||||||
# Returns whether or not the module requires or grants high privileges.
|
# Returns whether or not the module requires or grants high privileges.
|
||||||
#
|
#
|
||||||
def privileged?
|
def privileged?
|
||||||
return (privileged == true)
|
privileged == true
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -575,7 +561,7 @@ class Module
|
||||||
# this somewhere else.
|
# this somewhere else.
|
||||||
#
|
#
|
||||||
def comm
|
def comm
|
||||||
return Rex::Socket::Comm::Local
|
Rex::Socket::Comm::Local
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -749,7 +735,7 @@ class Module
|
||||||
# Constants indicating the reason for an unsuccessful module attempt
|
# Constants indicating the reason for an unsuccessful module attempt
|
||||||
#
|
#
|
||||||
module Failure
|
module Failure
|
||||||
|
|
||||||
#
|
#
|
||||||
# No confidence in success or failure
|
# No confidence in success or failure
|
||||||
#
|
#
|
||||||
|
@ -814,7 +800,7 @@ class Module
|
||||||
# The payload was delivered but no session was opened (AV, network, etc)
|
# The payload was delivered but no session was opened (AV, network, etc)
|
||||||
#
|
#
|
||||||
PayloadFailed = 'payload-failed'
|
PayloadFailed = 'payload-failed'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -827,42 +813,42 @@ class Module
|
||||||
# Returns true if this module is an exploit module.
|
# Returns true if this module is an exploit module.
|
||||||
#
|
#
|
||||||
def exploit?
|
def exploit?
|
||||||
return (type == MODULE_EXPLOIT)
|
(type == MODULE_EXPLOIT)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns true if this module is a payload module.
|
# Returns true if this module is a payload module.
|
||||||
#
|
#
|
||||||
def payload?
|
def payload?
|
||||||
return (type == MODULE_PAYLOAD)
|
(type == MODULE_PAYLOAD)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns true if this module is an encoder module.
|
# Returns true if this module is an encoder module.
|
||||||
#
|
#
|
||||||
def encoder?
|
def encoder?
|
||||||
return (type == MODULE_ENCODER)
|
(type == MODULE_ENCODER)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns true if this module is a nop module.
|
# Returns true if this module is a nop module.
|
||||||
#
|
#
|
||||||
def nop?
|
def nop?
|
||||||
return (type == MODULE_NOP)
|
(type == MODULE_NOP)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns true if this module is an auxiliary module.
|
# Returns true if this module is an auxiliary module.
|
||||||
#
|
#
|
||||||
def auxiliary?
|
def auxiliary?
|
||||||
return (type == MODULE_AUX)
|
(type == MODULE_AUX)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns true if this module is an post-exploitation module.
|
# Returns true if this module is an post-exploitation module.
|
||||||
#
|
#
|
||||||
def post?
|
def post?
|
||||||
return (type == MODULE_POST)
|
(type == MODULE_POST)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1073,7 +1059,7 @@ protected
|
||||||
merge_check_key(info, name, val)
|
merge_check_key(info, name, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
return info
|
info
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue