Land #10665, print error msg when killing an invalid job ID - Fix #10655

4.x
Brendan Coles 2018-09-18 09:38:39 +00:00 committed by Metasploit
parent a2213a3c1c
commit 9b466d93bf
No known key found for this signature in database
GPG Key ID: CDFB5FA52007B954
2 changed files with 7 additions and 3 deletions

View File

@ -88,6 +88,7 @@ module CommandDispatcher
return if ele.count('-') > 1 return if ele.count('-') > 1
return if ele.first == '-' || ele[-1] == '-' return if ele.first == '-' || ele[-1] == '-'
return if ele.first == '.' || ele[-1] == '.' return if ele.first == '.' || ele[-1] == '.'
return unless ele =~ (/^(\d)+$/) # Not a number
if ele.include? '-' if ele.include? '-'
temp_array = (ele.split("-").inject { |s, e| s.to_i..e.to_i }).to_a temp_array = (ele.split("-").inject { |s, e| s.to_i..e.to_i }).to_a

View File

@ -209,10 +209,13 @@ module Msf
persist_list = [] persist_list = []
end end
# Remove persistence by job id.
job_list.map(&:to_s).each do |job| 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 if framework.jobs.key?(job)
payload_option = framework.jobs[job.to_s].ctx[1].datastore next unless framework.jobs[job.to_s].ctx[1] # next if no payload context in the job
persist_list.delete_if{|pjob|pjob['mod_options']['Options'] == payload_option} payload_option = framework.jobs[job.to_s].ctx[1].datastore
persist_list.delete_if{|pjob|pjob['mod_options']['Options'] == payload_option}
end
end end
# Write persist job back to config file. # Write persist job back to config file.
File.open(Msf::Config.persist_file,"w") do |file| File.open(Msf::Config.persist_file,"w") do |file|