Land #10520, Only allow setting persistence on payload jobs

4.x
Brent Cook 2018-08-25 22:21:46 -05:00 committed by Metasploit
parent f9c7de978e
commit 4e967d45ab
No known key found for this signature in database
GPG Key ID: CDFB5FA52007B954
2 changed files with 9 additions and 1 deletions

View File

@ -836,7 +836,9 @@ class ReadableText
end
persist_list.each do |e|
row[7] = 'true' if e['mod_options']['Options'] == framework.jobs[job_id.to_s].ctx[1].datastore
if framework.jobs[job_id.to_s].ctx[1]
row[7] = 'true' if e['mod_options']['Options'] == framework.jobs[job_id.to_s].ctx[1].datastore
end
end
end

View File

@ -210,6 +210,7 @@ module Msf
end
job_list.map(&:to_s).each do |job|
next unless framework.jobs[job.to_s].ctx[1] # next if no payload context in the job
payload_option = framework.jobs[job.to_s].ctx[1].datastore
persist_list.delete_if{|pjob|pjob['mod_options']['Options'] == payload_option}
end
@ -237,6 +238,11 @@ module Msf
def add_persist_job(job_id)
if job_id && framework.jobs.has_key?(job_id.to_s)
unless framework.jobs[job_id.to_s].ctx[1]
print_error("Add persistent job failed: job #{job_id} is not payload handler.")
return
end
mod = framework.jobs[job_id.to_s].ctx[0].replicant
payload = framework.jobs[job_id.to_s].ctx[1].replicant