@@ -52,7 +52,8 @@ def execute_file
52
52
end
53
53
54
54
#
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+
56
57
#
57
58
# Will search the script path.
58
59
#
@@ -81,13 +82,16 @@ def execute_script(script_name, *args)
81
82
if mod . exploit_type == "local"
82
83
# get a copy of the session exploit's datastore if we can
83
84
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
85
86
# we don't want to inherit a couple things, like AutoRunScript's
86
87
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
88
91
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
91
95
local_exploit_opts = copy_of_orig_exploit_datastore . merge ( opts )
92
96
93
97
# try to run this local exploit, which is likely to be exception prone
@@ -102,7 +106,8 @@ def execute_script(script_name, *args)
102
106
rescue ::Interrupt
103
107
raise $!
104
108
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 } " )
106
111
if ( e . class . to_s != 'Msf::OptionValidateError' )
107
112
print_error ( "Call stack:" )
108
113
e . backtrace . each do |line |
0 commit comments