Go all in with JSON format, rename var to get more readable.

GSoC/Meterpreter_Web_Console
Green-m 2018-08-14 06:37:08 -04:00
parent bdb663b078
commit 2394e92c1c
No known key found for this signature in database
GPG Key ID: 7A4A0E684B5D6747
1 changed files with 8 additions and 6 deletions

View File

@ -179,19 +179,21 @@ class Driver < Msf::Ui::Driver
end end
# Process persistent job handler # Process persistent job handler
persist_handler = File.open(Msf::Config.persist_file,"r").readlines.map!(&:chomp) rescue nil begin
restore_handlers = JSON.parse(File.read(Msf::Config.persist_file))
rescue Errno::ENOENT, JSON::ParserError
restore_handlers = nil
end
unless persist_handler.blank? unless restore_handlers.nil?
persist_handler.map!{|handler|JSON.parse(handler)} print_status("Starting persistent handler(s)...")
print_status("Starting persistent handler...")
persist_handler.each do |handler_opts| restore_handlers.each do |handler_opts|
handler = framework.modules.create(handler_opts['mod_name']) handler = framework.modules.create(handler_opts['mod_name'])
handler.exploit_simple(handler_opts['mod_options']) handler.exploit_simple(handler_opts['mod_options'])
end end
end end
# Process any additional startup commands # Process any additional startup commands
if opts['XCommands'] and opts['XCommands'].kind_of? Array if opts['XCommands'] and opts['XCommands'].kind_of? Array
opts['XCommands'].each { |c| opts['XCommands'].each { |c|