f1a1e1a357
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.