@@ -65,7 +65,8 @@ def execute_script(script_name, *args)
65
65
opts = { 'SESSION' => self . sid }
66
66
args . each do |arg |
67
67
k , v = arg . split ( "=" , 2 )
68
- opts [ k ] = v
68
+ # case doesn't matter in datastore, but it does in hashes, let's normalize
69
+ opts [ k . downcase ] = v
69
70
end
70
71
if mod . type == "post"
71
72
mod . run_simple (
@@ -83,22 +84,35 @@ def execute_script(script_name, *args)
83
84
# get a copy of the session exploit's datastore if we can
84
85
original_exploit_datastore = self . exploit . datastore || { }
85
86
copy_of_orig_exploit_datastore = original_exploit_datastore . clone
87
+ # convert datastore opts to a hash to normalize casing issues
88
+ local_exploit_opts = { }
89
+ copy_of_orig_exploit_datastore . each do |k , v |
90
+ local_exploit_opts [ k . downcase ] = v
91
+ end
86
92
# we don't want to inherit a couple things, like AutoRunScript's
87
93
to_neuter = %w{ AutoRunScript InitialAutoRunScript LPORT TARGET }
88
94
to_neuter . each do |setting |
89
- copy_of_orig_exploit_datastore . delete ( setting )
95
+ local_exploit_opts . delete ( setting . downcase )
90
96
end
91
97
92
98
# merge in any opts that were passed in, defaulting all other settings
93
99
# to the values from the datastore (of the exploit) that spawned the
94
100
# session
95
- local_exploit_opts = copy_of_orig_exploit_datastore . merge ( opts )
101
+ print_debug "local_exploit_opts"
102
+ print_error local_exploit_opts . inspect
103
+ print_error "lport:#{ local_exploit_opts [ 'lport' ] } ,LPORT:#{ local_exploit_opts [ 'LPORT' ] } "
104
+ print_error "payload:#{ local_exploit_opts [ 'payload' ] } ,PAYLOAD:#{ local_exploit_opts [ 'PAYLOAD' ] } "
105
+ local_exploit_opts = local_exploit_opts . merge ( opts )
106
+ print_error "after merge"
107
+ print_error local_exploit_opts . inspect
108
+ print_error "lport:#{ local_exploit_opts [ 'lport' ] } ,LPORT:#{ local_exploit_opts [ 'LPORT' ] } "
109
+ print_error "payload:#{ local_exploit_opts [ 'payload' ] } ,PAYLOAD:#{ local_exploit_opts [ 'PAYLOAD' ] } "
96
110
97
111
# try to run this local exploit, which is likely to be exception prone
98
112
begin
99
113
new_session = mod . exploit_simple (
100
- 'Payload' => local_exploit_opts [ 'PAYLOAD' ] ,
101
- 'Target' => local_exploit_opts [ 'TARGET' ] ,
114
+ 'Payload' => local_exploit_opts . delete ( 'payload' ) ,
115
+ 'Target' => local_exploit_opts . delete ( 'target' ) ,
102
116
'LocalInput' => self . user_input ,
103
117
'LocalOutput' => self . user_output ,
104
118
'Options' => local_exploit_opts
0 commit comments