diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index de0ba7a17..e08d574ce 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -44,13 +44,17 @@ jobs: with: ruby-version: 3.0.3 # Not needed with a .ruby-version file - - name: 'Build and run tests' + - name: 'Update and Install Dwpendencies' run: | sudo apt update sudo apt install libcurl4 libcurl4-openssl-dev + - name: 'Configure Bundle testing and install gems' + run: | bundle config unset --local without bundle config set --local with 'test' 'development' bundle install + - name: 'Run BrowserStack simple verification' + run: | bundle exec rake browserstack --trace - name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection diff --git a/Gemfile b/Gemfile index ac82d2671..6b9262226 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem 'espeak-ruby', '~> 1.1.0' # Text-to-Voice gem 'rake', '~> 13.0' gem 'otr-activerecord', '~> 2.1', '>= 2.1.2' gem 'sqlite3', '~> 1.6' -gem 'rubocop', '~> 1.56.3', require: false +gem 'rubocop', '~> 1.56.4', require: false # Geolocation support group :geoip do @@ -79,7 +79,7 @@ group :test do # selenium-webdriver 3.x is incompatible with Firefox version 48 and prior # gem 'selenium' # Requires old version of selenium which is no longer available gem 'geckodriver-helper', '~> 0.24.0' - gem 'selenium-webdriver', '~> 4.12' + gem 'selenium-webdriver', '~> 4.13' # nokogiri is needed by capybara which may require one of the below commands # sudo apt-get install libxslt-dev libxml2-dev diff --git a/Gemfile.lock b/Gemfile.lock index 3f06f1dc8..5bd381661 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -152,7 +152,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.0) - rubocop (1.56.3) + rubocop (1.56.4) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -172,7 +172,7 @@ GEM rushover (0.3.0) json rest-client - selenium-webdriver (4.12.0) + selenium-webdriver (4.13.1) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -223,7 +223,7 @@ GEM unf_ext (0.0.8.2) unicode-display_width (2.4.2) webrick (1.8.1) - websocket (1.2.9) + websocket (1.2.10) websocket-client-simple (0.6.1) event_emitter websocket @@ -265,10 +265,10 @@ DEPENDENCIES rdoc (~> 6.5) rest-client (~> 2.1.0) rspec (~> 3.12) - rubocop (~> 1.56.3) + rubocop (~> 1.56.4) rubyzip (~> 2.3) rushover (~> 0.3.0) - selenium-webdriver (~> 4.12) + selenium-webdriver (~> 4.13) sinatra (~> 3.0) slack-notifier (~> 2.4) sqlite3 (~> 1.6) 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 a4634abdb..425f8e50c 100644 --- a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb +++ b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb @@ -84,7 +84,7 @@ RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do @driver = Selenium::WebDriver.for(:remote, url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", - desired_capabilities: @caps) + options: @caps) # Hook new victim print_info 'Hooking a new victim, waiting a few seconds...' wait = Selenium::WebDriver::Wait.new(timeout: 30) # seconds @@ -96,16 +96,6 @@ RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do sleep 1 until wait.until { @driver.execute_script('return window.beef.session.get_hook_session_id().length') > 0 } @session = @driver.execute_script('return window.beef.session.get_hook_session_id()') - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end end @@ -115,15 +105,5 @@ RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do it 'AutoRunEngine is working' do expect(@session).not_to be_nil - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script('return window.beef.session.get_hook_session_id()'))).to eq true - end end end 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 23c523326..d516f861a 100644 --- a/spec/beef/core/main/handlers/browser_details_handler_spec.rb +++ b/spec/beef/core/main/handlers/browser_details_handler_spec.rb @@ -78,7 +78,7 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do @driver = Selenium::WebDriver.for(:remote, url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", - desired_capabilities: @caps) + options: @caps) # Hook new victim print_info 'Hooking a new victim, waiting a few seconds...' wait = Selenium::WebDriver::Wait.new(timeout: 30) # seconds @@ -90,15 +90,6 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do sleep 1 until wait.until { @driver.execute_script('return window.beef.session.get_hook_session_id().length') > 0 } @session = @driver.execute_script('return window.beef.session.get_hook_session_id()') - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end end @@ -108,16 +99,6 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do it 'can successfully hook a browser' do expect(@session).not_to be_nil - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script('return window.beef.session.get_hook_session_id()'))).to eq true - end end it 'browser details handler working' do @@ -132,11 +113,5 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do end expect(@driver.browser.to_s.downcase).to eq(browser_name) - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace.each { |stack| puts stack }}" - exit 0 end end diff --git a/spec/beef/extensions/websocket_hooked_browser_spec.rb b/spec/beef/extensions/websocket_hooked_browser_spec.rb index c752fa31a..54955f364 100644 --- a/spec/beef/extensions/websocket_hooked_browser_spec.rb +++ b/spec/beef/extensions/websocket_hooked_browser_spec.rb @@ -74,7 +74,7 @@ RSpec.describe 'Browser hooking with Websockets', run_on_browserstack: true do @driver = Selenium::WebDriver.for(:remote, url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", - desired_capabilities: @caps) + options: @caps) # Hook new victim print_info 'Hooking a new victim, waiting a few seconds...' wait = Selenium::WebDriver::Wait.new(timeout: 30) # seconds @@ -86,16 +86,6 @@ RSpec.describe 'Browser hooking with Websockets', run_on_browserstack: true do sleep 1 until wait.until { @driver.execute_script('return window.beef.session.get_hook_session_id().length') > 0 } @session = @driver.execute_script('return window.beef.session.get_hook_session_id().length') - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end end @@ -115,15 +105,5 @@ RSpec.describe 'Browser hooking with Websockets', run_on_browserstack: true do it 'can successfully hook a browser' do expect(@session).not_to be_nil - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.stacktrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - expect(BeEF::Filters.is_valid_hook_session_id?(@driver.execute_script('return window.beef.session.get_hook_session_id()'))).to eq true - end 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 4283cc9eb..7ebf45c89 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -72,10 +72,9 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do @caps['name'] = self.class.description || ENV['name'] || 'no-name' @caps['browserstack.local'] = true @caps['browserstack.localIdentifier'] = ENV['BROWSERSTACK_LOCAL_IDENTIFIER'] - @driver = Selenium::WebDriver.for(:remote, url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", - desired_capabilities: @caps) + options: @caps) # Hook new victim print_info 'Hooking a new victim, waiting a few seconds...' wait = Selenium::WebDriver::Wait.new(timeout: 30) # seconds @@ -119,16 +118,6 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end it 'The Return ASCII Characters command module successfully executes' do @@ -138,16 +127,6 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end it 'The Return Image command module successfully executes' do @@ -157,16 +136,6 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end it 'The Test HTTP Redirect command module successfully executes' do @@ -176,16 +145,6 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end it 'The Test Returning Results/Long String command module successfully executes' do @@ -196,17 +155,6 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - print_info "Exception Message: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end it 'The Test Network Request command module successfully executes' do @@ -224,16 +172,6 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end it 'The Test DNS Tunnel command module successfully executes' do @@ -244,16 +182,6 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end it 'The Test CORS Request command module successfully executes' do @@ -267,15 +195,5 @@ RSpec.describe 'BeEF Debug Command Modules:', run_on_browserstack: true do content_type: :json result_data = JSON.parse(response.body) expect(result_data['success']).to eq 'true' - rescue StandardError => e - print_info "Exception: #{e}" - print_info "Exception Class: #{e.class}" - print_info "Exception Message: #{e.message}" - print_info "Exception Stack Trace: #{e.backtrace}" - if @driver.execute_script('return window.beef.session.get_hook_session_id().length').nil? - exit 1 - else - exit 0 - end end end