Took an easier route of acquiring the Auth token

This commit is contained in:
Jack Walker
2020-04-23 12:10:17 +10:00
parent a4f06bbaac
commit 07037587e8
4 changed files with 12 additions and 16 deletions

View File

@@ -70,7 +70,7 @@ RSpec.describe 'AutoRunEngine test', :run_on_browserstack => true do
http_hook_server.prepare
# Generate a token for the server to respond with
BeEF::Core::Crypto::api_token
@token = BeEF::Core::Crypto::api_token
# Initiate server start-up
@pids = fork do
@@ -81,8 +81,8 @@ RSpec.describe 'AutoRunEngine test', :run_on_browserstack => true do
end
# 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']
# @response = RestClient.post "#{RESTAPI_ADMIN}/login", { 'username': "#{@username}", 'password': "#{@password}" }.to_json, :content_type => :json
# @token = JSON.parse(@response)['token']
@caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID])
@caps["name"] = @caps['name'] || ENV['name'] || 'no-name'

View File

@@ -63,7 +63,7 @@ RSpec.describe 'Browser details handler', :run_on_browserstack => true do
http_hook_server.prepare
# Generate a token for the server to respond with
BeEF::Core::Crypto::api_token
@token = BeEF::Core::Crypto::api_token
# Initiate server start-up
@pids = fork do
@@ -77,8 +77,8 @@ RSpec.describe 'Browser details handler', :run_on_browserstack => true do
sleep 1
# 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']
# @response = RestClient.post "#{RESTAPI_ADMIN}/login", { 'username': "#{@username}", 'password': "#{@password}" }.to_json, :content_type => :json
# @token = JSON.parse(@response)['token']
@caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID])
@caps["name"] = @caps['name'] || ENV['name'] || 'no-name'

View File

@@ -28,7 +28,7 @@ RSpec.describe 'BeEF WebSockets enabled', :run_on_browserstack => true do
sleep 2
end
#generate token for the api to use
BeEF::Core::Crypto::api_token
@token= BeEF::Core::Crypto::api_token
# load up DB
# Connect to DB
ActiveRecord::Base.logger = nil
@@ -55,8 +55,8 @@ RSpec.describe 'BeEF WebSockets enabled', :run_on_browserstack => true 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']
# @response = RestClient.post "#{RESTAPI_ADMIN}/login", { 'username': "#{@username}", 'password': "#{@password}" }.to_json, :content_type => :json
# @token = JSON.parse(@response)['token']
@caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID])
@caps["name"] = @caps['name'] || ENV['name'] || 'no-name'
@@ -104,10 +104,6 @@ RSpec.describe 'BeEF WebSockets enabled', :run_on_browserstack => true do
### hook a new victim, use rest API to send request and get the token and victim
api = BeefRestClient.new('http', ATTACK_DOMAIN, '3000', BEEF_USER, BEEF_PASSWD)
response = api.auth()
@token = response[:token]
#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

View File

@@ -63,7 +63,7 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do
http_hook_server.prepare
# Generate a token for the server to respond with
BeEF::Core::Crypto::api_token
@token = BeEF::Core::Crypto::api_token
# Initiate server start-up
@pids = fork do
@@ -77,8 +77,8 @@ RSpec.describe 'BeEF Debug Command Modules:', :run_on_browserstack => true do
sleep 1
# 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']
# @response = RestClient.post "#{RESTAPI_ADMIN}/login", { 'username': "#{@username}", 'password': "#{@password}" }.to_json, :content_type => :json
# @token = JSON.parse(@response)['token']
@caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID])
@caps["name"] = @caps['name'] || ENV['name'] || 'no-name'