|
4 | 4 | include_context 'wait_for_expect' |
5 | 5 |
|
6 | 6 | # Tests to ensure that Meterpreter is consistent across all implementations/operation systems |
7 | | - METERPRETER_PAYLOADS = Acceptance::Meterpreter.with_meterpreter_name_merged( |
| 7 | + METERPRETER_PAYLOADS = Acceptance::Session.with_session_name_merged( |
8 | 8 | { |
9 | | - python: Acceptance::Meterpreter::PYTHON_METERPRETER, |
10 | | - php: Acceptance::Meterpreter::PHP_METERPRETER, |
11 | | - java: Acceptance::Meterpreter::JAVA_METERPRETER, |
12 | | - mettle: Acceptance::Meterpreter::METTLE_METERPRETER, |
13 | | - windows_meterpreter: Acceptance::Meterpreter::WINDOWS_METERPRETER |
| 9 | + python: Acceptance::Session::PYTHON_METERPRETER, |
| 10 | + php: Acceptance::Session::PHP_METERPRETER, |
| 11 | + java: Acceptance::Session::JAVA_METERPRETER, |
| 12 | + mettle: Acceptance::Session::METTLE_METERPRETER, |
| 13 | + windows_meterpreter: Acceptance::Session::WINDOWS_METERPRETER |
14 | 14 | } |
15 | 15 | ) |
16 | 16 |
|
17 | 17 | allure_test_environment = AllureRspec.configuration.environment_properties |
18 | 18 |
|
19 | | - let_it_be(:current_platform) { Acceptance::Meterpreter::current_platform } |
| 19 | + let_it_be(:current_platform) { Acceptance::Session::current_platform } |
20 | 20 |
|
21 | 21 | # @!attribute [r] port_allocator |
22 | 22 | # @return [Acceptance::PortAllocator] |
|
55 | 55 | describe meterpreter_runtime_name, focus: meterpreter_config[:focus] do |
56 | 56 | meterpreter_config[:payloads].each.with_index do |payload_config, payload_config_index| |
57 | 57 | describe( |
58 | | - Acceptance::Meterpreter.human_name_for_payload(payload_config).to_s, |
| 58 | + Acceptance::Session.human_name_for_payload(payload_config).to_s, |
59 | 59 | if: ( |
60 | | - Acceptance::Meterpreter.run_meterpreter?(meterpreter_config) && |
61 | | - Acceptance::Meterpreter.supported_platform?(payload_config) |
| 60 | + Acceptance::Session.run_meterpreter?(meterpreter_config) && |
| 61 | + Acceptance::Session.supported_platform?(payload_config) |
62 | 62 | ) |
63 | 63 | ) do |
64 | 64 | let(:payload) { Acceptance::Payload.new(payload_config) } |
@@ -183,18 +183,18 @@ def get_file_attachment_contents(path) |
183 | 183 | console.reset |
184 | 184 | end |
185 | 185 |
|
186 | | - context "#{Acceptance::Meterpreter.current_platform}" do |
187 | | - describe "#{Acceptance::Meterpreter.current_platform}/#{meterpreter_runtime_name} Meterpreter successfully opens a session for the #{payload_config[:name].inspect} payload" do |
| 186 | + context "#{Acceptance::Session.current_platform}" do |
| 187 | + describe "#{Acceptance::Session.current_platform}/#{meterpreter_runtime_name} Meterpreter successfully opens a session for the #{payload_config[:name].inspect} payload" do |
188 | 188 | it( |
189 | 189 | "exposes available metasploit commands", |
190 | 190 | if: ( |
191 | 191 | # Assume that regardless of payload, staged/unstaged/etc, the Meterpreter will have the same commands available |
192 | 192 | # So only run this test when config_index == 0 |
193 | | - payload_config_index == 0 && Acceptance::Meterpreter.supported_platform?(payload_config) |
194 | | - # Run if ENV['METERPRETER'] = 'java php' etc |
195 | | - Acceptance::Meterpreter.run_meterpreter?(meterpreter_config) && |
| 193 | + payload_config_index == 0 && Acceptance::Session.supported_platform?(payload_config) |
| 194 | + # Run if ENV['SESSION'] = 'java php' etc |
| 195 | + Acceptance::Session.run_meterpreter?(meterpreter_config) && |
196 | 196 | # Only run payloads / tests, if the host machine can run them |
197 | | - Acceptance::Meterpreter.supported_platform?(payload_config) |
| 197 | + Acceptance::Session.supported_platform?(payload_config) |
198 | 198 | ) |
199 | 199 | ) do |
200 | 200 | begin |
@@ -332,17 +332,17 @@ def get_file_attachment_contents(path) |
332 | 332 | meterpreter_config[:module_tests].each do |module_test| |
333 | 333 | describe module_test[:name].to_s, focus: module_test[:focus] do |
334 | 334 | it( |
335 | | - "#{Acceptance::Meterpreter.current_platform}/#{meterpreter_runtime_name} meterpreter successfully opens a session for the #{payload_config[:name].inspect} payload and passes the #{module_test[:name].inspect} tests", |
| 335 | + "#{Acceptance::Session.current_platform}/#{meterpreter_runtime_name} meterpreter successfully opens a session for the #{payload_config[:name].inspect} payload and passes the #{module_test[:name].inspect} tests", |
336 | 336 | if: ( |
337 | | - # Run if ENV['METERPRETER'] = 'java php' etc |
338 | | - Acceptance::Meterpreter.run_meterpreter?(meterpreter_config) && |
339 | | - # Run if ENV['METERPRETER_MODULE_TEST'] = 'test/cmd_exec' etc |
340 | | - Acceptance::Meterpreter.run_meterpreter_module_test?(module_test[:name]) && |
| 337 | + # Run if ENV['SESSION'] = 'java php' etc |
| 338 | + Acceptance::Session.run_meterpreter?(meterpreter_config) && |
| 339 | + # Run if ENV['SESSION_MODULE_TEST'] = 'test/cmd_exec' etc |
| 340 | + Acceptance::Session.run_meterpreter_module_test?(module_test[:name]) && |
341 | 341 | # Only run payloads / tests, if the host machine can run them |
342 | | - Acceptance::Meterpreter.supported_platform?(payload_config) && |
343 | | - Acceptance::Meterpreter.supported_platform?(module_test) && |
| 342 | + Acceptance::Session.supported_platform?(payload_config) && |
| 343 | + Acceptance::Session.supported_platform?(module_test) && |
344 | 344 | # Skip tests that are explicitly skipped, or won't pass in the current environment |
345 | | - !Acceptance::Meterpreter.skipped_module_test?(module_test, allure_test_environment) |
| 345 | + !Acceptance::Session.skipped_module_test?(module_test, allure_test_environment) |
346 | 346 | ), |
347 | 347 | # test metadata - will appear in allure report |
348 | 348 | module_test: module_test[:name] |
@@ -406,7 +406,7 @@ def get_file_attachment_contents(path) |
406 | 406 | end |
407 | 407 |
|
408 | 408 | validated_lines.each do |test_line| |
409 | | - test_line = Acceptance::Meterpreter.uncolorize(test_line) |
| 409 | + test_line = Acceptance::Session.uncolorize(test_line) |
410 | 410 | expect(test_line).to_not include('FAILED', '[-] FAILED', '[-] Exception', '[-] '), "Unexpected error: #{test_line}" |
411 | 411 | end |
412 | 412 |
|
|
0 commit comments