refactor: simplify server options

This commit is contained in:
ReaJason
2025-08-13 23:53:40 +08:00
parent 37d3086ca5
commit 5f153a9052
31 changed files with 171 additions and 508 deletions
@@ -51,13 +51,9 @@ public class Jboss423ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.JBossAS;
Server server = Server.JBoss;
List<String> supportedShellTypes = List.of(
ShellType.FILTER, ShellType.LISTENER,
ShellType.VALVE,
ShellType.PROXY_VALVE,
ShellType.AGENT_FILTER_CHAIN,
ShellType.CATALINA_AGENT_CONTEXT_VALVE
ShellType.PROXY_VALVE
);
List<Packers> testPackers = List.of(Packers.JSP, Packers.JSPX, Packers.JavaDeserialize);
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers);
@@ -72,6 +68,6 @@ public class Jboss423ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python);
}
}
@@ -50,7 +50,7 @@ public class Jboss510ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.JBossAS;
Server server = Server.JBoss;
List<String> supportedShellTypes = List.of(
ShellType.FILTER, ShellType.LISTENER,
ShellType.VALVE,
@@ -74,6 +74,6 @@ public class Jboss510ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python);
}
}
@@ -50,7 +50,7 @@ public class Jboss610ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.JBossAS;
Server server = Server.JBoss;
List<String> supportedShellTypes = List.of(
ShellType.FILTER, ShellType.LISTENER,
ShellType.VALVE,
@@ -71,6 +71,6 @@ public class Jboss610ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python);
}
}
@@ -53,7 +53,7 @@ public class Jboss711ContainerTest {
* 找不到 Templates 类暂时先不测试反序列化
*/
static Stream<Arguments> casesProvider() {
Server server = Server.JBossAS;
Server server = Server.JBoss;
List<String> supportedShellTypes = List.of(
ShellType.FILTER, ShellType.LISTENER,
ShellType.VALVE,
@@ -74,6 +74,6 @@ public class Jboss711ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_7, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_7, packer, container, python);
}
}
@@ -50,7 +50,7 @@ public class JbossEap6ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.JBossEAP6;
Server server = Server.JBoss;
List<String> supportedShellTypes = List.of(ShellType.FILTER, ShellType.LISTENER,
ShellType.VALVE,
ShellType.PROXY_VALVE,
@@ -68,6 +68,6 @@ public class JbossEap6ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.JBossEAP6, shellType, shellTool, Opcodes.V1_6, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python);
}
}
@@ -50,7 +50,7 @@ public class JbossEap7ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.JBossEAP7;
Server server = Server.Undertow;
List<String> supportedShellTypes = List.of(
ShellType.FILTER,
ShellType.LISTENER,
@@ -69,6 +69,6 @@ public class JbossEap7ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.JBossEAP7, shellType, shellTool, Opcodes.V1_6, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python);
}
}
@@ -50,7 +50,7 @@ public class Payara5201ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.Payara;
Server server = Server.GlassFish;
List<String> supportedShellTypes = List.of(
ShellType.FILTER, ShellType.LISTENER, ShellType.VALVE,
ShellType.AGENT_FILTER_CHAIN, ShellType.CATALINA_AGENT_CONTEXT_VALVE
@@ -68,6 +68,6 @@ public class Payara5201ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
}
}
@@ -50,7 +50,7 @@ public class Payara520225ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.Payara;
Server server = Server.GlassFish;
List<String> supportedShellTypes = List.of(
ShellType.FILTER, ShellType.LISTENER, ShellType.VALVE,
ShellType.AGENT_FILTER_CHAIN, ShellType.CATALINA_AGENT_CONTEXT_VALVE
@@ -68,6 +68,6 @@ public class Payara520225ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
}
}
@@ -50,7 +50,7 @@ public class Payara620222ContainerTest {
.withExposedPorts(8080);
static Stream<Arguments> casesProvider() {
Server server = Server.Payara;
Server server = Server.GlassFish;
List<String> supportedShellTypes = List.of(
ShellType.JAKARTA_FILTER, ShellType.JAKARTA_LISTENER, ShellType.JAKARTA_VALVE,
ShellType.AGENT_FILTER_CHAIN, ShellType.CATALINA_AGENT_CONTEXT_VALVE
@@ -68,6 +68,6 @@ public class Payara620222ContainerTest {
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
@MethodSource("casesProvider")
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V11, packer, container, python);
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V11, packer, container, python);
}
}