push the check for msf up to the main meterpreter command dispatcher and fire events for file upload/download.
git-svn-id: file:///home/svn/framework3/trunk@12307 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
79e84a46e9
commit
05e47166a3
|
@ -302,21 +302,13 @@ class FrameworkEventSubscriber
|
|||
:remote_path => rpath
|
||||
})
|
||||
end
|
||||
def on_session_filedelete(session, path)
|
||||
#session_event('session_filedelete', session, :path => path)
|
||||
framework.db.report_session_event({
|
||||
:etype => 'filedelete',
|
||||
:session => session,
|
||||
:local_path => lpath,
|
||||
:remote_path => rpath
|
||||
})
|
||||
end
|
||||
|
||||
def on_session_close(session, reason='')
|
||||
if session.db_record
|
||||
# Don't bother saving here, the session's cleanup method will take
|
||||
# care of that later.
|
||||
session.db_record.close_reason = reason
|
||||
session.db_record.closed_at = Time.now
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -36,6 +36,11 @@ module Console::CommandDispatcher
|
|||
@@file_hash[name] = klass
|
||||
end
|
||||
|
||||
def initialize(shell)
|
||||
@msf_loaded = nil
|
||||
super
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the meterpreter client context.
|
||||
#
|
||||
|
@ -43,6 +48,24 @@ module Console::CommandDispatcher
|
|||
shell.client
|
||||
end
|
||||
|
||||
#
|
||||
# Returns true if the client has a framework object.
|
||||
#
|
||||
# Used for firing framework session events
|
||||
#
|
||||
def msf_loaded?
|
||||
return @msf_loaded unless @msf_loaded.nil?
|
||||
# if we get here we must not have initialized yet
|
||||
|
||||
if client.framework
|
||||
# We have a framework instance so the msf libraries should be
|
||||
# available. Load up the ones we're going to use
|
||||
require 'msf/base/serializer/readable_text'
|
||||
end
|
||||
@msf_loaded = !!(client.framework)
|
||||
@msf_loaded
|
||||
end
|
||||
|
||||
#
|
||||
# Log that an error occurred.
|
||||
#
|
||||
|
@ -59,4 +82,4 @@ end
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,20 +27,6 @@ class Console::CommandDispatcher::Core
|
|||
self.bgjobs = []
|
||||
self.bgjob_id = 0
|
||||
|
||||
@msf_loaded = nil
|
||||
end
|
||||
|
||||
def msf_loaded?
|
||||
return @msf_loaded unless @msf_loaded.nil?
|
||||
# if we get here we must not have initialized yet
|
||||
|
||||
if client.framework
|
||||
# We have a framework instance so the msf libraries should be
|
||||
# available. Load up the ones we're going to use
|
||||
require 'msf/base/serializer/readable_text'
|
||||
end
|
||||
@msf_loaded = !!(client.framework)
|
||||
@msf_loaded
|
||||
end
|
||||
|
||||
@@use_opts = Rex::Parser::Arguments.new(
|
||||
|
|
|
@ -225,10 +225,12 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|||
if (stat.directory?)
|
||||
client.fs.dir.download(dest, src, recursive, true) { |step, src, dst|
|
||||
print_status("#{step.ljust(11)}: #{src} -> #{dst}")
|
||||
client.framework.events.on_session_download(client, src, dest) if msf_loaded?
|
||||
}
|
||||
elsif (stat.file?)
|
||||
client.fs.file.download(dest, src) { |step, src, dst|
|
||||
print_status("#{step.ljust(11)}: #{src} -> #{dst}")
|
||||
client.framework.events.on_session_download(client, src, dest) if msf_loaded?
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -417,10 +419,12 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|||
if (stat.directory?)
|
||||
client.fs.dir.upload(dest, src, recursive) { |step, src, dst|
|
||||
print_status("#{step.ljust(11)}: #{src} -> #{dst}")
|
||||
client.framework.events.on_session_upload(client, src, dest) if msf_loaded?
|
||||
}
|
||||
elsif (stat.file?)
|
||||
client.fs.file.upload(dest, src) { |step, src, dst|
|
||||
print_status("#{step.ljust(11)}: #{src} -> #{dst}")
|
||||
client.framework.events.on_session_upload(client, src, dest) if msf_loaded?
|
||||
}
|
||||
end
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue