Having the payload generator check the payload size
Payload generator will raise an error if the payload is larger then the size optionbug/bundler_fix
parent
7e34d1e1cf
commit
d3cdcd5f99
|
@ -9,6 +9,9 @@ module Msf
|
|||
class EncoderSpaceViolation < PayloadGeneratorError
|
||||
end
|
||||
|
||||
class SpaceViolation < PayloadGeneratorError
|
||||
end
|
||||
|
||||
class IncompatibleArch < PayloadGeneratorError
|
||||
end
|
||||
|
||||
|
@ -314,20 +317,25 @@ module Msf
|
|||
if platform == "java" or arch == "java" or payload.start_with? "java/"
|
||||
raw_payload = generate_java_payload
|
||||
cli_print "Payload size: #{raw_payload.length} bytes"
|
||||
raw_payload
|
||||
gen_payload = raw_payload
|
||||
elsif payload.start_with? "android/" and not template.blank?
|
||||
cli_print "Using APK template: #{template}"
|
||||
apk_backdoor = ::Msf::Payload::Apk::ApkBackdoor::new()
|
||||
raw_payload = apk_backdoor.backdoor_apk(template, generate_raw_payload)
|
||||
cli_print "Payload size: #{raw_payload.length} bytes"
|
||||
raw_payload
|
||||
gen_payload = raw_payload
|
||||
else
|
||||
raw_payload = generate_raw_payload
|
||||
raw_payload = add_shellcode(raw_payload)
|
||||
encoded_payload = encode_payload(raw_payload)
|
||||
encoded_payload = prepend_nops(encoded_payload)
|
||||
cli_print "Payload size: #{encoded_payload.length} bytes"
|
||||
format_payload(encoded_payload)
|
||||
gen_payload = format_payload(encoded_payload)
|
||||
end
|
||||
if gen_payload.length > @space and not @smallest
|
||||
raise SpaceViolation, 'The payload exceeds the allocated space'
|
||||
else
|
||||
gen_payload
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue