Commit to test new travis.yml
This commit is contained in:
@@ -9,6 +9,10 @@ branches:
|
||||
only:
|
||||
- master
|
||||
- browserstack
|
||||
script:
|
||||
# - bundle exec rake
|
||||
- CONFIG_NAME=windows/windows_chrome_latest.config.yaml bundle exec rspec --tag run_on_browserstack
|
||||
- CONFIG_NAME=osx/osx_safari_latest.config.yaml bundle exec rspec --tag run_on_browserstack
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -89,3 +89,5 @@ source 'https://rubygems.org'
|
||||
|
||||
|
||||
|
||||
|
||||
gem "browserstack-local", "~> 1.3"
|
||||
|
||||
3
Rakefile
3
Rakefile
@@ -20,9 +20,6 @@ end
|
||||
require 'rspec/core/rake_task'
|
||||
RSpec::Core::RakeTask.new(:spec)
|
||||
|
||||
|
||||
|
||||
|
||||
################################
|
||||
# SSL/TLS certificate
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ RSpec.describe 'BeEF API Rate Limit' do
|
||||
# Load BeEF extensions and modules
|
||||
# Always load Extensions, as previous changes to the config from other tests may affect
|
||||
# whether or not this test passes.
|
||||
print_info "Loading in BeEF::Extensions"
|
||||
BeEF::Extensions.load
|
||||
sleep 2
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ RSpec.describe 'AutoRunEngine test' do
|
||||
# Load BeEF extensions and modules
|
||||
# Always load Extensions, as previous changes to the config from other tests may affect
|
||||
# whether or not this test passes.
|
||||
print_info "Loading in BeEF::Extensions"
|
||||
BeEF::Extensions.load
|
||||
sleep 2
|
||||
|
||||
@@ -87,18 +88,26 @@ RSpec.describe 'AutoRunEngine test' do
|
||||
@token = JSON.parse(@response)['token']
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
# Hook new victim
|
||||
print_info 'Hooking a new victim, waiting a few seconds...'
|
||||
@victim = @driver.navigate.to "#{VICTIM_URL}"
|
||||
|
||||
# Give time for browser hook to occur
|
||||
sleep 3
|
||||
|
||||
# Identify Session ID of victim generated above
|
||||
@hooks = RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}"
|
||||
@session = JSON.parse(@hooks)['hooked-browsers']['online']['0']['session']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
print_info "Shutting down server"
|
||||
Process.kill("KILL",@pid)
|
||||
Process.kill("KILL",@pids)
|
||||
end
|
||||
|
||||
it 'AutoRunEngine is working' do
|
||||
print_info 'Hooking a new victim, waiting a few seconds...'
|
||||
victim = BeefTest.new_victim
|
||||
|
||||
sleep 3
|
||||
|
||||
it 'AutoRunEngine is working', :run_on_browserstack => true do
|
||||
response = RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}"
|
||||
result_data = JSON.parse(response)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ RSpec.describe 'Browser details handler' do
|
||||
# Load BeEF extensions and modules
|
||||
# Always load Extensions, as previous changes to the config from other tests may affect
|
||||
# whether or not this test passes.
|
||||
print_info "Loading in BeEF::Extensions"
|
||||
BeEF::Extensions.load
|
||||
sleep 2
|
||||
|
||||
@@ -78,15 +79,19 @@ RSpec.describe 'Browser details handler' do
|
||||
# Authenticate to REST API & pull the token from the response
|
||||
@response = RestClient.post "#{RESTAPI_ADMIN}/login", { 'username': "#{@username}", 'password': "#{@password}" }.to_json, :content_type => :json
|
||||
@token = JSON.parse(@response)['token']
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
# Hook new victim
|
||||
print_info 'Hooking a new victim, waiting a few seconds...'
|
||||
@victim = BeefTest.new_victim
|
||||
@victim = @driver.navigate.to "#{VICTIM_URL}"
|
||||
|
||||
sleep 3
|
||||
# Give time for browser hook to occur
|
||||
sleep 3
|
||||
|
||||
# Identify Session ID of victim generated above
|
||||
@hooks = JSON.parse(RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}")
|
||||
@hooks = RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}"
|
||||
@session = JSON.parse(@hooks)['hooked-browsers']['online']['0']['session']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
@@ -95,18 +100,16 @@ RSpec.describe 'Browser details handler' do
|
||||
Process.kill("KILL",@pids)
|
||||
end
|
||||
|
||||
it 'can successfully hook a browser' do
|
||||
expect(@hooks['hooked-browsers']['online']).not_to be_empty
|
||||
it 'can successfully hook a browser', :run_on_browserstack => true do
|
||||
expect(JSON.parse(@hooks)['hooked-browsers']['online']).not_to be_empty
|
||||
end
|
||||
|
||||
it 'browser details handler working' do
|
||||
session_id = @hooks['hooked-browsers']['online']['0']['session']
|
||||
|
||||
it 'browser details handler working', :run_on_browserstack => true do
|
||||
print_info "Getting browser details"
|
||||
response = RestClient.get "#{RESTAPI_HOOKS}/#{session_id}?token=#{@token}"
|
||||
response = RestClient.get "#{RESTAPI_HOOKS}/#{@session}?token=#{@token}"
|
||||
details = JSON.parse(response.body)
|
||||
|
||||
expect(@victim.driver.browser.browser.to_s.downcase).to eql (details['browser.name.friendly'].downcase)
|
||||
expect(@driver.browser.to_s.downcase).to eql (details['browser.name.friendly'].downcase)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ RSpec.describe 'BeEF Extension Requester' do
|
||||
end
|
||||
|
||||
# default skipped because browser hooking not working properly in travis-CI
|
||||
xit 'requester works' do
|
||||
xit 'requester works', :run_on_browserstack => true do
|
||||
# start beef server
|
||||
|
||||
@config = BeEF::Core::Configuration.instance
|
||||
@@ -63,10 +63,13 @@ RSpec.describe 'BeEF Extension Requester' do
|
||||
response = api.auth()
|
||||
@token = response[:token]
|
||||
puts "authenticated. api token: #{@token}"
|
||||
puts 'hooking a new victim, waiting a few seconds...'
|
||||
victim = BeefTest.new_victim
|
||||
sleep 3
|
||||
|
||||
# Hook new victim
|
||||
print_info 'Hooking a new victim, waiting a few seconds...'
|
||||
victim = @driver.navigate.to "#{VICTIM_URL}"
|
||||
|
||||
# Give time for browser hook to occur
|
||||
sleep 3
|
||||
|
||||
response = RestClient.get "#{RESTAPI_HOOKS}", {:params => {:token => @token}}
|
||||
puts "hooks response: #{response}"
|
||||
|
||||
@@ -19,6 +19,7 @@ RSpec.describe 'BeEF WebSockets enabled' do
|
||||
@username = @config.get('beef.credentials.user')
|
||||
@password = @config.get('beef.credentials.passwd')
|
||||
#load extensions, best practice is to reload as previous tests can potentially cause issues.
|
||||
print_info "Loading in BeEF::Extensions"
|
||||
BeEF::Extensions.load
|
||||
sleep 2
|
||||
if @config.get('beef.module').nil?
|
||||
@@ -53,7 +54,7 @@ RSpec.describe 'BeEF WebSockets enabled' do
|
||||
sleep 1
|
||||
end
|
||||
|
||||
it 'can hook a browser with websockets' do
|
||||
it 'can hook a browser with websockets', :run_on_browserstack => true do
|
||||
#prepare for the HTTP model
|
||||
https = BeEF::Core::Models::Http
|
||||
|
||||
@@ -62,22 +63,20 @@ RSpec.describe 'BeEF WebSockets enabled' do
|
||||
api = BeefRestClient.new('http', ATTACK_DOMAIN, '3000', BEEF_USER, BEEF_PASSWD)
|
||||
response = api.auth()
|
||||
@token = response[:token]
|
||||
puts 'hooking a new victim, waiting a few seconds...'
|
||||
victim = BeefTest.new_victim
|
||||
sleep 2
|
||||
|
||||
# Hook new victim
|
||||
print_info 'Hooking a new victim, waiting a few seconds...'
|
||||
victim = @driver.navigate.to "#{VICTIM_URL}"
|
||||
|
||||
# Give time for browser hook to occur
|
||||
sleep 3
|
||||
|
||||
#Uses the response and hooked browser details to get the response
|
||||
response = RestClient.get "#{RESTAPI_HOOKS}", {:params => {:token => @token}}
|
||||
#test for the response if errors and weirdness there
|
||||
# puts "#{response} from the rest client "
|
||||
hb_details = JSON.parse(response.body)
|
||||
while hb_details["hooked-browsers"]["online"].empty?
|
||||
# get victim session
|
||||
response = RestClient.get "#{RESTAPI_HOOKS}", {:params => {:token => @token}}
|
||||
hb_details = JSON.parse(response.body)
|
||||
puts "json: #{hb_details}"
|
||||
puts "can hook a browser"
|
||||
puts "online hooked browsers empty: #{hb_details["hooked-browsers"]["online"].empty?}"
|
||||
end
|
||||
|
||||
#get the hooked browser details
|
||||
hb_session = hb_details["hooked-browsers"]["online"]["0"]["session"]
|
||||
#show the address of what is being hooked
|
||||
|
||||
@@ -19,7 +19,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do
|
||||
|
||||
# Load BeEF extensions and modules
|
||||
# Always load Extensions, as previous changes to the config from other tests may affect
|
||||
# whether or not this test passes.
|
||||
# whether or not this test passes.
|
||||
print_info "Loading in BeEF::Extensions"
|
||||
BeEF::Extensions.load
|
||||
sleep 2
|
||||
|
||||
@@ -79,16 +80,6 @@ RSpec.describe 'BeEF Debug Command Modules:' do
|
||||
@response = RestClient.post "#{RESTAPI_ADMIN}/login", { 'username': "#{@username}", 'password': "#{@password}" }.to_json, :content_type => :json
|
||||
@token = JSON.parse(@response)['token']
|
||||
|
||||
# Hook new victim
|
||||
print_info 'Hooking a new victim, waiting a few seconds...'
|
||||
@victim = BeefTest.new_victim
|
||||
|
||||
sleep 3
|
||||
|
||||
# Identify Session ID of victim generated above
|
||||
@hooks = RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}"
|
||||
@session = JSON.parse(@hooks)['hooked-browsers']['online']['0']['session']
|
||||
|
||||
# Grab Command Module IDs as they can differ from machine to machine
|
||||
@debug_mod_ids = JSON.parse(RestClient.get "#{RESTAPI_MODULES}?token=#{@token}")
|
||||
@debug_mod_names_ids = {}
|
||||
@@ -98,6 +89,19 @@ RSpec.describe 'BeEF Debug Command Modules:' do
|
||||
end
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
# Hook new victim
|
||||
print_info 'Hooking a new victim, waiting a few seconds...'
|
||||
@victim = @driver.navigate.to "#{VICTIM_URL}"
|
||||
|
||||
# Give time for browser hook to occur
|
||||
sleep 3
|
||||
|
||||
# Identify Session ID of victim generated above
|
||||
@hooks = RestClient.get "#{RESTAPI_HOOKS}?token=#{@token}"
|
||||
@session = JSON.parse(@hooks)['hooked-browsers']['online']['0']['session']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
print_info "Shutting down server"
|
||||
Process.kill("KILL",@pid)
|
||||
|
||||
@@ -36,10 +36,10 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
||||
end
|
||||
|
||||
TASK_ID = (ENV['TASK_ID'] || 0).to_i
|
||||
CONFIG_NAME = ENV['CONFIG_NAME'] || 'windows_chrome'
|
||||
CONFIG = YAML.safe_load(File.read("./spec/support/#{CONFIG_NAME}.config.yml"))
|
||||
CONFIG['user'] = ENV['BROWSERSTACK_USERNAME'] || CONFIG['user']
|
||||
CONFIG['key'] = ENV['BROWSERSTACK_ACCESS_KEY'] || CONFIG['key']
|
||||
CONFIG_FILE = ENV['CONFIG_FILE'] || 'windows/windows_chrome_latest.config.yml'
|
||||
CONFIG = YAML.safe_load(File.read("./spec/support/browserstack/#{CONFIG_FILE}"))
|
||||
CONFIG['user'] = ENV['BROWSERSTACK_USERNAME'] || ''
|
||||
CONFIG['key'] = ENV['BROWSERSTACK_ACCESS_KEY'] || ''
|
||||
|
||||
## DB config
|
||||
ActiveRecord::Base.logger = nil
|
||||
|
||||
@@ -2,9 +2,9 @@ server: "hub-cloud.browserstack.com"
|
||||
|
||||
common_caps:
|
||||
"build": "OSX Chrome"
|
||||
"browserstack.debug": true
|
||||
"name": "BStack Test Run"
|
||||
"project": "My Project"
|
||||
"browserstack.local": true
|
||||
|
||||
browser_caps:
|
||||
-
|
||||
@@ -2,9 +2,9 @@ server: "hub-cloud.browserstack.com"
|
||||
|
||||
common_caps:
|
||||
"build": "OSX Firefox"
|
||||
"browserstack.debug": true
|
||||
"name": "BStack Test Run"
|
||||
"project": "My Project"
|
||||
"browserstack.local": true
|
||||
|
||||
browser_caps:
|
||||
-
|
||||
@@ -2,9 +2,9 @@ server: "hub-cloud.browserstack.com"
|
||||
|
||||
common_caps:
|
||||
"build": "OSX Safari"
|
||||
"browserstack.debug": true
|
||||
"name": "BStack Test Run"
|
||||
"project": "My Project"
|
||||
"browserstack.local": true
|
||||
|
||||
browser_caps:
|
||||
-
|
||||
@@ -2,11 +2,11 @@ server: "hub-cloud.browserstack.com"
|
||||
|
||||
common_caps:
|
||||
"build": "Windows Chrome"
|
||||
"browserstack.debug": true
|
||||
"name": "BStack Test Run"
|
||||
"project": "My Project"
|
||||
"browserstack.local": true
|
||||
|
||||
browser_caps:
|
||||
-
|
||||
"browser": "chrome"
|
||||
"os": "Windows"
|
||||
"os": "windows"
|
||||
@@ -2,9 +2,9 @@ server: "hub-cloud.browserstack.com"
|
||||
|
||||
common_caps:
|
||||
"build": "Windows Edge"
|
||||
"browserstack.debug": true
|
||||
"name": "BStack Test Run"
|
||||
"project": "My Project"
|
||||
"browserstack.local": true
|
||||
|
||||
browser_caps:
|
||||
-
|
||||
@@ -2,9 +2,9 @@ server: "hub-cloud.browserstack.com"
|
||||
|
||||
common_caps:
|
||||
"build": "Windows Firefox"
|
||||
"browserstack.debug": true
|
||||
"name": "BStack Test Run"
|
||||
"project": "My Project"
|
||||
"browserstack.local": true
|
||||
|
||||
browser_caps:
|
||||
-
|
||||
@@ -2,9 +2,9 @@ server: "hub-cloud.browserstack.com"
|
||||
|
||||
common_caps:
|
||||
"build": "Windows IE"
|
||||
"browserstack.debug": true
|
||||
"name": "BStack Test Run"
|
||||
"project": "My Project"
|
||||
"browserstack.local": true
|
||||
|
||||
browser_caps:
|
||||
-
|
||||
Reference in New Issue
Block a user