Land #10520, Only allow setting persistence on payload jobs

GSoC/Meterpreter_Web_Console
Brent Cook 2018-08-25 22:21:46 -05:00
commit 969170096a
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
2 changed files with 9 additions and 1 deletions

View File

@ -844,7 +844,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