diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 301ca2b5b..ae3dde993 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -76,6 +76,14 @@ RSpec.describe 'BeEF Debug Command Modules:' do # 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 = {} + @debug_mods = @debug_mod_ids.to_a.select { |cmd_mod| cmd_mod[1]['category'] == 'Debug' } + .map do |debug_mod| + @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[0] + end end after(:all) do @@ -84,7 +92,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do end it 'The Test_beef.debug() command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/27?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_beef_debug'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { "msg": "test" }.to_json, :content_type => :json result_data = JSON.parse(response.body) @@ -92,7 +101,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do end it 'The Return ASCII Characters command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/25?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_return_ascii_chars'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { }.to_json, :content_type => :json result_data = JSON.parse(response.body) @@ -100,7 +110,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do end it 'The Return Image command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/22?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_return_image'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { }.to_json, :content_type => :json result_data = JSON.parse(response.body) @@ -109,7 +120,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do it 'The Test HTTP Redirect command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/24?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_http_redirect'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { }.to_json, :content_type => :json result_data = JSON.parse(response.body) @@ -117,7 +129,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do end it 'The Test Returning Results/Long String command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/29?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_return_long_string'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { "repeat": 20, "repeat_string": "beef" }.to_json, :content_type => :json @@ -126,7 +139,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do end it 'The Test Network Request command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/29?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_network_request'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { "scheme": "http", "method": "GET", "domain": "#{ATTACK_DOMAIN}", @@ -142,7 +156,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do end it 'The Test DNS Tunnel command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/26?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_dns_tunnel_client'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { "domain": "example.com", "data": "Lorem ipsum" }.to_json, :content_type => :json @@ -151,7 +166,8 @@ RSpec.describe 'BeEF Debug Command Modules:' do end it 'The Test CORS Request command module successfully executes', :run_on_browserstack => true do - response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/30?token=#{@token}", + cmd_mod_id = debug_mod_names_ids['Test_cors_request'] + response = RestClient.post "#{RESTAPI_MODULES}/#{@session}/#{cmd_mod_id}?token=#{@token}", { "method": "GET", "url": "example.com", "data": { diff --git a/spec/support/osx_chrome.config.yml b/spec/support/osx_chrome.config.yml index ca7353dc1..1ca53fc1d 100644 --- a/spec/support/osx_chrome.config.yml +++ b/spec/support/osx_chrome.config.yml @@ -4,6 +4,7 @@ common_caps: "build": "OSX Chrome" "browserstack.debug": true "name": "BStack Test Run" + "project": "My Project" browser_caps: - diff --git a/spec/support/osx_firefox.config.yml b/spec/support/osx_firefox.config.yml index 18b55dced..5ee0a8436 100644 --- a/spec/support/osx_firefox.config.yml +++ b/spec/support/osx_firefox.config.yml @@ -4,6 +4,7 @@ common_caps: "build": "OSX Firefox" "browserstack.debug": true "name": "BStack Test Run" + "project": "My Project" browser_caps: - diff --git a/spec/support/osx_safari.config.yml b/spec/support/osx_safari.config.yml index 77b257e3c..63186b9bd 100644 --- a/spec/support/osx_safari.config.yml +++ b/spec/support/osx_safari.config.yml @@ -4,6 +4,7 @@ common_caps: "build": "OSX Safari" "browserstack.debug": true "name": "BStack Test Run" + "project": "My Project" browser_caps: - diff --git a/spec/support/windows_chrome.config.yml b/spec/support/windows_chrome.config.yml index 68928def6..13d6be1a3 100644 --- a/spec/support/windows_chrome.config.yml +++ b/spec/support/windows_chrome.config.yml @@ -4,6 +4,7 @@ common_caps: "build": "Windows Chrome" "browserstack.debug": true "name": "BStack Test Run" + "project": "My Project" browser_caps: - diff --git a/spec/support/windows_edge.config.yml b/spec/support/windows_edge.config.yml index 5b79b0049..6842b7dce 100644 --- a/spec/support/windows_edge.config.yml +++ b/spec/support/windows_edge.config.yml @@ -4,6 +4,7 @@ common_caps: "build": "Windows Edge" "browserstack.debug": true "name": "BStack Test Run" + "project": "My Project" browser_caps: - diff --git a/spec/support/windows_firefox.config.yml b/spec/support/windows_firefox.config.yml index 72e7fbb58..76671339e 100644 --- a/spec/support/windows_firefox.config.yml +++ b/spec/support/windows_firefox.config.yml @@ -4,6 +4,7 @@ common_caps: "build": "Windows Firefox" "browserstack.debug": true "name": "BStack Test Run" + "project": "My Project" browser_caps: - diff --git a/spec/support/windows_ie.config.yml b/spec/support/windows_ie.config.yml index 7e51faf10..7b0105f80 100644 --- a/spec/support/windows_ie.config.yml +++ b/spec/support/windows_ie.config.yml @@ -4,6 +4,7 @@ common_caps: "build": "Windows IE" "browserstack.debug": true "name": "BStack Test Run" + "project": "My Project" browser_caps: -