This commit is contained in:
Stephen
2023-10-01 03:02:12 +10:00
7 changed files with 16 additions and 159 deletions

View File

@@ -44,13 +44,17 @@ jobs:
with: with:
ruby-version: 3.0.3 # Not needed with a .ruby-version file ruby-version: 3.0.3 # Not needed with a .ruby-version file
- name: 'Build and run tests' - name: 'Update and Install Dwpendencies'
run: | run: |
sudo apt update sudo apt update
sudo apt install libcurl4 libcurl4-openssl-dev sudo apt install libcurl4 libcurl4-openssl-dev
- name: 'Configure Bundle testing and install gems'
run: |
bundle config unset --local without bundle config unset --local without
bundle config set --local with 'test' 'development' bundle config set --local with 'test' 'development'
bundle install bundle install
- name: 'Run BrowserStack simple verification'
run: |
bundle exec rake browserstack --trace bundle exec rake browserstack --trace
- name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection - name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection

View File

@@ -24,7 +24,7 @@ gem 'espeak-ruby', '~> 1.1.0' # Text-to-Voice
gem 'rake', '~> 13.0' gem 'rake', '~> 13.0'
gem 'otr-activerecord', '~> 2.1', '>= 2.1.2' gem 'otr-activerecord', '~> 2.1', '>= 2.1.2'
gem 'sqlite3', '~> 1.6' gem 'sqlite3', '~> 1.6'
gem 'rubocop', '~> 1.56.3', require: false gem 'rubocop', '~> 1.56.4', require: false
# Geolocation support # Geolocation support
group :geoip do group :geoip do
@@ -79,7 +79,7 @@ group :test do
# selenium-webdriver 3.x is incompatible with Firefox version 48 and prior # 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 'selenium' # Requires old version of selenium which is no longer available
gem 'geckodriver-helper', '~> 0.24.0' 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 # nokogiri is needed by capybara which may require one of the below commands
# sudo apt-get install libxslt-dev libxml2-dev # sudo apt-get install libxslt-dev libxml2-dev

View File

@@ -152,7 +152,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0) rspec-support (~> 3.12.0)
rspec-support (3.12.0) rspec-support (3.12.0)
rubocop (1.56.3) rubocop (1.56.4)
base64 (~> 0.1.1) base64 (~> 0.1.1)
json (~> 2.3) json (~> 2.3)
language_server-protocol (>= 3.17.0) language_server-protocol (>= 3.17.0)
@@ -172,7 +172,7 @@ GEM
rushover (0.3.0) rushover (0.3.0)
json json
rest-client rest-client
selenium-webdriver (4.12.0) selenium-webdriver (4.13.1)
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0) rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0) websocket (~> 1.0)
@@ -223,7 +223,7 @@ GEM
unf_ext (0.0.8.2) unf_ext (0.0.8.2)
unicode-display_width (2.4.2) unicode-display_width (2.4.2)
webrick (1.8.1) webrick (1.8.1)
websocket (1.2.9) websocket (1.2.10)
websocket-client-simple (0.6.1) websocket-client-simple (0.6.1)
event_emitter event_emitter
websocket websocket
@@ -265,10 +265,10 @@ DEPENDENCIES
rdoc (~> 6.5) rdoc (~> 6.5)
rest-client (~> 2.1.0) rest-client (~> 2.1.0)
rspec (~> 3.12) rspec (~> 3.12)
rubocop (~> 1.56.3) rubocop (~> 1.56.4)
rubyzip (~> 2.3) rubyzip (~> 2.3)
rushover (~> 0.3.0) rushover (~> 0.3.0)
selenium-webdriver (~> 4.12) selenium-webdriver (~> 4.13)
sinatra (~> 3.0) sinatra (~> 3.0)
slack-notifier (~> 2.4) slack-notifier (~> 2.4)
sqlite3 (~> 1.6) sqlite3 (~> 1.6)

View File

@@ -84,7 +84,7 @@ RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do
@driver = Selenium::WebDriver.for(:remote, @driver = Selenium::WebDriver.for(:remote,
url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub",
desired_capabilities: @caps) options: @caps)
# Hook new victim # Hook new victim
print_info 'Hooking a new victim, waiting a few seconds...' print_info 'Hooking a new victim, waiting a few seconds...'
wait = Selenium::WebDriver::Wait.new(timeout: 30) # 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 } 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()') @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
end end
@@ -115,15 +105,5 @@ RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do
it 'AutoRunEngine is working' do it 'AutoRunEngine is working' do
expect(@session).not_to be_nil 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
end end

View File

@@ -78,7 +78,7 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do
@driver = Selenium::WebDriver.for(:remote, @driver = Selenium::WebDriver.for(:remote,
url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub",
desired_capabilities: @caps) options: @caps)
# Hook new victim # Hook new victim
print_info 'Hooking a new victim, waiting a few seconds...' print_info 'Hooking a new victim, waiting a few seconds...'
wait = Selenium::WebDriver::Wait.new(timeout: 30) # 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 } 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()') @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
end end
@@ -108,16 +99,6 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do
it 'can successfully hook a browser' do it 'can successfully hook a browser' do
expect(@session).not_to be_nil 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
it 'browser details handler working' do it 'browser details handler working' do
@@ -132,11 +113,5 @@ RSpec.describe 'Browser Details Handler', run_on_browserstack: true do
end end
expect(@driver.browser.to_s.downcase).to eq(browser_name) 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
end end

View File

@@ -74,7 +74,7 @@ RSpec.describe 'Browser hooking with Websockets', run_on_browserstack: true do
@driver = Selenium::WebDriver.for(:remote, @driver = Selenium::WebDriver.for(:remote,
url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub",
desired_capabilities: @caps) options: @caps)
# Hook new victim # Hook new victim
print_info 'Hooking a new victim, waiting a few seconds...' print_info 'Hooking a new victim, waiting a few seconds...'
wait = Selenium::WebDriver::Wait.new(timeout: 30) # 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 } 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') @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
end end
@@ -115,15 +105,5 @@ RSpec.describe 'Browser hooking with Websockets', run_on_browserstack: true do
it 'can successfully hook a browser' do it 'can successfully hook a browser' do
expect(@session).not_to be_nil 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
end end

View File

@@ -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['name'] = self.class.description || ENV['name'] || 'no-name'
@caps['browserstack.local'] = true @caps['browserstack.local'] = true
@caps['browserstack.localIdentifier'] = ENV['BROWSERSTACK_LOCAL_IDENTIFIER'] @caps['browserstack.localIdentifier'] = ENV['BROWSERSTACK_LOCAL_IDENTIFIER']
@driver = Selenium::WebDriver.for(:remote, @driver = Selenium::WebDriver.for(:remote,
url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub",
desired_capabilities: @caps) options: @caps)
# Hook new victim # Hook new victim
print_info 'Hooking a new victim, waiting a few seconds...' print_info 'Hooking a new victim, waiting a few seconds...'
wait = Selenium::WebDriver::Wait.new(timeout: 30) # 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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
it 'The Return ASCII Characters command module successfully executes' do 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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
it 'The Return Image command module successfully executes' do 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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
it 'The Test HTTP Redirect command module successfully executes' do 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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
it 'The Test Returning Results/Long String command module successfully executes' do 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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 end
it 'The Test Network Request command module successfully executes' do 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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
it 'The Test DNS Tunnel command module successfully executes' do 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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
it 'The Test CORS Request command module successfully executes' do 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 content_type: :json
result_data = JSON.parse(response.body) result_data = JSON.parse(response.body)
expect(result_data['success']).to eq 'true' 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
end end