Skip to content

Commit

Permalink
Handle cases where the framework module is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroSteiner committed Dec 15, 2022
1 parent 6f66ad6 commit e0799d7
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions lib/msf/core/exploit/remote/kerberos/ticket/storage/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ class Base
# @return [Msf::Module] the Metasploit framework module that is associated with the authentication instance
attr_reader :framework_module

def_delegators :@framework_module,
:print_status,
:print_good,
:workspace

def initialize(framework: nil, framework_module: nil)
@framework = framework || framework_module&.framework
@framework_module = framework_module
Expand Down Expand Up @@ -63,8 +58,28 @@ def store_ccache(ccache, options = {})
nil
end

# @return [String] The name of the workspace in which to operate.
def workspace
if @framework_module
return @framework_module.workspace
elsif @framework&.db&.active
return @framework.db.workspace&.name
end
end

private

# Forward whatever method calls this to the specified framework module, but
# only if it's present otherwise return nil.
def proxied_module_method(*args, **kwargs)
return nil unless @framework_module

@framework_module.send(__callee__, *args, **kwargs)
end

alias :print_good :proxied_module_method
alias :print_status :proxied_module_method

# Return the raw stored objects.
#
# @param [Hash] options See the options hash description in {#tickets}.
Expand Down

0 comments on commit e0799d7

Please sign in to comment.