Fix issue when kill a non-existent job.

This commit is contained in:
Green-m
2018-09-18 15:48:30 +08:00
parent 1260c8f801
commit d4cdaf56ae
@@ -209,10 +209,13 @@ module Msf
persist_list = []
end
# Stop the job and remove persistence by job id.
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}
if framework.jobs.key?(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
end
# Write persist job back to config file.
File.open(Msf::Config.persist_file,"w") do |file|