Files
metasploit-gs/plugins/session_tagger.rb
T

59 lines
1.1 KiB
Ruby
Raw Normal View History

2010-05-03 17:13:09 +00:00
#
# $Id$
# $Revision$
#
module Msf
###
#
# This class hooks all session creation events and allows automated interaction
# This is only an example of what you can do with plugins
#
###
class Plugin::SessionTagger < Msf::Plugin
2013-09-30 13:47:53 -05:00
include Msf::SessionEvent
2013-09-30 13:47:53 -05:00
def on_session_open(session)
print_status("Hooked session #{session.sid} / #{session.session_host}")
2013-09-30 13:47:53 -05:00
# XXX: Determine what type of session this is before writing to it
2013-09-30 13:47:53 -05:00
if (session.interactive?)
session.shell_write("MKDIR C:\\TaggedBy#{ENV['USER']}\n")
session.shell_write("mkdir /tmp/TaggedBy#{ENV['USER']}\n")
end
2013-09-30 13:47:53 -05:00
#
# Read output with session.shell_read()
#
end
2013-09-30 13:47:53 -05:00
def on_session_close(session,reason='')
print_status("Hooked session #{session.sid} is shutting down")
end
2013-09-30 13:47:53 -05:00
def initialize(framework, opts)
super
self.framework.events.add_session_subscriber(self)
end
2013-09-30 13:47:53 -05:00
def cleanup
self.framework.events.remove_session_subscriber(self)
end
2013-09-30 13:47:53 -05:00
def name
"session_tagger"
end
2013-09-30 13:47:53 -05:00
def desc
"Automatically interacts with new sessions"
end
end
end