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 f925484ea..da2672add 100644 --- a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb +++ b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb @@ -104,8 +104,9 @@ RSpec.describe 'AutoRunEngine Test', :run_on_browserstack => true do @hooks = JSON.parse(@hook_request) if @hooks['hooked-browsers']['online'].empty? @session = @hooks['hooked-browsers']['online']['0']['session'] - els e - print_info "Cannot find online session server-side continuing to grab Session ID from client" + else + print_info "Cannot find online session server-side" + print_info "Continuing to grab Session ID from client" @session = @driver.execute_script("return window.beef.session.get_hook_session_id()") end rescue => exception @@ -135,9 +136,9 @@ RSpec.describe 'AutoRunEngine Test', :run_on_browserstack => true do expect(@hooks['hooked-browsers']['online']).not_to be_empty end rescue => exception - 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') + if exception.include?('Failed to open TCP connection') + print_info "Encountered possible false negative timeout error. Checking exception." + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) 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 5b448bf31..f6ce82fca 100644 --- a/spec/beef/core/main/handlers/browser_details_handler_spec.rb +++ b/spec/beef/core/main/handlers/browser_details_handler_spec.rb @@ -102,7 +102,8 @@ RSpec.describe 'Browser Details Handler', :run_on_browserstack => true do if @hooks['hooked-browsers']['online'].empty? @session = @hooks['hooked-browsers']['online']['0']['session'] else - print_info "Cannot find online session server-side continuing to grab Session ID from client" + print_info "Cannot find online session server-side." + print_info "Continuing to grab Session ID from client." @session = @driver.execute_script("return window.beef.session.get_hook_session_id()") end rescue => exception @@ -132,9 +133,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) diff --git a/spec/beef/extensions/websocket_hooked_browser_spec.rb b/spec/beef/extensions/websocket_hooked_browser_spec.rb index 1ddadd8dc..58a7ce33f 100644 --- a/spec/beef/extensions/websocket_hooked_browser_spec.rb +++ b/spec/beef/extensions/websocket_hooked_browser_spec.rb @@ -91,7 +91,8 @@ RSpec.describe 'Browser hooking with Websockets', :run_on_browserstack => true d if @hooks['hooked-browsers']['online'].empty? @session = @hooks['hooked-browsers']['online']['0']['session'] else - print_info "Cannot find online session server-side continuing to grab Session ID from client" + print_info "Cannot find online session server-side." + print_info "Continuing to grab Session ID from client" @session = @driver.execute_script("return window.beef.session.get_hook_session_id()") end rescue => exception @@ -131,15 +132,15 @@ 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?('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') + if exception.include?('Failed to open TCP connection') + print_info "Encountered possible false negative BrowserStack timeout error. Checking exception." + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) else print_info "Encountered Exception: #{exception}" - print_info "Issue retrieving hooked browser information - checking instead that client session ID exists" + print_info "Issue retrieving hooked browser information. Checking instead that client session ID exists" expect(@session).not_to be_empty end end diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index fbff3eb00..90da8d0d6 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -101,7 +101,8 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do if @hooks['hooked-browsers']['online'].empty? @session = @hooks['hooked-browsers']['online']['0']['session'] else - print_info "Cannot find online session server-side continuing to grab Session ID from client" + print_info "Cannot find online session server-side." + print_info "Continuing to grab Session ID from client." @session = @driver.execute_script("return window.beef.session.get_hook_session_id()") end rescue => exception @@ -140,9 +141,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) @@ -163,9 +164,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) @@ -186,9 +187,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) @@ -210,9 +211,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) @@ -234,9 +235,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) @@ -265,9 +266,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401) @@ -289,9 +290,9 @@ 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?('ETIMEDOUT') + if exception.include?('Failed to open TCP connection') 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') + expect(exception).to include('hub-cloud.browserstack.com:80') elsif exception.include?('401 Unauthorized') print_info "Encountered possible false negative un-auth exception due to a failed hook." expect(@hook_request.code).to eq (401)