diff --git a/spec/acceptance/command_shell_spec.rb b/spec/acceptance/command_shell_spec.rb index 63c0a985f9d0..e4533ba18777 100644 --- a/spec/acceptance/command_shell_spec.rb +++ b/spec/acceptance/command_shell_spec.rb @@ -4,12 +4,12 @@ RSpec.describe 'CommandShell' do include_context 'wait_for_expect' - # Tests to ensure that CMD/Powershell/Linux is consistent across all implementations/operation systems + # Tests to ensure that CMD/Powershell/unix is consistent across all implementations/operation systems COMMAND_SHELL_PAYLOADS = Acceptance::Session.with_session_name_merged( { - powershell: Acceptance::Session::POWERSHELL, - cmd: Acceptance::Session::CMD, - linux: Acceptance::Session::LINUX + powershell: Acceptance::CommandShell::PowerShell::TESTS, + cmd: Acceptance::CommandShell::PowerShell::TESTS, + unix: Acceptance::CommandShell::Unix::TESTS, } ) diff --git a/spec/acceptance/meterpreter_spec.rb b/spec/acceptance/meterpreter_spec.rb index 3bca9b2d9128..256950087e4c 100644 --- a/spec/acceptance/meterpreter_spec.rb +++ b/spec/acceptance/meterpreter_spec.rb @@ -7,11 +7,11 @@ # Tests to ensure that Meterpreter is consistent across all implementations/operation systems METERPRETER_PAYLOADS = Acceptance::Session.with_session_name_merged( { - python: Acceptance::Session::PYTHON_METERPRETER, - php: Acceptance::Session::PHP_METERPRETER, - java: Acceptance::Session::JAVA_METERPRETER, - mettle: Acceptance::Session::METTLE_METERPRETER, - windows_meterpreter: Acceptance::Session::WINDOWS_METERPRETER + python: Acceptance::Meterpreter::Python::TESTS, + php: Acceptance::Meterpreter::Php::TESTS, + java: Acceptance::Meterpreter::Java::TESTS, + mettle: Acceptance::Meterpreter::Mettle::TESTS, + windows_meterpreter: Acceptance::Meterpreter::WindowsMeterpreter::TESTS } ) diff --git a/spec/acceptance_spec_helper.rb b/spec/acceptance_spec_helper.rb index b4df9dff8081..87015f035ba9 100644 --- a/spec/acceptance_spec_helper.rb +++ b/spec/acceptance_spec_helper.rb @@ -5,7 +5,7 @@ acceptance_support_glob = File.expand_path(File.join(File.dirname(__FILE__), 'support', 'acceptance', '**', '*.rb')) shared_contexts_glob = File.expand_path(File.join(File.dirname(__FILE__), 'support', 'shared', 'contexts', '**', '*.rb')) -Dir[acceptance_support_glob, shared_contexts_glob].each do |f| +Dir[acceptance_support_glob, shared_contexts_glob].sort.each do |f| require f end diff --git a/spec/support/acceptance/command_shell/cmd.rb b/spec/support/acceptance/command_shell/cmd.rb index 8f9fca7f68cf..0f3cd29fbcb3 100644 --- a/spec/support/acceptance/command_shell/cmd.rb +++ b/spec/support/acceptance/command_shell/cmd.rb @@ -1,150 +1,154 @@ -module Acceptance::Session - CMD = { - payloads: [ - { - name: 'windows/x64/shell_reverse_tcp', - extension: '.exe', - platforms: [:windows], - execute_cmd: ['${payload_path}'], - executable: true, - generate_options: { - '-f': 'exe' - }, - datastore: { - global: {}, - module: {} - } - } - ], - module_tests: [ - { - name: 'post/test/cmd_exec', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - [ - :osx, - { - skip: true, - reason: 'Payload not compiled for platform' +module Acceptance + module CommandShell + module Cmd + TESTS = { + payloads: [ + { + name: 'windows/x64/shell_reverse_tcp', + extension: '.exe', + platforms: [:windows], + execute_cmd: ['${payload_path}'], + executable: true, + generate_options: { + '-f': 'exe' + }, + datastore: { + global: {}, + module: {} } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] } - } - }, - { - name: 'post/test/file', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - [ - :osx, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - :windows ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: 'post/test/get_env', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - [ - :osx, - { - skip: true, - reason: 'Payload not compiled for platform' + module_tests: [ + { + name: 'post/test/cmd_exec', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + [ + :osx, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: 'post/test/registry', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Windows only test' + { + name: 'post/test/file', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + [ + :osx, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } } - ], - [ - :osx, - { - skip: true, - reason: 'Windows only test' - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] }, - osx: { - known_failures: [] + { + name: 'post/test/get_env', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + [ + :osx, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } }, - windows: { - known_failures: [] + { + name: 'post/test/registry', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Windows only test' + } + ], + [ + :osx, + { + skip: true, + reason: 'Windows only test' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } } - } + ] } - ] - } + end + end end diff --git a/spec/support/acceptance/command_shell/linux.rb b/spec/support/acceptance/command_shell/linux.rb deleted file mode 100644 index 3eb40744ec55..000000000000 --- a/spec/support/acceptance/command_shell/linux.rb +++ /dev/null @@ -1,158 +0,0 @@ -module Acceptance::Session - LINUX = { - payloads: [ - { - name: "cmd/unix/reverse_bash", - extension: ".sh", - platforms: [:linux], - executable: true, - execute_cmd: ["sh ${payload_path}"], - generate_options: { - '-f': "raw" - }, - datastore: { - global: {}, - module: {} - } - }, - ], - module_tests: [ - { - name: "post/test/services", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/cmd_exec", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/file", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/get_env", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/unix", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Unix only test" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - } - ] - } -end diff --git a/spec/support/acceptance/command_shell/powershell.rb b/spec/support/acceptance/command_shell/powershell.rb index f941057eccd4..77016a30a739 100644 --- a/spec/support/acceptance/command_shell/powershell.rb +++ b/spec/support/acceptance/command_shell/powershell.rb @@ -1,152 +1,156 @@ -module Acceptance::Session - POWERSHELL = { - payloads: [ - { - name: 'cmd/windows/powershell_reverse_tcp', - extension: '.ps1', - platforms: [:windows], - execute_cmd: ['powershell ${payload_path}'], - executable: true, - generate_options: { - '-f': 'raw' - }, - datastore: { - global: {}, - module: {} - } - } - ], - module_tests: [ - { - name: 'post/test/cmd_exec', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - [ - :osx, - { - skip: true, - reason: 'Payload not compiled for platform' +module Acceptance + module CommandShell + module PowerShell + TESTS = { + payloads: [ + { + name: 'cmd/windows/powershell_reverse_tcp', + extension: '.ps1', + platforms: [:windows], + execute_cmd: ['powershell ${payload_path}'], + executable: true, + generate_options: { + '-f': 'raw' + }, + datastore: { + global: {}, + module: {} } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] } - } - }, - { - name: 'post/test/file', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - [ - :osx, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - :windows ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: 'post/test/get_env', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Payload not compiled for platform' - } - ], - [ - :osx, - { - skip: true, - reason: 'Payload not compiled for platform' + module_tests: [ + { + name: 'post/test/cmd_exec', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + [ + :osx, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: 'post/test/registry', - platforms: [ - [ - :linux, - { - skip: true, - reason: 'Windows only test' + { + name: 'post/test/file', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + [ + :osx, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } } - ], - [ - :osx, - { - skip: true, - reason: 'Windows only test' - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] }, - osx: { - known_failures: [] + { + name: 'post/test/get_env', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + [ + :osx, + { + skip: true, + reason: 'Payload not compiled for platform' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } }, - windows: { - known_failures: [ - "[-] FAILED: should write REG_SZ unicode values" - ] + { + name: 'post/test/registry', + platforms: [ + [ + :linux, + { + skip: true, + reason: 'Windows only test' + } + ], + [ + :osx, + { + skip: true, + reason: 'Windows only test' + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [ + "[-] FAILED: should write REG_SZ unicode values" + ] + } + } } - } + ] } - ] - } + end + end end diff --git a/spec/support/acceptance/command_shell/unix.rb b/spec/support/acceptance/command_shell/unix.rb new file mode 100644 index 000000000000..3492e38d2573 --- /dev/null +++ b/spec/support/acceptance/command_shell/unix.rb @@ -0,0 +1,162 @@ +module Acceptance + module CommandShell + module Unix + TESTS = { + payloads: [ + { + name: "cmd/unix/reverse_bash", + extension: ".sh", + platforms: [:linux], + executable: true, + execute_cmd: ["sh ${payload_path}"], + generate_options: { + '-f': "raw" + }, + datastore: { + global: {}, + module: {} + } + }, + ], + module_tests: [ + { + name: "post/test/services", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/cmd_exec", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/file", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/get_env", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/unix", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Unix only test" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + } + ] + } + end + end +end diff --git a/spec/support/acceptance/meterpreter/java.rb b/spec/support/acceptance/meterpreter/java.rb new file mode 100644 index 000000000000..1fcf2d8b8adc --- /dev/null +++ b/spec/support/acceptance/meterpreter/java.rb @@ -0,0 +1,271 @@ +module Acceptance + module Meterpreter + module Java + TESTS = { + payloads: [ + { + name: "java/meterpreter/reverse_tcp", + extension: ".jar", + platforms: [:osx, :linux, :windows], + execute_cmd: ["java", "-jar", "${payload_path}"], + generate_options: { + '-f': "jar" + }, + datastore: { + global: {}, + module: { + spawn: 0 + } + } + } + ], + module_tests: [ + { + name: "post/test/services", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [ + "[-] [should start W32Time] FAILED: should start W32Time", + "[-] [should start W32Time] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should stop W32Time] FAILED: should stop W32Time", + "[-] [should stop W32Time] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should create a service testes] FAILED: should create a service testes", + "[-] [should create a service testes] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should return info on the newly-created service testes] Could not retrieve the start type of the testes service!", + "[-] FAILED: should return info on the newly-created service testes", + "[-] [should delete the new service testes] FAILED: should delete the new service testes", + "[-] [should delete the new service testes] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should return status on a given service winmgmt] FAILED: should return status on a given service winmgmt", + "[-] [should return status on a given service winmgmt] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should modify config on a given service] FAILED: should modify config on a given service", + "[-] [should modify config on a given service] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should start a disabled service] FAILED: should start a disabled service", + "[-] [should start a disabled service] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should restart a started service W32Time] FAILED: should restart a started service W32Time", + "[-] [should restart a started service W32Time] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should raise a runtime exception if no access to service] FAILED: should raise a runtime exception if no access to service", + "[-] [should raise a runtime exception if no access to service] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", + "[-] [should raise a runtime exception if services doesnt exist] FAILED: should raise a runtime exception if services doesnt exist", + "[-] [should raise a runtime exception if services doesnt exist] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)" + ] + } + } + }, + { + name: "post/test/cmd_exec", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/extapi", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/file", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/get_env", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/meterpreter", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun_reverse_lookups", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/registry", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [ + "[-] FAILED: should write REG_EXPAND_SZ values", + "[-] FAILED: should write REG_SZ unicode values" + ] + } + } + }, + { + name: "post/test/search", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/unix", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Unix only test" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + } + ] + } + end + end +end diff --git a/spec/support/acceptance/meterpreter/mettle.rb b/spec/support/acceptance/meterpreter/mettle.rb new file mode 100644 index 000000000000..b9219d59a61c --- /dev/null +++ b/spec/support/acceptance/meterpreter/mettle.rb @@ -0,0 +1,353 @@ +module Acceptance + module Meterpreter + module Mettle + TESTS = { + payloads: [ + { + name: "linux/x64/meterpreter/reverse_tcp", + extension: "", + platforms: [:linux], + executable: true, + execute_cmd: ["${payload_path}"], + generate_options: { + '-f': "elf" + }, + datastore: { + global: {}, + module: { + MeterpreterTryToFork: false, + MeterpreterDebugBuild: true + } + } + }, + { + name: "osx/x64/meterpreter_reverse_tcp", + extension: "", + platforms: [:osx], + executable: true, + execute_cmd: ["${payload_path}"], + generate_options: { + '-f': "macho" + }, + datastore: { + global: {}, + module: { + MeterpreterTryToFork: false, + MeterpreterDebugBuild: true + } + } + } + ], + module_tests: [ + { + name: "post/test/services", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/cmd_exec", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/extapi", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/file", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/get_env", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/meterpreter", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [ + "[-] FAILED: should return network interfaces", + "[-] FAILED: should have an interface that matches session_host" + ] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun_reverse_lookups", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/registry", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/search", + platforms: [ + :linux, + [ + :osx, + { + skip: true, + reason: "skipped - test/search hangs in osx and CPU spikes to >300%" + } + ], + [ + :windows, + { + skip: true, + reason: "Payload not compiled for platform" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/unix", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Unix only test" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + } + ] + } + end + end +end diff --git a/spec/support/acceptance/meterpreter/php.rb b/spec/support/acceptance/meterpreter/php.rb new file mode 100644 index 000000000000..f1d0f4b59ef2 --- /dev/null +++ b/spec/support/acceptance/meterpreter/php.rb @@ -0,0 +1,276 @@ +module Acceptance + module Meterpreter + module Php + TESTS = { + payloads: [ + { + name: "php/meterpreter_reverse_tcp", + extension: ".php", + platforms: [:osx, :linux, :windows], + execute_cmd: ["php", "${payload_path}"], + generate_options: { + '-f': "raw" + }, + datastore: { + global: {}, + module: { + MeterpreterDebugBuild: true + } + } + } + ], + module_tests: [ + { + name: "post/test/services", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :windows, + { + skip: [ + :meterpreter_runtime_version, + :==, + "php5.3" + ], + reason: "Skip PHP 5.3 as the tests timeout - due to cmd_exec taking 15 seconds for each call. Caused by failure to detect feof correctly - https://github.com/rapid7/metasploit-payloads/blame/c7f7bc2fc0b86e17c3bc078149c71745c5e478b3/php/meterpreter/meterpreter.php#L1127-L1145" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/cmd_exec", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [ + ] + } + } + }, + { + name: "post/test/extapi", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/file", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [ + "[-] FAILED: should read the binary data we just wrote" + ] + }, + osx: { + known_failures: [ + "[-] FAILED: should read the binary data we just wrote" + ] + }, + windows: { + known_failures: [ + "[-] [should delete a symbolic link target] FAILED: should delete a symbolic link target", + "[-] [should delete a symbolic link target] Exception: Rex::Post::Meterpreter::RequestError: stdapi_fs_delete_dir: Operation failed: 1", + "[-] FAILED: should read the binary data we just wrote" + ] + } + } + }, + { + name: "post/test/get_env", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/meterpreter", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [ + "[-] FAILED: should return a list of processes" + ] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun_reverse_lookups", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/registry", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :windows, + { + skip: [ + :meterpreter_runtime_version, + :==, + "php5.3" + ], + reason: "Skip PHP 5.3 as the tests timeout - due to cmd_exec taking 15 seconds for each call. Caused by failure to detect feof correctly - https://github.com/rapid7/metasploit-payloads/blame/c7f7bc2fc0b86e17c3bc078149c71745c5e478b3/php/meterpreter/meterpreter.php#L1127-L1145" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/search", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/unix", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Unix only test" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + } + ] + } + end + end +end diff --git a/spec/support/acceptance/meterpreter/python.rb b/spec/support/acceptance/meterpreter/python.rb new file mode 100644 index 000000000000..afa90cac64bd --- /dev/null +++ b/spec/support/acceptance/meterpreter/python.rb @@ -0,0 +1,273 @@ +module Acceptance + module Meterpreter + module Python + TESTS = { + payloads: [ + { + name: "python/meterpreter_reverse_tcp", + extension: ".py", + platforms: [:osx, :linux, :windows], + execute_cmd: ["python", "${payload_path}"], + generate_options: { + '-f': "raw" + }, + datastore: { + global: {}, + module: { + MeterpreterTryToFork: false, + PythonMeterpreterDebug: true + } + } + } + ], + module_tests: [ + { + name: "post/test/services", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [ + "[-] [should start W32Time] FAILED: should start W32Time", + "[-] [should start W32Time] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", + "[-] [should stop W32Time] FAILED: should stop W32Time", + "[-] [should stop W32Time] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", + "[-] [should list services] FAILED: should list services", + "[-] [should list services] Exception: NoMethodError: undefined method `service' for nil:NilClass", + "[-] [should return info on a given service winmgmt] FAILED: should return info on a given service winmgmt", + "[-] [should return info on a given service winmgmt] Exception: NoMethodError: undefined method `service' for nil:NilClass", + "[-] FAILED: should create a service testes", + "[-] [should return info on the newly-created service testes] FAILED: should return info on the newly-created service testes", + "[-] [should return info on the newly-created service testes] Exception: NoMethodError: undefined method `service' for nil:NilClass", + "[-] [should delete the new service testes] FAILED: should delete the new service testes", + "[-] [should delete the new service testes] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", + "[-] [should return status on a given service winmgmt] FAILED: should return status on a given service winmgmt", + "[-] [should return status on a given service winmgmt] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", + "[-] [should modify config on a given service] FAILED: should modify config on a given service", + "[-] [should modify config on a given service] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", + "[-] FAILED: should start a disabled service", + "[-] [should restart a started service W32Time] FAILED: should restart a started service W32Time", + "[-] [should restart a started service W32Time] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6." + ] + } + } + }, + { + name: "post/test/cmd_exec", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/extapi", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [ + "[-] [should return clipboard jpg dimensions] FAILED: should return clipboard jpg dimensions", + "[-] [should return clipboard jpg dimensions] Exception: NoMethodError: undefined method `clipboard' for nil:NilClass", + "[-] [should download clipboard jpg data] FAILED: should download clipboard jpg data", + "[-] [should download clipboard jpg data] Exception: NoMethodError: undefined method `clipboard' for nil:NilClass" + ] + } + } + }, + { + name: "post/test/file", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/get_env", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/meterpreter", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [ + ] + } + } + }, + { + name: "post/test/railgun", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun_reverse_lookups", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/registry", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/search", + platforms: [:linux, :osx, :windows], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/unix", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Unix only test" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + } + ] + } + end + end +end diff --git a/spec/support/acceptance/meterpreter/windows_meterpreter.rb b/spec/support/acceptance/meterpreter/windows_meterpreter.rb new file mode 100644 index 000000000000..f953f1af86f8 --- /dev/null +++ b/spec/support/acceptance/meterpreter/windows_meterpreter.rb @@ -0,0 +1,376 @@ +module Acceptance + module Meterpreter + module WindowsMeterpreter + TESTS = { + payloads: [ + { + name: "windows/meterpreter/reverse_tcp", + extension: ".exe", + platforms: [:windows], + execute_cmd: ["${payload_path}"], + executable: true, + generate_options: { + '-f': "exe" + }, + datastore: { + global: {}, + module: { + # Not supported by Windows Meterpreter + # MeterpreterTryToFork: false, + MeterpreterDebugBuild: true + } + } + } + ], + module_tests: [ + { + name: "post/test/services", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/cmd_exec", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/extapi", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/file", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/get_env", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/meterpreter", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/railgun_reverse_lookups", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/registry", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Windows only test" + } + ], + [ + :osx, + { + skip: true, + reason: "Windows only test" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/search", + platforms: [ + [ + :linux, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + [ + :osx, + { + skip: true, + reason: "Payload not compiled for platform" + } + ], + :windows + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + }, + { + name: "post/test/unix", + platforms: [ + :linux, + :osx, + [ + :windows, + { + skip: true, + reason: "Unix only test" + } + ] + ], + skipped: false, + lines: { + linux: { + known_failures: [] + }, + osx: { + known_failures: [] + }, + windows: { + known_failures: [] + } + } + } + ] + } + end + end +end diff --git a/spec/support/acceptance/session/java.rb b/spec/support/acceptance/session/java.rb deleted file mode 100644 index 029ce6e672f0..000000000000 --- a/spec/support/acceptance/session/java.rb +++ /dev/null @@ -1,267 +0,0 @@ -module Acceptance::Session - JAVA_METERPRETER = { - payloads: [ - { - name: "java/meterpreter/reverse_tcp", - extension: ".jar", - platforms: [:osx, :linux, :windows], - execute_cmd: ["java", "-jar", "${payload_path}"], - generate_options: { - '-f': "jar" - }, - datastore: { - global: {}, - module: { - spawn: 0 - } - } - } - ], - module_tests: [ - { - name: "post/test/services", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [ - "[-] [should start W32Time] FAILED: should start W32Time", - "[-] [should start W32Time] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should stop W32Time] FAILED: should stop W32Time", - "[-] [should stop W32Time] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should create a service testes] FAILED: should create a service testes", - "[-] [should create a service testes] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should return info on the newly-created service testes] Could not retrieve the start type of the testes service!", - "[-] FAILED: should return info on the newly-created service testes", - "[-] [should delete the new service testes] FAILED: should delete the new service testes", - "[-] [should delete the new service testes] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should return status on a given service winmgmt] FAILED: should return status on a given service winmgmt", - "[-] [should return status on a given service winmgmt] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should modify config on a given service] FAILED: should modify config on a given service", - "[-] [should modify config on a given service] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should start a disabled service] FAILED: should start a disabled service", - "[-] [should start a disabled service] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should restart a started service W32Time] FAILED: should restart a started service W32Time", - "[-] [should restart a started service W32Time] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should raise a runtime exception if no access to service] FAILED: should raise a runtime exception if no access to service", - "[-] [should raise a runtime exception if no access to service] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)", - "[-] [should raise a runtime exception if services doesnt exist] FAILED: should raise a runtime exception if services doesnt exist", - "[-] [should raise a runtime exception if services doesnt exist] Exception: Rex::Post::Meterpreter::RequestError: stdapi_railgun_api: Operation failed: The command is not supported by this Meterpreter type (java/windows)" - ] - } - } - }, - { - name: "post/test/cmd_exec", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/extapi", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/file", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/get_env", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/meterpreter", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun_reverse_lookups", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/registry", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [ - "[-] FAILED: should write REG_EXPAND_SZ values", - "[-] FAILED: should write REG_SZ unicode values" - ] - } - } - }, - { - name: "post/test/search", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/unix", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Unix only test" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - } - ] - } -end diff --git a/spec/support/acceptance/session/mettle.rb b/spec/support/acceptance/session/mettle.rb deleted file mode 100644 index 182a0d370610..000000000000 --- a/spec/support/acceptance/session/mettle.rb +++ /dev/null @@ -1,349 +0,0 @@ -module Acceptance::Session - METTLE_METERPRETER = { - payloads: [ - { - name: "linux/x64/meterpreter/reverse_tcp", - extension: "", - platforms: [:linux], - executable: true, - execute_cmd: ["${payload_path}"], - generate_options: { - '-f': "elf" - }, - datastore: { - global: {}, - module: { - MeterpreterTryToFork: false, - MeterpreterDebugBuild: true - } - } - }, - { - name: "osx/x64/meterpreter_reverse_tcp", - extension: "", - platforms: [:osx], - executable: true, - execute_cmd: ["${payload_path}"], - generate_options: { - '-f': "macho" - }, - datastore: { - global: {}, - module: { - MeterpreterTryToFork: false, - MeterpreterDebugBuild: true - } - } - } - ], - module_tests: [ - { - name: "post/test/services", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/cmd_exec", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/extapi", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/file", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/get_env", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/meterpreter", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [ - "[-] FAILED: should return network interfaces", - "[-] FAILED: should have an interface that matches session_host" - ] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun_reverse_lookups", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/registry", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/search", - platforms: [ - :linux, - [ - :osx, - { - skip: true, - reason: "skipped - test/search hangs in osx and CPU spikes to >300%" - } - ], - [ - :windows, - { - skip: true, - reason: "Payload not compiled for platform" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/unix", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Unix only test" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - } - ] - } -end diff --git a/spec/support/acceptance/session/php.rb b/spec/support/acceptance/session/php.rb deleted file mode 100644 index 0cc3fb666858..000000000000 --- a/spec/support/acceptance/session/php.rb +++ /dev/null @@ -1,272 +0,0 @@ -module Acceptance::Session - PHP_METERPRETER = { - payloads: [ - { - name: "php/meterpreter_reverse_tcp", - extension: ".php", - platforms: [:osx, :linux, :windows], - execute_cmd: ["php", "${payload_path}"], - generate_options: { - '-f': "raw" - }, - datastore: { - global: {}, - module: { - MeterpreterDebugBuild: true - } - } - } - ], - module_tests: [ - { - name: "post/test/services", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :windows, - { - skip: [ - :meterpreter_runtime_version, - :==, - "php5.3" - ], - reason: "Skip PHP 5.3 as the tests timeout - due to cmd_exec taking 15 seconds for each call. Caused by failure to detect feof correctly - https://github.com/rapid7/metasploit-payloads/blame/c7f7bc2fc0b86e17c3bc078149c71745c5e478b3/php/meterpreter/meterpreter.php#L1127-L1145" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/cmd_exec", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [ - ] - } - } - }, - { - name: "post/test/extapi", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/file", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [ - "[-] FAILED: should read the binary data we just wrote" - ] - }, - osx: { - known_failures: [ - "[-] FAILED: should read the binary data we just wrote" - ] - }, - windows: { - known_failures: [ - "[-] [should delete a symbolic link target] FAILED: should delete a symbolic link target", - "[-] [should delete a symbolic link target] Exception: Rex::Post::Meterpreter::RequestError: stdapi_fs_delete_dir: Operation failed: 1", - "[-] FAILED: should read the binary data we just wrote" - ] - } - } - }, - { - name: "post/test/get_env", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/meterpreter", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [ - "[-] FAILED: should return a list of processes" - ] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun_reverse_lookups", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/registry", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :windows, - { - skip: [ - :meterpreter_runtime_version, - :==, - "php5.3" - ], - reason: "Skip PHP 5.3 as the tests timeout - due to cmd_exec taking 15 seconds for each call. Caused by failure to detect feof correctly - https://github.com/rapid7/metasploit-payloads/blame/c7f7bc2fc0b86e17c3bc078149c71745c5e478b3/php/meterpreter/meterpreter.php#L1127-L1145" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/search", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/unix", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Unix only test" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - } - ] - } -end diff --git a/spec/support/acceptance/session/python.rb b/spec/support/acceptance/session/python.rb deleted file mode 100644 index eb2870c0eb7c..000000000000 --- a/spec/support/acceptance/session/python.rb +++ /dev/null @@ -1,269 +0,0 @@ -module Acceptance::Session - PYTHON_METERPRETER = { - payloads: [ - { - name: "python/meterpreter_reverse_tcp", - extension: ".py", - platforms: [:osx, :linux, :windows], - execute_cmd: ["python", "${payload_path}"], - generate_options: { - '-f': "raw" - }, - datastore: { - global: {}, - module: { - MeterpreterTryToFork: false, - PythonMeterpreterDebug: true - } - } - } - ], - module_tests: [ - { - name: "post/test/services", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [ - "[-] [should start W32Time] FAILED: should start W32Time", - "[-] [should start W32Time] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", - "[-] [should stop W32Time] FAILED: should stop W32Time", - "[-] [should stop W32Time] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", - "[-] [should list services] FAILED: should list services", - "[-] [should list services] Exception: NoMethodError: undefined method `service' for nil:NilClass", - "[-] [should return info on a given service winmgmt] FAILED: should return info on a given service winmgmt", - "[-] [should return info on a given service winmgmt] Exception: NoMethodError: undefined method `service' for nil:NilClass", - "[-] FAILED: should create a service testes", - "[-] [should return info on the newly-created service testes] FAILED: should return info on the newly-created service testes", - "[-] [should return info on the newly-created service testes] Exception: NoMethodError: undefined method `service' for nil:NilClass", - "[-] [should delete the new service testes] FAILED: should delete the new service testes", - "[-] [should delete the new service testes] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", - "[-] [should return status on a given service winmgmt] FAILED: should return status on a given service winmgmt", - "[-] [should return status on a given service winmgmt] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", - "[-] [should modify config on a given service] FAILED: should modify config on a given service", - "[-] [should modify config on a given service] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6.", - "[-] FAILED: should start a disabled service", - "[-] [should restart a started service W32Time] FAILED: should restart a started service W32Time", - "[-] [should restart a started service W32Time] Exception: RuntimeError: Could not open service. OpenServiceA error: FormatMessage failed to retrieve the error for value 0x6." - ] - } - } - }, - { - name: "post/test/cmd_exec", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/extapi", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [ - "[-] [should return clipboard jpg dimensions] FAILED: should return clipboard jpg dimensions", - "[-] [should return clipboard jpg dimensions] Exception: NoMethodError: undefined method `clipboard' for nil:NilClass", - "[-] [should download clipboard jpg data] FAILED: should download clipboard jpg data", - "[-] [should download clipboard jpg data] Exception: NoMethodError: undefined method `clipboard' for nil:NilClass" - ] - } - } - }, - { - name: "post/test/file", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/get_env", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/meterpreter", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [ - ] - } - } - }, - { - name: "post/test/railgun", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun_reverse_lookups", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/registry", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/search", - platforms: [:linux, :osx, :windows], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/unix", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Unix only test" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - } - ] - } -end diff --git a/spec/support/acceptance/session/windows_meterpreter.rb b/spec/support/acceptance/session/windows_meterpreter.rb deleted file mode 100644 index 7784ab66d2fa..000000000000 --- a/spec/support/acceptance/session/windows_meterpreter.rb +++ /dev/null @@ -1,372 +0,0 @@ -module Acceptance::Session - WINDOWS_METERPRETER = { - payloads: [ - { - name: "windows/meterpreter/reverse_tcp", - extension: ".exe", - platforms: [:windows], - execute_cmd: ["${payload_path}"], - executable: true, - generate_options: { - '-f': "exe" - }, - datastore: { - global: {}, - module: { - # Not supported by Windows Meterpreter - # MeterpreterTryToFork: false, - MeterpreterDebugBuild: true - } - } - } - ], - module_tests: [ - { - name: "post/test/services", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/cmd_exec", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/extapi", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/file", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/get_env", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/meterpreter", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/railgun_reverse_lookups", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/registry", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Windows only test" - } - ], - [ - :osx, - { - skip: true, - reason: "Windows only test" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/search", - platforms: [ - [ - :linux, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - [ - :osx, - { - skip: true, - reason: "Payload not compiled for platform" - } - ], - :windows - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - }, - { - name: "post/test/unix", - platforms: [ - :linux, - :osx, - [ - :windows, - { - skip: true, - reason: "Unix only test" - } - ] - ], - skipped: false, - lines: { - linux: { - known_failures: [] - }, - osx: { - known_failures: [] - }, - windows: { - known_failures: [] - } - } - } - ] - } -end