mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-23 15:31:53 +08:00
fix: assertion failed
This commit is contained in:
@@ -2,6 +2,8 @@ services:
|
|||||||
was700:
|
was700:
|
||||||
image: reajason/websphere:7.0.0.21
|
image: reajason/websphere:7.0.0.21
|
||||||
container_name: was700
|
container_name: was700
|
||||||
|
environment:
|
||||||
|
JAVA_OPTS: -Xshareclasses:none
|
||||||
ports:
|
ports:
|
||||||
- "9080:9080"
|
- "9080:9080"
|
||||||
- "9060:9060"
|
- "9060:9060"
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
services:
|
||||||
|
was905:
|
||||||
|
image: reajason/websphere:9.0.5.17
|
||||||
|
container_name: was905
|
||||||
|
ports:
|
||||||
|
- "9080:9080"
|
||||||
|
- "9060:9060"
|
||||||
|
- "5005:5005"
|
||||||
|
environment:
|
||||||
|
JAVA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
|
||||||
|
volumes:
|
||||||
|
- ../../../vul/vul-webapp/build/libs/vul-webapp.war:/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war
|
||||||
@@ -530,6 +530,10 @@ public class ShellAssertion {
|
|||||||
if (listStdout.contains("executable file not found")) {
|
if (listStdout.contains("executable file not found")) {
|
||||||
listResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/bin/java", "-jar", jarPath);
|
listResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/bin/java", "-jar", jarPath);
|
||||||
listStdout = listResult.getStdout();
|
listStdout = listResult.getStdout();
|
||||||
|
if (listStdout.contains("no such file or directory")) {
|
||||||
|
listResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/8.0/jre/bin/java", "-jar", jarPath);
|
||||||
|
listStdout = listResult.getStdout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.info("list processes output:\n{}", listStdout);
|
log.info("list processes output:\n{}", listStdout);
|
||||||
System.out.println("list stderr: " + listResult.getStderr());
|
System.out.println("list stderr: " + listResult.getStderr());
|
||||||
@@ -542,10 +546,14 @@ public class ShellAssertion {
|
|||||||
if (attachStdout.contains("executable file not found")) {
|
if (attachStdout.contains("executable file not found")) {
|
||||||
attachResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/bin/java", "-jar", jarPath, "all");
|
attachResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/bin/java", "-jar", jarPath, "all");
|
||||||
attachStdout = attachResult.getStdout();
|
attachStdout = attachResult.getStdout();
|
||||||
|
if (attachStdout.contains("no such file or directory")) {
|
||||||
|
attachResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/8.0/jre/bin/java", "-jar", jarPath, "all");
|
||||||
|
attachStdout = attachResult.getStdout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.info("attach all output:\n{}", attachStdout);
|
log.info("attach all output:\n{}", attachStdout);
|
||||||
System.out.println("attach all stderr: " + attachResult.getStderr());
|
System.out.println("attach all stderr: " + attachResult.getStderr());
|
||||||
assertThat("Attach all should complete with ok", attachStdout, containsString("ok"));
|
assertThat("Attach all should complete with Success", attachStdout, containsString("Success"));
|
||||||
|
|
||||||
// Test 3: Verify shell injection was successful
|
// Test 3: Verify shell injection was successful
|
||||||
String paramName = ((CommandConfig) shellToolConfig).getParamName();
|
String paramName = ((CommandConfig) shellToolConfig).getParamName();
|
||||||
|
|||||||
+2
@@ -15,6 +15,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
@@ -28,6 +29,7 @@ public class WebSphere700ContainerTest extends AbstractContainerTest {
|
|||||||
"reajason/websphere:7.0.0.21",
|
"reajason/websphere:7.0.0.21",
|
||||||
"/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war")
|
"/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war")
|
||||||
.targetJdkVersion(Opcodes.V1_6)
|
.targetJdkVersion(Opcodes.V1_6)
|
||||||
|
.env(Map.of("JAVA_OPTS", "-Xshareclasses:none"))
|
||||||
.waitStrategy(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
.waitStrategy(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
||||||
.supportedShellTypes(List.of(
|
.supportedShellTypes(List.of(
|
||||||
ShellType.SERVLET,
|
ShellType.SERVLET,
|
||||||
|
|||||||
Reference in New Issue
Block a user