mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
refactor: use commonUtil for packageName
This commit is contained in:
+3
-7
@@ -278,13 +278,9 @@ public class TomcatFilterInjector {
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public static Object getFieldValue(Object obj, String name) throws NoSuchFieldException, IllegalAccessException {
|
||||
try {
|
||||
Field field = getField(obj, name);
|
||||
field.setAccessible(true);
|
||||
return field.get(obj);
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
}
|
||||
return null;
|
||||
Field field = getField(obj, name);
|
||||
field.setAccessible(true);
|
||||
return field.get(obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
-6
@@ -42,7 +42,6 @@ public class TomcatFilterProbe {
|
||||
if (filterMaps == null || filterMaps.length == 0) return Collections.emptyList();
|
||||
|
||||
Object[] filterDefs = (Object[]) invokeMethod(context, "findFilterDefs");
|
||||
Map<?, ?> filterConfigs = (Map<?, ?>) getFieldValue(context, "filterConfigs");
|
||||
|
||||
for (Object fm : filterMaps) {
|
||||
String name = (String) invokeMethod(fm, "getFilterName");
|
||||
@@ -53,8 +52,8 @@ public class TomcatFilterProbe {
|
||||
for (Object def : filterDefs) {
|
||||
if (!name.equals(invokeMethod(def, "getFilterName"))) continue;
|
||||
String cls = (String) invokeMethod(def, "getFilterClass");
|
||||
if ((cls == null || "N/A".equals(cls)) && filterConfigs != null) {
|
||||
Object config = filterConfigs.get(name);
|
||||
if (cls == null) {
|
||||
Object config = invokeMethod(context, "findFilterConfig", new Class[]{String.class}, new Object[]{name});
|
||||
Object filter = config != null ? invokeMethod(config, "getFilter") : null;
|
||||
if (filter != null) cls = filter.getClass().getName();
|
||||
}
|
||||
@@ -194,10 +193,12 @@ public class TomcatFilterProbe {
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public static Object invokeMethod(Object obj, String methodName){
|
||||
return invokeMethod(obj, methodName, null, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public static Object invokeMethod(Object obj, String methodName) {
|
||||
Class<?>[] paramClazz = null;
|
||||
Object[] param = null;
|
||||
public static Object invokeMethod(Object obj, String methodName, Class<?>[] paramClazz, Object[] param) {
|
||||
try {
|
||||
Class<?> clazz = (obj instanceof Class) ? (Class<?>) obj : obj.getClass();
|
||||
Method method = null;
|
||||
|
||||
@@ -111,38 +111,35 @@ public class CommonUtil {
|
||||
return className + "$Proxy0$$Lambda$1";
|
||||
}
|
||||
|
||||
public static String generateShellClassName(String server, String shellType) {
|
||||
String packageName;
|
||||
public static String getWebPackageNameForServer(String server) {
|
||||
switch (server) {
|
||||
case Jetty:
|
||||
packageName = "org.eclipse.jetty.servlet.handlers";
|
||||
break;
|
||||
return "org.eclipse.jetty.servlet.handlers";
|
||||
case Undertow:
|
||||
packageName = "io.undertow.servlet.handlers";
|
||||
break;
|
||||
return "io.undertow.servlet.handlers";
|
||||
case SpringWebMvc:
|
||||
packageName = "org.springframework.boot.mvc.handlers";
|
||||
break;
|
||||
return "org.springframework.boot.mvc.handlers";
|
||||
case SpringWebFlux:
|
||||
packageName = "org.springframework.boot.webflux.handlers";
|
||||
break;
|
||||
return "org.springframework.boot.webflux.handlers";
|
||||
case WebSphere:
|
||||
packageName = "com.ibm.ws.webcontainer.handlers";
|
||||
break;
|
||||
return "com.ibm.ws.webcontainer.handlers";
|
||||
case WebLogic:
|
||||
packageName = "weblogic.servlet.internal.handlers";
|
||||
break;
|
||||
return "weblogic.servlet.internal.handlers";
|
||||
case Resin:
|
||||
packageName = "com.caucho.server.dispatch.handlers";
|
||||
break;
|
||||
return "com.caucho.server.dispatch.handlers";
|
||||
case BES:
|
||||
packageName = "com.bes.enterprise.webtier.web.handlers";
|
||||
break;
|
||||
return "com.bes.enterprise.webtier.web.handlers";
|
||||
case Apusic:
|
||||
return "com.apusic.web.handlers";
|
||||
case InforSuite:
|
||||
return "com.cvicse.inforsuite.web.handlers";
|
||||
default:
|
||||
packageName = "org.apache.http.web.handlers";
|
||||
break;
|
||||
return "org.apache.http.web.handlers";
|
||||
}
|
||||
return packageName
|
||||
}
|
||||
|
||||
public static String generateShellClassName(String server, String shellType) {
|
||||
return getWebPackageNameForServer(server)
|
||||
+ "." + getRandomString(5)
|
||||
+ "." + MIDDLEWARE_NAMES[new Random().nextInt(MIDDLEWARE_NAMES.length)] + shellType;
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -107,6 +108,6 @@ public class GlassFish3ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -20,7 +21,6 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
import static com.reajason.javaweb.integration.ContainerTool.getUrl;
|
||||
@@ -108,6 +108,6 @@ public class GlassFish4ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -100,6 +101,6 @@ public class GlassFish501ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -101,6 +102,6 @@ public class GlassFish510ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -101,6 +102,6 @@ public class GlassFish6ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -107,6 +108,6 @@ public class GlassFish7ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -96,6 +97,6 @@ public class Jboss423ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.JBoss))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -94,6 +95,6 @@ public class Jboss510ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.JBoss))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -94,6 +95,6 @@ public class Jboss610ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.JBoss))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -94,6 +95,6 @@ public class Jboss711ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.JBoss))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -106,6 +107,6 @@ public class Payara5201ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -100,6 +101,6 @@ public class Payara520225ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@@ -101,6 +102,6 @@ public class Payara620222ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getGlassFishFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.GlassFish))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -108,6 +109,6 @@ public class Tomcat10ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -95,6 +96,6 @@ public class Tomcat11ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.bytebuddy.jar.asm.Opcodes;
|
||||
@@ -96,6 +97,6 @@ public class Tomcat11JRE21ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -109,6 +110,6 @@ public class Tomcat5ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -101,6 +102,6 @@ public class Tomcat6ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -103,6 +104,6 @@ public class Tomcat7ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -105,6 +106,6 @@ public class Tomcat8ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.reajason.javaweb.integration.probe.DetectionTool;
|
||||
import com.reajason.javaweb.memshell.ShellTool;
|
||||
import com.reajason.javaweb.memshell.ShellType;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
import com.reajason.javaweb.utils.CommonUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -95,6 +96,6 @@ public class Tomcat9ContainerTest {
|
||||
String data = VulTool.post(url + "/b64", DetectionTool.getTomcatFilterProbe());
|
||||
List<String> filter = ProbeAssertion.getFiltersForContext(data, "/app");
|
||||
String filterName = ProbeAssertion.extractFilterName(filter.get(0));
|
||||
assertThat(filterName, anyOf(startsWith("org.apache.http.web.handlers")));
|
||||
assertThat(filterName, anyOf(startsWith(CommonUtil.getWebPackageNameForServer(Server.Tomcat))));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user