From b76001692324eb13c482f110c3b1d835d7622aa6 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Thu, 24 Oct 2024 15:14:46 +1000 Subject: [PATCH 01/23] Test Browserstack credentials --- .github/workflows/github_actions.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index f0c01959c6..08dd408f4c 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -27,6 +27,10 @@ jobs: username: ${{ secrets.BROWSERSTACK_USERNAME }} access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + - name: Test BrowserStack credentials + run: | + curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" https://api.browserstack.com/automate/plan.json + - name: 'BrowserStack Local Tunnel Setup' # Invokes the setup-local action uses: browserstack/github-actions/setup-local@master with: From ac110a3c530baabea0e01a881077a34ef92eae78 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Thu, 24 Oct 2024 15:29:35 +1000 Subject: [PATCH 02/23] Test browserstack creds --- .github/workflows/github_actions.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 08dd408f4c..98791b2473 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -5,6 +5,13 @@ on: branches: [ master ] jobs: + test-browserstacks-creds: + runs-on: ubuntu-latest + steps: + - name: Test BrowserStack credentials + run: | + curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" https://api.browserstack.com/automate/plan.json + approve: runs-on: ubuntu-latest From 37cca9b2a225679d02890fa3f990118fd08c3478 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Thu, 24 Oct 2024 15:40:00 +1000 Subject: [PATCH 03/23] Testing --- .github/workflows/browserstack_troubleshoot.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/browserstack_troubleshoot.yml diff --git a/.github/workflows/browserstack_troubleshoot.yml b/.github/workflows/browserstack_troubleshoot.yml new file mode 100644 index 0000000000..14c3d0cb52 --- /dev/null +++ b/.github/workflows/browserstack_troubleshoot.yml @@ -0,0 +1,13 @@ +name: 'BrowserStack Credentials Check' + +on: + pull_request: + branches: [ master ] + +jobs: + test-browserstack-creds: + runs-on: ubuntu-latest + steps: + - name: Test BrowserStack credentials + run: | + curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" https://api.browserstack.com/automate/plan.json \ No newline at end of file From 42dcac8d9c85b1eddcbed414360f46c88f2ed495 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Thu, 24 Oct 2024 15:45:15 +1000 Subject: [PATCH 04/23] Testing --- .github/workflows/browserstack_troubleshoot.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/browserstack_troubleshoot.yml b/.github/workflows/browserstack_troubleshoot.yml index 14c3d0cb52..a7ed590ac1 100644 --- a/.github/workflows/browserstack_troubleshoot.yml +++ b/.github/workflows/browserstack_troubleshoot.yml @@ -9,5 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Test BrowserStack credentials + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} run: | - curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" https://api.browserstack.com/automate/plan.json \ No newline at end of file + curl -u "${BROWSERSTACK_USERNAME}:${BROWSERSTACK_ACCESS_KEY}" https://api.browserstack.com/automate/plan.json \ No newline at end of file From 1b17d3c0678439eba20e63487e50584ae64e82d2 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Fri, 25 Oct 2024 15:42:29 +1000 Subject: [PATCH 05/23] Remove testing bits and fix issue with activerecord breaking change --- .github/workflows/browserstack_troubleshoot.yml | 16 ---------------- .github/workflows/github_actions.yml | 11 ----------- Gemfile | 1 + Gemfile.lock | 13 +++++++------ .../main/autorun_engine/autorun_engine_spec.rb | 2 +- .../handlers/browser_details_handler_spec.rb | 4 ++-- spec/beef/extensions/requester_spec.rb | 2 +- .../extensions/websocket_hooked_browser_spec.rb | 2 +- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 +- 9 files changed, 14 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/browserstack_troubleshoot.yml diff --git a/.github/workflows/browserstack_troubleshoot.yml b/.github/workflows/browserstack_troubleshoot.yml deleted file mode 100644 index a7ed590ac1..0000000000 --- a/.github/workflows/browserstack_troubleshoot.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'BrowserStack Credentials Check' - -on: - pull_request: - branches: [ master ] - -jobs: - test-browserstack-creds: - runs-on: ubuntu-latest - steps: - - name: Test BrowserStack credentials - env: - BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} - BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - run: | - curl -u "${BROWSERSTACK_USERNAME}:${BROWSERSTACK_ACCESS_KEY}" https://api.browserstack.com/automate/plan.json \ No newline at end of file diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 98791b2473..f0c01959c6 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -5,13 +5,6 @@ on: branches: [ master ] jobs: - test-browserstacks-creds: - runs-on: ubuntu-latest - steps: - - name: Test BrowserStack credentials - run: | - curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" https://api.browserstack.com/automate/plan.json - approve: runs-on: ubuntu-latest @@ -34,10 +27,6 @@ jobs: username: ${{ secrets.BROWSERSTACK_USERNAME }} access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - - name: Test BrowserStack credentials - run: | - curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" https://api.browserstack.com/automate/plan.json - - name: 'BrowserStack Local Tunnel Setup' # Invokes the setup-local action uses: browserstack/github-actions/setup-local@master with: diff --git a/Gemfile b/Gemfile index 76355a0586..c8f2fc27e6 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,7 @@ gem 'term-ansicolor', :require => 'term/ansicolor' gem 'rubyzip', '~> 2.3' gem 'espeak-ruby', '~> 1.1.0' # Text-to-Voice gem 'rake', '~> 13.2' +gem 'activerecord', '~> 7.0' gem 'otr-activerecord', '~> 2.2.0' gem 'sqlite3', '~> 1.4' gem 'rubocop', '~> 1.66.1', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 6f3e432b35..5f3d09c99a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,13 @@ GEM remote: https://rubygems.org/ specs: - activemodel (7.1.4) - activesupport (= 7.1.4) - activerecord (7.1.4) - activemodel (= 7.1.4) - activesupport (= 7.1.4) + activemodel (7.1.4.2) + activesupport (= 7.1.4.2) + activerecord (7.1.4.2) + activemodel (= 7.1.4.2) + activesupport (= 7.1.4.2) timeout (>= 0.4.0) - activesupport (7.1.4) + activesupport (7.1.4.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -268,6 +268,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + activerecord (~> 7.0) ansi (~> 1.5) async (~> 1.32) async-dns (~> 1.3) 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 5d4d997899..f5b621c8c0 100644 --- a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb +++ b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb @@ -50,7 +50,7 @@ OTR::ActiveRecord.establish_connection! end context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! 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 cc172e8719..f47deec091 100644 --- a/spec/beef/core/main/handlers/browser_details_handler_spec.rb +++ b/spec/beef/core/main/handlers/browser_details_handler_spec.rb @@ -48,9 +48,9 @@ if Gem.loaded_specs['otr-activerecord'].version > Gem::Version.create('1.4.2') OTR::ActiveRecord.establish_connection! end - context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + context = ActiveRecord::Migration.new.migration_context + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! # Spawn HTTP Server diff --git a/spec/beef/extensions/requester_spec.rb b/spec/beef/extensions/requester_spec.rb index 6a92982241..4f4d7e929f 100644 --- a/spec/beef/extensions/requester_spec.rb +++ b/spec/beef/extensions/requester_spec.rb @@ -40,7 +40,7 @@ # Migrate if required context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? # Start HTTP hook server http_hook_server = BeEF::Core::Server.instance diff --git a/spec/beef/extensions/websocket_hooked_browser_spec.rb b/spec/beef/extensions/websocket_hooked_browser_spec.rb index 774cf1447b..7abd8d97c7 100644 --- a/spec/beef/extensions/websocket_hooked_browser_spec.rb +++ b/spec/beef/extensions/websocket_hooked_browser_spec.rb @@ -49,7 +49,7 @@ OTR::ActiveRecord.establish_connection! end context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! # Spawn HTTP Server print_info 'Starting HTTP Hook Server' diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index b1e7fce947..79543a5d91 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -47,7 +47,7 @@ OTR::ActiveRecord.establish_connection! end context = ActiveRecord::Migration.new.migration_context - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate if context.needs_migration? + ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate if context.needs_migration? BeEF::Core::Migration.instance.update_db! From 590c32e66dd352c9297be3a5a70a34b12c53bf9c Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:03:24 +1000 Subject: [PATCH 06/23] Troubleshoot issue with test --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 79543a5d91..8ecb541b08 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -89,6 +89,10 @@ # Grab Command Module IDs as they can differ from machine to machine @debug_mod_ids = JSON.parse(RestClient.get("#{RESTAPI_MODULES}?token=#{@token}")) + + puts "Full API response:" + p @debug_mod_ids + @debug_mod_names_ids = {} @debug_mods = @debug_mod_ids.to_a.select { |cmd_mod| cmd_mod[1]['category'] == 'Debug' } .map do |debug_mod| From 21bb951586cc806d796f574583e193a6b7957a11 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:13:37 +1000 Subject: [PATCH 07/23] Add graceful error handling for format inconsistency --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 8ecb541b08..4b95ebe2f3 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -94,10 +94,12 @@ p @debug_mod_ids @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[1]['id'] - end + @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| + category = Array(cmd_mod[1]['category']) # Ensure category is always an array + category.include?('Debug') + end.map do |debug_mod| + @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] + end rescue StandardError => e print_info "Exception: #{e}" print_info "Exception Class: #{e.class}" From 740d056142d290745de874ccb2d5e086884de771 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:27:01 +1000 Subject: [PATCH 08/23] Fix another data handling issue --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 4b95ebe2f3..e4a51cd283 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -90,15 +90,17 @@ # Grab Command Module IDs as they can differ from machine to machine @debug_mod_ids = JSON.parse(RestClient.get("#{RESTAPI_MODULES}?token=#{@token}")) - puts "Full API response:" - p @debug_mod_ids - @debug_mod_names_ids = {} @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| category = Array(cmd_mod[1]['category']) # Ensure category is always an array category.include?('Debug') end.map do |debug_mod| - @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] + # Only process if debug_mod[1] exists and has the expected keys + if debug_mod[1] && debug_mod[1].key?('class') && debug_mod[1].key?('id') + @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] + else + puts "Warning: Incomplete data found for debug_mod: #{debug_mod.inspect}" + end end rescue StandardError => e print_info "Exception: #{e}" From 1cd9d0d8adc83b06498f4a4dc178c468f639d177 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:32:51 +1000 Subject: [PATCH 09/23] Fix another data handling issue --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index e4a51cd283..bdc5a701da 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -89,18 +89,12 @@ # 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 do |cmd_mod| category = Array(cmd_mod[1]['category']) # Ensure category is always an array category.include?('Debug') end.map do |debug_mod| - # Only process if debug_mod[1] exists and has the expected keys - if debug_mod[1] && debug_mod[1].key?('class') && debug_mod[1].key?('id') - @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] - else - puts "Warning: Incomplete data found for debug_mod: #{debug_mod.inspect}" - end + @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] end rescue StandardError => e print_info "Exception: #{e}" From f816eb50b9ff833c8d44c0a320550cdd75aaa630 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:37:46 +1000 Subject: [PATCH 10/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index bdc5a701da..1389dad51f 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -91,6 +91,8 @@ @debug_mod_ids = JSON.parse(RestClient.get("#{RESTAPI_MODULES}?token=#{@token}")) @debug_mod_names_ids = {} @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| + puts "cmd_mod:" + p cmd_mod category = Array(cmd_mod[1]['category']) # Ensure category is always an array category.include?('Debug') end.map do |debug_mod| From 050e014e4c4cec9e51a16c9a30950d8cb6b2ccde Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:41:50 +1000 Subject: [PATCH 11/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 1389dad51f..bc7799e454 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -92,7 +92,7 @@ @debug_mod_names_ids = {} @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| puts "cmd_mod:" - p cmd_mod + p cmd_mod[1] category = Array(cmd_mod[1]['category']) # Ensure category is always an array category.include?('Debug') end.map do |debug_mod| From b230e5a4c8b60ab46008dd86fc689a53a2ef5474 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:48:56 +1000 Subject: [PATCH 12/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index bc7799e454..3f41732ce9 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -92,8 +92,8 @@ @debug_mod_names_ids = {} @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| puts "cmd_mod:" - p cmd_mod[1] - category = Array(cmd_mod[1]['category']) # Ensure category is always an array + p cmd_mod + category = Array(cmd_mod[1]&.dig('category')) # Ensure category is always an array category.include?('Debug') end.map do |debug_mod| @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] From dca1636261a190cce18dabee39a2975b73b206bc Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 16:55:21 +1000 Subject: [PATCH 13/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 3f41732ce9..c30145b3e9 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -95,6 +95,7 @@ p cmd_mod category = Array(cmd_mod[1]&.dig('category')) # Ensure category is always an array category.include?('Debug') + p category.include?('Debug') end.map do |debug_mod| @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] end From 1fb094c545d0192f38dcdcc4573a447db86e090b Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 18:36:08 +1000 Subject: [PATCH 14/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index c30145b3e9..456924d75d 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -94,6 +94,7 @@ puts "cmd_mod:" p cmd_mod category = Array(cmd_mod[1]&.dig('category')) # Ensure category is always an array + p category category.include?('Debug') p category.include?('Debug') end.map do |debug_mod| From 3ba21b2a0f5a102fdda7191fe205590e789450ce Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 18:45:13 +1000 Subject: [PATCH 15/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 456924d75d..6024e1356b 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -93,10 +93,15 @@ @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| puts "cmd_mod:" p cmd_mod - category = Array(cmd_mod[1]&.dig('category')) # Ensure category is always an array - p category - category.include?('Debug') - p category.include?('Debug') + category = cmd_mod[1]&.dig('category') + category_string = if category.is_a?(Array) + category.join(', ') + else + category.to_s + end + p category_string + category_string.include?('Debug') + p category_string.include?('Debug') end.map do |debug_mod| @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] end From dafbef7fd8cdd4174b131eaeed4991e1c7c8f274 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 18:52:31 +1000 Subject: [PATCH 16/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 6024e1356b..425560bd96 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -99,6 +99,7 @@ else category.to_s end + p category p category_string category_string.include?('Debug') p category_string.include?('Debug') From 3c5f9a246a932d7dc005130efc36b737e5e65539 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 18:59:10 +1000 Subject: [PATCH 17/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 425560bd96..b835df2cc6 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -93,7 +93,7 @@ @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| puts "cmd_mod:" p cmd_mod - category = cmd_mod[1]&.dig('category') + category = Array(cmd_mod[1]&.dig('category') category_string = if category.is_a?(Array) category.join(', ') else From 60d30b11cc3d71b7163c7d72b08220b9726aed6d Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 19:06:39 +1000 Subject: [PATCH 18/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index b835df2cc6..29a584c9b6 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -93,7 +93,7 @@ @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| puts "cmd_mod:" p cmd_mod - category = Array(cmd_mod[1]&.dig('category') + category = Array(cmd_mod[1]&.dig('category')) category_string = if category.is_a?(Array) category.join(', ') else From 3fdc5b6e2a916ef9486157c9dbd8a7ad60b2b743 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 19:12:39 +1000 Subject: [PATCH 19/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 29a584c9b6..f2e7056033 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -93,7 +93,7 @@ @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| puts "cmd_mod:" p cmd_mod - category = Array(cmd_mod[1]&.dig('category')) + category = Array(cmd_mod['category']) category_string = if category.is_a?(Array) category.join(', ') else From f3216f16c59a9aa88f3a0dc9bda822b6623febe7 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 19:19:05 +1000 Subject: [PATCH 20/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index f2e7056033..27a503af3c 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -104,6 +104,8 @@ category_string.include?('Debug') p category_string.include?('Debug') end.map do |debug_mod| + puts 'debug_mod: ' + p debug_mod @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] end rescue StandardError => e From 2163e732ce2a16cc26fb02bd2ad6db5686d35182 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 19:25:06 +1000 Subject: [PATCH 21/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 27a503af3c..4609677c3d 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -91,15 +91,12 @@ @debug_mod_ids = JSON.parse(RestClient.get("#{RESTAPI_MODULES}?token=#{@token}")) @debug_mod_names_ids = {} @debug_mods = @debug_mod_ids.to_a.select do |cmd_mod| - puts "cmd_mod:" - p cmd_mod category = Array(cmd_mod['category']) category_string = if category.is_a?(Array) category.join(', ') else category.to_s end - p category p category_string category_string.include?('Debug') p category_string.include?('Debug') From 7aaabe0ff76539a8a9e0237a3e8aaea2e5a5c5dd Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 19:42:36 +1000 Subject: [PATCH 22/23] Troubleshooting --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index 4609677c3d..cbde898449 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -103,7 +103,7 @@ end.map do |debug_mod| puts 'debug_mod: ' p debug_mod - @debug_mod_names_ids[debug_mod[1]['class']] = debug_mod[1]['id'] + @debug_mod_names_ids[debug_mod['class']] = debug_mod['id'] end rescue StandardError => e print_info "Exception: #{e}" From 6744516e1599aada87b2d722472e5a7a3a3eec57 Mon Sep 17 00:00:00 2001 From: zinduolis Date: Sun, 27 Oct 2024 19:48:23 +1000 Subject: [PATCH 23/23] Fix debug mod data handling --- spec/beef/modules/debug/test_beef_debugs_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/beef/modules/debug/test_beef_debugs_spec.rb b/spec/beef/modules/debug/test_beef_debugs_spec.rb index cbde898449..1912d331c0 100644 --- a/spec/beef/modules/debug/test_beef_debugs_spec.rb +++ b/spec/beef/modules/debug/test_beef_debugs_spec.rb @@ -97,12 +97,8 @@ else category.to_s end - p category_string category_string.include?('Debug') - p category_string.include?('Debug') end.map do |debug_mod| - puts 'debug_mod: ' - p debug_mod @debug_mod_names_ids[debug_mod['class']] = debug_mod['id'] end rescue StandardError => e