From f4942eccd4b1b232381b2122125f4dc2ed41910a Mon Sep 17 00:00:00 2001 From: Joshua Smith Date: Thu, 8 May 2014 16:04:18 -0500 Subject: [PATCH] cleans up comments, line lengths, dup/clone --- lib/msf/base/sessions/scriptable.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/msf/base/sessions/scriptable.rb b/lib/msf/base/sessions/scriptable.rb index 31438dba1b..1a468f84af 100644 --- a/lib/msf/base/sessions/scriptable.rb +++ b/lib/msf/base/sessions/scriptable.rb @@ -52,7 +52,8 @@ module Scriptable end # - # Executes the supplied script, Post module, or local exploit with arguments +args+ + # Executes the supplied script, Post module, or local Exploit module with + # arguments +args+ # # Will search the script path. # @@ -81,13 +82,16 @@ module Scriptable if mod.exploit_type == "local" # get a copy of the session exploit's datastore if we can original_exploit_datastore = self.exploit.datastore || {} - copy_of_orig_exploit_datastore = original_exploit_datastore.dup + copy_of_orig_exploit_datastore = original_exploit_datastore.clone # we don't want to inherit a couple things, like AutoRunScript's to_neuter = ['AutoRunScript', 'InitialAutoRunScript', 'LPORT'] - to_neuter.each { |setting| copy_of_orig_exploit_datastore.delete(setting) } + to_neuter.each do |setting| + copy_of_orig_exploit_datastore.delete(setting) + end - # merge in any opts that were passed in, defaulting to the - # copy of the datastore (of the exploit) that spawned the session + # merge in any opts that were passed in, defaulting all other settings + # to the values from the datastore (of the exploit) that spawned the + # session local_exploit_opts = copy_of_orig_exploit_datastore.merge(opts) # try to run this local exploit, which is likely to be exception prone @@ -102,7 +106,8 @@ module Scriptable rescue ::Interrupt raise $! rescue ::Exception => e - print_error("Local exploit exception (#{mod.refname}): #{e.class} #{e}") + print_error("Local exploit exception (#{mod.refname}): " + + "#{e.class} #{e}") if(e.class.to_s != 'Msf::OptionValidateError') print_error("Call stack:") e.backtrace.each do |line|