From 878e235e0b4354c78199e7b77cc41331ec51d2c9 Mon Sep 17 00:00:00 2001 From: Jack Walker Date: Tue, 12 May 2020 09:52:12 +1000 Subject: [PATCH] Broadened timeout exception handling. --- .../main/autorun_engine/autorun_engine_spec.rb | 2 +- .../handlers/browser_details_handler_spec.rb | 2 +- .../extensions/websocket_hooked_browser_spec.rb | 2 +- spec/beef/modules/debug/test_beef_debugs_spec.rb | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb index 3da4e5665..f925484ea 100644 --- a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb +++ b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb @@ -135,7 +135,7 @@ RSpec.describe 'AutoRunEngine Test', :run_on_browserstack => true do expect(@hooks['hooked-browsers']['online']).not_to be_empty end rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') diff --git a/spec/beef/core/main/handlers/browser_details_handler_spec.rb b/spec/beef/core/main/handlers/browser_details_handler_spec.rb index bf33fefbe..5b448bf31 100644 --- a/spec/beef/core/main/handlers/browser_details_handler_spec.rb +++ b/spec/beef/core/main/handlers/browser_details_handler_spec.rb @@ -132,7 +132,7 @@ RSpec.describe 'Browser Details Handler', :run_on_browserstack => true do expect(@hooks['hooked-browsers']['online']).not_to be_empty end rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') diff --git a/spec/beef/extensions/websocket_hooked_browser_spec.rb b/spec/beef/extensions/websocket_hooked_browser_spec.rb index 538d48a15..1ddadd8dc 100644 --- a/spec/beef/extensions/websocket_hooked_browser_spec.rb +++ b/spec/beef/extensions/websocket_hooked_browser_spec.rb @@ -131,7 +131,7 @@ RSpec.describe 'Browser hooking with Websockets', :run_on_browserstack => true d expect(@hooks['hooked-browsers']['online']).not_to be_empty end rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 706f9adf4..fbff3eb00 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -140,7 +140,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') @@ -163,7 +163,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') @@ -186,7 +186,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') @@ -210,7 +210,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') @@ -234,7 +234,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') @@ -265,7 +265,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') @@ -289,7 +289,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') @@ -316,7 +316,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do result_data = JSON.parse(response.body) expect(result_data['success']).to eq "true" rescue => exception - if exception.include?('Errno::ETIMEDOUT:') + if exception.include?('ETIMEDOUT') print_info "Encountered possible false negative timeout error checking exception." expect(exception).to include('Failed to open TCP connection to hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized')