meterpreter comm session implemented, untested

git-svn-id: file:///home/svn/incoming/trunk@2920 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2005-09-30 05:59:44 +00:00
parent 14e39004de
commit 6f6924e001
7 changed files with 88 additions and 2 deletions

View File

@ -6,7 +6,7 @@ X - meterpreter
X - pivoting
X - portfwd command
- networking
- switch board routing table for pivoting
X - switch board routing table for pivoting
- meterpreter 'comm' support
- proxy 'comm' support
- asm

View File

@ -21,6 +21,7 @@ class Meterpreter < Rex::Post::Meterpreter::Client
#
include Msf::Session
include Msf::Session::Interactive
include Msf::Session::Comm
def initialize(rstream)
super
@ -89,6 +90,27 @@ class Meterpreter < Rex::Post::Meterpreter::Client
raise EOFError if (console.stopped? == true)
end
##
#
# Msf::Session::Comm implementors
#
##
#
# Creates a connection based on the supplied parameters and returns it to
# the caller. The connection is created relative to the remote machine on
# which the meterpreter server instance is running.
#
def create(param)
case param.proto
when 'tcp'
return net.socket.create(param)
else
raise Rex::UnsupportedProtocol.new(param.proto), caller
end
end
protected
attr_accessor :rstream, :console

View File

@ -46,6 +46,7 @@ module Session
# Direct descendents
require 'msf/core/session/interactive'
require 'msf/core/session/basic'
require 'msf/core/session/comm'
# Provider interfaces
require 'msf/core/session/provider/single_command_execution'

View File

@ -0,0 +1,30 @@
require 'rex/socket'
module Msf
module Session
###
#
# Comm
# ----
#
# This class implements the Rex::Socket::Comm module interface and is capable
# of creating network-based connections that are pivoted from the session in
# question.
#
###
module Comm
include Rex::Socket::Comm
#
# Session-based comm classes implement an instance specific method for
# creating network-based connections rather than the typicall class
# specific methods.
#
def create(param)
raise NotImplementedError
end
end
end
end

View File

@ -1,5 +1,6 @@
require 'socket'
require 'resolv'
require 'rex/exceptions'
module Rex
@ -19,7 +20,10 @@ module Socket
require 'rex/socket/parameters'
require 'rex/socket/tcp'
require 'rex/socket/tcp_server'
require 'rex/socket/comm'
require 'rex/socket/comm/local'
require 'rex/socket/switch_board'
##

28
lib/rex/socket/comm.rb Normal file
View File

@ -0,0 +1,28 @@
require 'rex/socket'
module Rex
module Socket
###
#
# Comm
# ----
#
# This mixin provides the basic interface that a derived class must implement
# in order to be a compatible comm class.
#
###
module Comm
#
# Creates a compatible socket based on the supplied uniform parameters.
#
def self.create(param)
raise NotImplementedError
end
end
end
end

View File

@ -1,4 +1,3 @@
require 'rex/exceptions'
require 'rex/socket'
require 'rex/socket/tcp'
require 'rex/socket/ssl_tcp'
@ -14,6 +13,8 @@ require 'rex/socket/udp'
###
class Rex::Socket::Comm::Local
include Rex::Socket::Comm
#
# Creates an instance of a socket using the supplied parameters.
#