2005-05-21 18:27:24 +00:00
|
|
|
require 'Msf/Core'
|
2005-05-21 17:57:00 +00:00
|
|
|
|
|
|
|
module Msf
|
|
|
|
|
2005-05-22 07:14:16 +00:00
|
|
|
###
|
|
|
|
#
|
|
|
|
# SessionEvents
|
|
|
|
# -------------
|
|
|
|
#
|
|
|
|
# Event notifications that affect sessions.
|
|
|
|
#
|
|
|
|
###
|
2005-05-21 17:57:00 +00:00
|
|
|
module SessionEvents
|
|
|
|
|
2005-05-22 07:14:16 +00:00
|
|
|
# Called when a session is opened
|
2005-05-21 17:57:00 +00:00
|
|
|
def on_session_open(session)
|
|
|
|
end
|
|
|
|
|
2005-05-22 07:14:16 +00:00
|
|
|
# Called when a session is closed
|
2005-05-21 17:57:00 +00:00
|
|
|
def on_session_close(session)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Session
|
|
|
|
# -------
|
|
|
|
#
|
2005-05-22 07:14:16 +00:00
|
|
|
# The session class represents a post-exploitation, uh, session.
|
|
|
|
# Sessions can be written from, read to, and interacted with. The
|
|
|
|
# underlying medium on which they are backed is arbitrary. For
|
|
|
|
# instance, when an exploit is provided with a command shell,
|
|
|
|
# either through a network connection or locally, the session's
|
|
|
|
# read and write operations end up reading from and writing to
|
|
|
|
# the shell that was spawned. The session object can be seen
|
|
|
|
# as a general means of interacting with various post-exploitation
|
|
|
|
# payloads through a common interface that is not necessarily
|
|
|
|
# tied to a network connection.
|
2005-05-21 17:57:00 +00:00
|
|
|
#
|
|
|
|
###
|
|
|
|
class Session
|
2005-05-22 07:14:16 +00:00
|
|
|
|
2005-05-26 06:35:37 +00:00
|
|
|
def initialize()
|
2005-05-22 07:14:16 +00:00
|
|
|
end
|
|
|
|
|
2005-05-25 05:07:22 +00:00
|
|
|
#
|
2005-05-26 06:35:37 +00:00
|
|
|
# Perform session-specific cleanup
|
2005-05-25 05:07:22 +00:00
|
|
|
#
|
2005-05-26 06:35:37 +00:00
|
|
|
def cleanup
|
2005-05-22 07:14:16 +00:00
|
|
|
end
|
|
|
|
|
2005-05-25 05:07:22 +00:00
|
|
|
attr_accessor :framework, :sid
|
2005-05-22 07:14:16 +00:00
|
|
|
|
|
|
|
protected
|
|
|
|
|
2005-05-21 17:57:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2005-05-27 05:34:15 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Require the individual provider interfaces
|
|
|
|
#
|
|
|
|
require 'Msf/Core/SessionProvider/SingleCommandExecution'
|
|
|
|
require 'Msf/Core/SessionProvider/MultiCommandExecution'
|
|
|
|
require 'Msf/Core/SessionProvider/SingleCommandShell'
|
|
|
|
require 'Msf/Core/SessionProvider/MultiCommandShell'
|