Skip to content

Commit be06007

Browse files
committed
cleans up comments, line lengths, dup/clone
1 parent dfd9522 commit be06007

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/msf/base/sessions/scriptable.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def execute_file
5252
end
5353

5454
#
55-
# Executes the supplied script, Post module, or local exploit with arguments +args+
55+
# Executes the supplied script, Post module, or local Exploit module with
56+
# arguments +args+
5657
#
5758
# Will search the script path.
5859
#
@@ -81,13 +82,16 @@ def execute_script(script_name, *args)
8182
if mod.exploit_type == "local"
8283
# get a copy of the session exploit's datastore if we can
8384
original_exploit_datastore = self.exploit.datastore || {}
84-
copy_of_orig_exploit_datastore = original_exploit_datastore.dup
85+
copy_of_orig_exploit_datastore = original_exploit_datastore.clone
8586
# we don't want to inherit a couple things, like AutoRunScript's
8687
to_neuter = ['AutoRunScript', 'InitialAutoRunScript', 'LPORT']
87-
to_neuter.each { |setting| copy_of_orig_exploit_datastore.delete(setting) }
88+
to_neuter.each do |setting|
89+
copy_of_orig_exploit_datastore.delete(setting)
90+
end
8891

89-
# merge in any opts that were passed in, defaulting to the
90-
# copy of the datastore (of the exploit) that spawned the session
92+
# merge in any opts that were passed in, defaulting all other settings
93+
# to the values from the datastore (of the exploit) that spawned the
94+
# session
9195
local_exploit_opts = copy_of_orig_exploit_datastore.merge(opts)
9296

9397
# try to run this local exploit, which is likely to be exception prone
@@ -102,7 +106,8 @@ def execute_script(script_name, *args)
102106
rescue ::Interrupt
103107
raise $!
104108
rescue ::Exception => e
105-
print_error("Local exploit exception (#{mod.refname}): #{e.class} #{e}")
109+
print_error("Local exploit exception (#{mod.refname}): " +
110+
"#{e.class} #{e}")
106111
if(e.class.to_s != 'Msf::OptionValidateError')
107112
print_error("Call stack:")
108113
e.backtrace.each do |line|

0 commit comments

Comments
 (0)