Skip to content

Commit

Permalink
Improve acceptance test namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Dec 11, 2024
1 parent a63fa68 commit 6862643
Show file tree
Hide file tree
Showing 17 changed files with 2,009 additions and 1,977 deletions.
8 changes: 4 additions & 4 deletions spec/acceptance/command_shell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
)

Expand Down
10 changes: 5 additions & 5 deletions spec/acceptance/meterpreter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
)

Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
282 changes: 143 additions & 139 deletions spec/support/acceptance/command_shell/cmd.rb
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 6862643

Please sign in to comment.