Land #2952, -1 for last session ID
commit
18816f3d5e
|
@ -99,7 +99,7 @@ protected
|
|||
# Grab the session object since we need to fire an event for not
|
||||
# only the normal module_run event that all module types have to
|
||||
# report, but a specific event for sessions as well.
|
||||
s = mod.framework.sessions[mod.datastore["SESSION"]]
|
||||
s = mod.framework.sessions.get(mod.datastore["SESSION"].to_i)
|
||||
mod.framework.events.on_session_module_run(s, mod)
|
||||
mod.run
|
||||
rescue ::Timeout::Error => e
|
||||
|
|
|
@ -74,7 +74,7 @@ module Msf::PostMixin
|
|||
return @session if @session and not session_changed?
|
||||
|
||||
if datastore["SESSION"]
|
||||
@session = framework.sessions[datastore["SESSION"].to_i]
|
||||
@session = framework.sessions.get(datastore["SESSION"].to_i)
|
||||
else
|
||||
@session = nil
|
||||
end
|
||||
|
|
|
@ -279,7 +279,17 @@ class SessionManager < Hash
|
|||
# Returns the session associated with the supplied sid, if any.
|
||||
#
|
||||
def get(sid)
|
||||
return self[sid.to_i]
|
||||
session = nil
|
||||
sid = sid.to_i
|
||||
|
||||
if sid > 0
|
||||
session = self[sid]
|
||||
elsif sid == -1
|
||||
sid = self.keys.sort[-1]
|
||||
session = self[sid]
|
||||
end
|
||||
|
||||
session
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue