Skip to content

Commit

Permalink
Fix session validation when smb sessions are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-r7 committed Nov 24, 2023
1 parent a6d951c commit 698f855
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/msf/core/optional_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ def initialize(info = {})
)
end
end

def session
return nil unless framework.features.enabled?(Msf::FeatureManager::SMB_SESSION_TYPE)
super
end
end
3 changes: 2 additions & 1 deletion lib/msf/core/session_compatibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def cleanup; end
# @return [nil] if the id provided in the datastore does not
# correspond to a session
def session
return nil unless framework.features.enabled?(Msf::FeatureManager::SMB_SESSION_TYPE)
# Try the cached one
return @session if @session && !session_changed?

Expand All @@ -96,6 +95,8 @@ def session_display_info
"Session: #{session.sid} (#{session.session_host})"
end

alias :client :session

#
# Can be overridden by individual modules to add new commands
#
Expand Down

0 comments on commit 698f855

Please sign in to comment.