diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 7547ddfa7c2b2..a1904abf7620f 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -64,43 +64,43 @@ jobs: fail-fast: false matrix: os: -# - macos-12 + - macos-12 - windows-2019 -# - ubuntu-20.04 + - ubuntu-20.04 ruby: - 3.0.2 -# meterpreter: + meterpreter: # Python -# - { name: python, runtime_version: 3.6 } -# - { name: python, runtime_version: 3.11 } + - { name: python, runtime_version: 3.6 } + - { name: python, runtime_version: 3.11 } # Java -# - { name: java, runtime_version: 8 } -# - { name: java, runtime_version: 21 } + - { name: java, runtime_version: 8 } + - { name: java, runtime_version: 21 } # PHP -# - { name: php, runtime_version: 5.3 } -# - { name: php, runtime_version: 7.4 } -# - { name: php, runtime_version: 8.3 } + - { name: php, runtime_version: 5.3 } + - { name: php, runtime_version: 7.4 } + - { name: php, runtime_version: 8.3 } include: # Windows Meterpreter -# - { meterpreter: { name: windows_meterpreter }, os: windows-2019 } -# - { meterpreter: { name: windows_meterpreter }, os: windows-2022 } + - { meterpreter: { name: windows_meterpreter }, os: windows-2019 } + - { meterpreter: { name: windows_meterpreter }, os: windows-2022 } # Powershell - { meterpreter: { name: powershell }, os: windows-2019 } - { meterpreter: { name: powershell }, os: windows-2022 } # Linux -# - { meterpreter: { name: linux }, os: ubuntu-20.04 } + - { meterpreter: { name: linux }, os: ubuntu-20.04 } # CMD -# - { meterpreter: { name: cmd }, os: windows-2019 } -# - { meterpreter: { name: cmd }, os: windows-2022 } + - { meterpreter: { name: cmd }, os: windows-2019 } + - { meterpreter: { name: cmd }, os: windows-2022 } # Mettle -# - { meterpreter: { name: mettle }, os: macos-12 } -# - { meterpreter: { name: mettle }, os: ubuntu-20.04 } + - { meterpreter: { name: mettle }, os: macos-12 } + - { meterpreter: { name: mettle }, os: ubuntu-20.04 } runs-on: ${{ matrix.os }} diff --git a/spec/acceptance/non_meterpreter_spec.rb b/spec/acceptance/non_meterpreter_spec.rb index 46385353a0724..3c307ef9b8159 100644 --- a/spec/acceptance/non_meterpreter_spec.rb +++ b/spec/acceptance/non_meterpreter_spec.rb @@ -141,14 +141,15 @@ def initialize(path) session_id = nil # Wait for the session to open, or break early if the payload is detected as dead - wait_for_expect do + larger_retry_count_for_powershell = 600 + wait_for_expect(larger_retry_count_for_powershell) do unless payload_process.alive? break end # TODO: Was strictly for Meterpreter sessions, now more generic # - can be reverted if we decide to move these new tests - session_opened_matcher = /\w.* session (\d+) opened[^\n]*\n/ + session_opened_matcher = /session (\d+) opened[^\n]*\n/ session_message = '' begin session_message = console.recvuntil(session_opened_matcher, timeout: 1) diff --git a/spec/support/acceptance/non_meterpreter/powershell.rb b/spec/support/acceptance/non_meterpreter/powershell.rb index 5cfc8de3bd32a..dde98674bacb0 100644 --- a/spec/support/acceptance/non_meterpreter/powershell.rb +++ b/spec/support/acceptance/non_meterpreter/powershell.rb @@ -4,13 +4,13 @@ module Acceptance::NonMeterpreter POWERSHELL = { payloads: [ { - name: 'windows/x64/powershell_reverse_tcp', - extension: '.exe', + name: 'cmd/windows/powershell_reverse_tcp', + extension: '.ps1', platforms: [:windows], - execute_cmd: ['${payload_path}'], + execute_cmd: ['powershell ${payload_path}'], executable: true, generate_options: { - '-f': 'exe' + '-f': 'raw' }, datastore: { global: {}, diff --git a/test/lib/module_test.rb b/test/lib/module_test.rb index 742de716a5541..0bd055343fbf9 100644 --- a/test/lib/module_test.rb +++ b/test/lib/module_test.rb @@ -144,8 +144,12 @@ def push_test_directory @directory_stack.push(_file_system.pwd) # Find the temp directory - tmp = _file_system.get_env("TMP").strip.presence || _file_system.get_env("TMPDIR").strip.presence - # tmp = _file_system.get_env("TMP") || _file_system.get_env("TMPDIR") + if session.platform == 'unix' + tmp = _file_system.get_env("TMP").strip.presence || _file_system.get_env("TMPDIR").strip.presence + else + tmp = _file_system.get_env("TMP") || _file_system.get_env("TMPDIR") + end + # mettle fallback tmp = '/tmp' if tmp.nil? && _file_system.directory?('/tmp') raise "Could not find tmp directory" if tmp == nil || !_file_system.directory?(tmp)