Land #18019, Fixes validation for `to_handler` command for Evasion and Payload modules

This commit is contained in:
adfoster-r7 2023-05-30 10:39:01 +01:00 committed by GitHub
commit e2718eb40c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 8 deletions

View File

@ -153,7 +153,8 @@ module Exploit
raise $!
rescue ::Msf::OptionValidateError => e
exploit.error = e
::Msf::Ui::Formatter::OptionValidateError.print_error(oexploit, e)
::Msf::Ui::Formatter::OptionValidateError.print_error(exploit, e)
return false
rescue ::Exception => e
exploit.error = e
exploit.print_error("Exploit failed: #{e}")
@ -248,4 +249,3 @@ end
end
end

View File

@ -91,10 +91,22 @@ class Evasion
}
handler.share_datastore(mod.datastore)
handler.exploit_simple(handler_opts)
job_id = handler.job_id
print_status "Payload Handler Started as Job #{job_id}"
replicant_handler = nil
handler.exploit_simple(handler_opts) do |yielded_replicant_handler|
replicant_handler = yielded_replicant_handler
end
if replicant_handler.nil?
print_error('Failed to run module')
return
end
if replicant_handler.error.nil?
job_id = handler.job_id
print_status "Payload Handler Started as Job #{job_id}"
end
end
end
end

View File

@ -59,10 +59,22 @@ module Msf
}
handler.share_datastore(mod.datastore)
handler.exploit_simple(handler_opts)
job_id = handler.job_id
print_status "Payload Handler Started as Job #{job_id}"
replicant_handler = nil
handler.exploit_simple(handler_opts) do |yielded_replicant_handler|
replicant_handler = yielded_replicant_handler
end
if replicant_handler.nil?
print_error('Failed to run module')
return
end
if replicant_handler.error.nil?
job_id = handler.job_id
print_status "Payload Handler Started as Job #{job_id}"
end
end
alias cmd_exploit cmd_to_handler