Land #11564, add a JavaMeterpreterDebug option to the java payloads

master
Brent Cook 2019-03-15 08:19:58 -05:00
commit 2512156197
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
4 changed files with 46 additions and 15 deletions

View File

@ -3,6 +3,7 @@
require 'msf/core' require 'msf/core'
require 'msf/core/payload/transport_config' require 'msf/core/payload/transport_config'
require 'msf/core/payload/uuid/options' require 'msf/core/payload/uuid/options'
require 'msf/core/payload/java/payload_options'
module Msf module Msf
@ -17,15 +18,15 @@ module Payload::Java::BindTcp
include Msf::Payload::TransportConfig include Msf::Payload::TransportConfig
include Msf::Payload::Java include Msf::Payload::Java
include Msf::Payload::UUID::Options include Msf::Payload::UUID::Options
include Msf::Payload::Java::PayloadOptions
# #
# Register Java reverse_http specific options # Register Java bind_tcp specific options
# #
def initialize(*args) def initialize(*args)
super super
register_advanced_options([ register_advanced_options([
Msf::OptString.new('AESPassword', [false, "Password for encrypting communication", '']), Msf::OptString.new('AESPassword', [false, "Password for encrypting communication", '']),
Msf::OptInt.new('Spawn', [true, "Number of subprocesses to spawn", 2])
]) ])
end end
@ -45,9 +46,7 @@ module Payload::Java::BindTcp
# #
def stager_config(opts={}) def stager_config(opts={})
ds = opts[:datastore] || datastore ds = opts[:datastore] || datastore
spawn = ds["Spawn"] || 2 c = super
c = ""
c << "Spawn=#{spawn}\n"
pass = ds["AESPassword"] || '' pass = ds["AESPassword"] || ''
if pass != "" if pass != ""
c << "AESPassword=#{pass}\n" c << "AESPassword=#{pass}\n"

View File

@ -0,0 +1,32 @@
# -*- coding: binary -*-
require 'msf/core'
module Msf::Payload::Java::PayloadOptions
def initialize(info = {})
super(info)
register_advanced_options(
[
Msf::OptBool.new('JavaMeterpreterDebug', [ false, "Run the payload in debug mode, with logging enabled" ]),
Msf::OptInt.new('Spawn', [true, "Number of subprocesses to spawn", 2])
]
)
end
#
# Generate default configuration that is to be included in the stager.
#
def stager_config(opts={})
ds = opts[:datastore] || datastore
spawn = ds["Spawn"] || 2
c = ""
if ds["JavaMeterpreterDebug"]
spawn = 0
c << "StageParameters=NoRedirect\n"
end
c << "Spawn=#{spawn}\n"
c
end
end

View File

@ -3,6 +3,7 @@
require 'msf/core' require 'msf/core'
require 'msf/core/payload/transport_config' require 'msf/core/payload/transport_config'
require 'msf/core/payload/uuid/options' require 'msf/core/payload/uuid/options'
require 'msf/core/payload/java/payload_options'
module Msf module Msf
@ -17,6 +18,7 @@ module Payload::Java::ReverseHttp
include Msf::Payload::TransportConfig include Msf::Payload::TransportConfig
include Msf::Payload::Java include Msf::Payload::Java
include Msf::Payload::UUID::Options include Msf::Payload::UUID::Options
include Msf::Payload::Java::PayloadOptions
# #
# Register Java reverse_http specific options # Register Java reverse_http specific options
@ -25,7 +27,6 @@ module Payload::Java::ReverseHttp
super super
register_advanced_options( register_advanced_options(
[ [
OptInt.new('Spawn', [true, 'Number of subprocesses to spawn', 2]),
OptInt.new('StagerURILength', [false, 'The URI length for the stager (at least 5 bytes)']), OptInt.new('StagerURILength', [false, 'The URI length for the stager (at least 5 bytes)']),
] + ] +
Msf::Opt::http_header_options Msf::Opt::http_header_options
@ -64,9 +65,8 @@ module Payload::Java::ReverseHttp
def stager_config(opts={}) def stager_config(opts={})
uri = generate_uri(opts) uri = generate_uri(opts)
ds = opts[:datastore] || datastore ds = opts[:datastore] || datastore
c = super
c = ''
c << "Spawn=#{ds["Spawn"] || 2}\n"
c << "HeaderUser-Agent=#{ds["HttpUserAgent"]}\n" if ds["HttpUserAgent"] c << "HeaderUser-Agent=#{ds["HttpUserAgent"]}\n" if ds["HttpUserAgent"]
c << "HeaderHost=#{ds["HttpHostHeader"]}\n" if ds["HttpHostHeader"] c << "HeaderHost=#{ds["HttpHostHeader"]}\n" if ds["HttpHostHeader"]
c << "HeaderReferer=#{ds["HttpReferer"]}\n" if ds["HttpReferer"] c << "HeaderReferer=#{ds["HttpReferer"]}\n" if ds["HttpReferer"]

View File

@ -3,6 +3,7 @@
require 'msf/core' require 'msf/core'
require 'msf/core/payload/transport_config' require 'msf/core/payload/transport_config'
require 'msf/core/payload/uuid/options' require 'msf/core/payload/uuid/options'
require 'msf/core/payload/java/payload_options'
module Msf module Msf
@ -17,15 +18,15 @@ module Payload::Java::ReverseTcp
include Msf::Payload::TransportConfig include Msf::Payload::TransportConfig
include Msf::Payload::Java include Msf::Payload::Java
include Msf::Payload::UUID::Options include Msf::Payload::UUID::Options
include Msf::Payload::Java::PayloadOptions
# #
# Register Java reverse_http specific options # Register Java reverse_tcp specific options
# #
def initialize(*args) def initialize(*args)
super super
register_advanced_options([ register_advanced_options([
Msf::OptString.new('AESPassword', [false, "Password for encrypting communication", '']), Msf::OptString.new('AESPassword', [false, "Password for encrypting communication", '']),
Msf::OptInt.new('Spawn', [true, "Number of subprocesses to spawn", 2])
]) ])
end end
@ -40,14 +41,13 @@ module Payload::Java::ReverseTcp
false false
end end
# #
# Generate configuration that is to be included in the stager. # Generate configuration that is to be included in the stager.
# #
def stager_config(opts={}) def stager_config(opts={})
c = super
ds = opts[:datastore] || datastore ds = opts[:datastore] || datastore
spawn = ds["Spawn"] || 2
c = ""
c << "Spawn=#{spawn}\n"
pass = ds["AESPassword"] || '' pass = ds["AESPassword"] || ''
if pass != "" if pass != ""
c << "AESPassword=#{pass}\n" c << "AESPassword=#{pass}\n"