auto load stdapi before interact, implement type? interface

git-svn-id: file:///home/svn/framework3/trunk@3833 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2006-08-15 04:07:25 +00:00
parent 77263c71de
commit d8b2f95178
4 changed files with 36 additions and 1 deletions

View File

@ -96,6 +96,24 @@ class Meterpreter < Rex::Post::Meterpreter::Client
console.queue_cmd(cmd)
end
#
# Explicitly runs a command.
#
def run_cmd(cmd)
console.run_single(cmd)
end
#
# Load the stdapi extension.
#
def load_stdapi()
original = console.disable_output
console.disable_output = true
console.run_single('use stdapi')
console.disable_output = original
end
#
# Interacts with the meterpreter client at a user interface level.
#

View File

@ -21,6 +21,12 @@ module SocketSubsystem
###
class TcpClientChannel < Rex::Post::Meterpreter::Stream
module SocketInterface
def type?
'tcp'
end
end
##
#
# Factory
@ -68,6 +74,10 @@ class TcpClientChannel < Rex::Post::Meterpreter::Stream
#
def initialize(client, cid, type, flags)
super(client, cid, type, flags)
# Implement some of the required socket interfaces on the local side of
# the stream abstraction.
lsock.extend(SocketInterface)
end
#

View File

@ -310,6 +310,13 @@ module Socket
return Socket.from_sockaddr(super)
end
#
# Returns a string that indicates the type of the socket, such as 'tcp'.
#
def type?
raise NotImplementedError, "Socket type is not supported."
end
#
# The peer host of the connected socket.
#

View File

@ -68,7 +68,7 @@ module Meterpreter
def on_session(session)
super
session.queue_cmd('use stdapi') if (datastore['AutoLoadStdapi'] == true)
session.load_stdapi if (datastore['AutoLoadStdapi'] == true)
end
end