Implement specific dispatch extensions for tunnels
All meterpreter Clients are created equal, and as such they all include the PacketDispatcher mixin and call its init methods when a passive dispatcher is needed. However, since tunneling protocols have different requirements for implementation, the methods which provide protocol-specific functionality need to be mixed into the Client before it attempts to initialize the dispatcher. Provide a dispatch_ext option in the has passed to the client on init from the session handler which is an Array containing mixin references which are sent to :extend calls in the :init_meterpreter method just prior to calling :initialize_passive_dispatcher. Each handler implementation can thus push chains of mixins to the client in order to provide middleware specific to the tunnel. Down the road, this should permit stacking C2 encapsulations or tunnel protocols/permutators to create unique session transports on the fly.MS-2855/keylogger-mettle-extension
parent
d420bf1a6a
commit
f1a1e1a357
|
@ -384,6 +384,7 @@ protected
|
|||
|
||||
create_session(cli, {
|
||||
:passive_dispatcher => self.service,
|
||||
:dispatch_ext => [Rex::Post::Meterpreter::HttpPacketDispatcher],
|
||||
:conn_id => conn_id,
|
||||
:url => url,
|
||||
:expiration => datastore['SessionExpirationTimeout'].to_i,
|
||||
|
|
|
@ -165,6 +165,8 @@ class Client
|
|||
end
|
||||
end
|
||||
|
||||
# Protocol specific dispatch mixins go here, this may be neader with explicit Client classes
|
||||
opts[:dispatch_ext].each {|dx| self.extend(dx)} if opts[:dispatch_ext]
|
||||
initialize_passive_dispatcher if opts[:passive_dispatcher]
|
||||
|
||||
register_extension_alias('core', ClientCore.new(self))
|
||||
|
|
Loading…
Reference in New Issue