Skip to content

Commit 11e715a

Browse files
author
RageLtMan
committed
Configure transport from stager mixin
Transport configuration for basic session types can be performed by the stager mixin. Add a default transport_config method to Msf::Payload::Stager by mixing in Msf::Payload::TransportConfig and attempting to guess the default tranport and direction types from the currently loaded module's (MSF module) refname. Users with custom payloads will no longer need to update them with transport_config methods unless they use a non standard transport, direction, or other innovation which affects the default approach. Testing: Tested with payloads lacking transport_config methods or access to the TransportConfig module (Ruby) namespace. This also resolves problems with the RC4 payloads in upstream as they can't currently generate stagers for meterpreter.
1 parent 829f842 commit 11e715a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/msf/core/payload/stager.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: binary -*-
22
require 'msf/core'
33
require 'msf/core/option_container'
4+
require 'msf/core/payload/transport_config'
45

56
###
67
#
@@ -9,6 +10,8 @@
910
###
1011
module Msf::Payload::Stager
1112

13+
include Msf::Payload::TransportConfig
14+
1215
def initialize(info={})
1316
super
1417

@@ -22,6 +25,17 @@ def initialize(info={})
2225

2326
end
2427

28+
#
29+
# Perform attempt at detecting the appropriate transport config.
30+
# Call the determined config with passed options.
31+
# Override this in stages/stagers to use specific transports
32+
#
33+
def transport_config(opts={})
34+
transport_name = "transport_config_#{self.refname =~ /reverse_/ ? 'reverse' : 'bind'}" +
35+
"_#{self.refname =~ /_tcp/ ? 'tcp' : 'http'}"
36+
send(transport_name.to_sym,opts)
37+
end
38+
2539
#
2640
# Sets the payload type to a stager.
2741
#

0 commit comments

Comments
 (0)