b391abd32d
1. InitialAutoRunScript and AutoRunScript vars work 2. scripts/shells was created to hold them 3. *_shell methods were renamed shell_* 4. added "shell_command" method to command shell sessions 5. converted all uses of *_shell to shell_* 6. all payloads that produce command shell sessions include Msf::Sessions::CommandShellOptions git-svn-id: file:///home/svn/framework3/trunk@8615 4d416f70-5f16-0410-b530-b9f4589650da
52 lines
1009 B
Ruby
52 lines
1009 B
Ruby
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
|
|
|
|
|
|
include Msf::SessionEvent
|
|
|
|
def on_session_open(session)
|
|
print_status("Hooked session #{session.sid} / #{session.tunnel_peer}")
|
|
|
|
# XXX: Determine what type of session this is before writing to it
|
|
|
|
if (session.interactive?)
|
|
session.shell_write("MKDIR C:\\TaggedBy#{ENV['USER']}\n")
|
|
session.shell_write("mkdir /tmp/TaggedBy#{ENV['USER']}\n")
|
|
end
|
|
|
|
#
|
|
# Read output with session.shell_read()
|
|
#
|
|
end
|
|
|
|
def on_session_close(session)
|
|
print_status("Hooked session #{session.sid} is shutting down")
|
|
end
|
|
|
|
def initialize(framework, opts)
|
|
super
|
|
self.framework.events.add_session_subscriber(self)
|
|
end
|
|
|
|
def cleanup
|
|
self.framework.events.remove_session_subscriber(self)
|
|
end
|
|
|
|
def name
|
|
"session_tagger"
|
|
end
|
|
|
|
def desc
|
|
"Automatically interacts with new sessions"
|
|
end
|
|
|
|
end
|
|
end |