mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
feat: support suo5 v2 shell
This commit is contained in:
@@ -233,7 +233,8 @@ public class ShellAssertion {
|
||||
behinderIsOk(shellUrl, ((BehinderConfig) generateResult.getShellToolConfig()));
|
||||
break;
|
||||
case Suo5:
|
||||
suo5IsOk(shellUrl, ((Suo5Config) generateResult.getShellToolConfig()));
|
||||
case Suo5v2:
|
||||
suo5IsOk(shellTool, shellUrl, ((Suo5Config) generateResult.getShellToolConfig()));
|
||||
break;
|
||||
case AntSword:
|
||||
antSwordIsOk(shellUrl, ((AntSwordConfig) generateResult.getShellToolConfig()));
|
||||
@@ -300,8 +301,8 @@ public class ShellAssertion {
|
||||
assertTrue(behinderManager.test());
|
||||
}
|
||||
|
||||
public static void suo5IsOk(String entrypoint, Suo5Config shellConfig) {
|
||||
assertTrue(Suo5Manager.test(entrypoint, shellConfig.getHeaderValue()));
|
||||
public static void suo5IsOk(String shellTool, String entrypoint, Suo5Config shellConfig) {
|
||||
assertTrue(Suo5Manager.test(shellTool, entrypoint, shellConfig.getHeaderValue()));
|
||||
}
|
||||
|
||||
public static void antSwordIsOk(String entrypoint, AntSwordConfig shellConfig) {
|
||||
@@ -342,6 +343,7 @@ public class ShellAssertion {
|
||||
log.info("generated {} behinder with pass: {}, User-Agent: {}", shellType, behinderPass, uniqueName);
|
||||
break;
|
||||
case Suo5:
|
||||
case Suo5v2:
|
||||
shellToolConfig = Suo5Config.builder()
|
||||
.headerName("User-Agent")
|
||||
.headerValue(uniqueName)
|
||||
|
||||
+9
-3
@@ -3,10 +3,12 @@ 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;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@@ -49,12 +51,12 @@ public class GlassFish3ContainerTest {
|
||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||
.withNetwork(network)
|
||||
.withNetworkAliases("app")
|
||||
.waitingFor(Wait.forHttp("/app"))
|
||||
.waitingFor(Wait.forLogMessage(".*(deployed|done).*", 1))
|
||||
.withExposedPorts(8080);
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
container.waitingFor(Wait.forLogMessage(".*(deployed|done).*", 1));
|
||||
container.waitingFor(Wait.forHttp("/app"));
|
||||
}
|
||||
|
||||
static Stream<Arguments> casesProvider() {
|
||||
@@ -67,7 +69,11 @@ public class GlassFish3ContainerTest {
|
||||
ShellType.CATALINA_AGENT_CONTEXT_VALVE
|
||||
);
|
||||
List<Packers> testPackers = List.of(Packers.JSP);
|
||||
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers);
|
||||
List<Triple<String, String, Packers>> unSupportedCases = List.of(
|
||||
Triple.of(ShellType.AGENT_FILTER_CHAIN, ShellTool.Suo5v2, Packers.AgentJar), // request.inputStream is empty
|
||||
Triple.of(ShellType.CATALINA_AGENT_CONTEXT_VALVE, ShellTool.Suo5v2, Packers.AgentJar) // request.inputStream is empty
|
||||
);
|
||||
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers, unSupportedCases);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ public class Payara5201ContainerTest {
|
||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||
.withNetwork(network)
|
||||
.withNetworkAliases("app")
|
||||
.waitingFor(Wait.forHttp("/app"))
|
||||
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
||||
.withExposedPorts(8080);
|
||||
|
||||
static Stream<Arguments> casesProvider() {
|
||||
@@ -66,7 +66,7 @@ public class Payara5201ContainerTest {
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
container.waitingFor(Wait.forLogMessage(".*JMXService.*", 1));
|
||||
container.waitingFor(Wait.forHttp("/app"));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ public class Payara520225ContainerTest {
|
||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||
.withNetwork(network)
|
||||
.withNetworkAliases("app")
|
||||
.waitingFor(Wait.forHttp("/app"))
|
||||
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
||||
.withExposedPorts(8080);
|
||||
|
||||
static Stream<Arguments> casesProvider() {
|
||||
@@ -66,7 +66,7 @@ public class Payara520225ContainerTest {
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
container.waitingFor(Wait.forLogMessage(".*JMXService.*", 1));
|
||||
container.waitingFor(Wait.forHttp("/app"));
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
@Slf4j
|
||||
@Testcontainers
|
||||
public class Wildfly9ContainerTest {
|
||||
public static final String imageName = "jboss/wildfly:10.0.0.Final";
|
||||
public static final String imageName = "jboss/wildfly:9.0.1.Final";
|
||||
static Network network = Network.newNetwork();
|
||||
@Container
|
||||
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@Slf4j
|
||||
@Testcontainers
|
||||
public class Wildfly9ContainerTest {
|
||||
public static final String imageName = "jboss/wildfly:10.0.0.Final";
|
||||
public static final String imageName = "jboss/wildfly:9.0.1.Final";
|
||||
@Container
|
||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||
.withCopyToContainer(warFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
||||
|
||||
Reference in New Issue
Block a user