fix: tomcat6 jsp LinkageError

This commit is contained in:
ReaJason
2024-12-14 20:40:18 +08:00
parent 63207195a2
commit 28a34cbf89
6 changed files with 24 additions and 8 deletions
@@ -20,10 +20,10 @@ public class GeneratorMain {
public static void main(String[] args) throws IOException {
ShellConfig shellConfig = ShellConfig.builder()
.server(Server.Resin)
.server(Server.Tomcat)
.shellTool(ShellTool.Command)
.shellType(Constants.FILTER)
.targetJreVersion(Opcodes.V11)
.targetJreVersion(Opcodes.V1_6)
.build();
GodzillaConfig godzillaConfig = GodzillaConfig.builder()
.pass("pass")
@@ -34,10 +34,10 @@ public class GeneratorMain {
InjectorConfig injectorConfig = new InjectorConfig();
GenerateResult generateResult = generate(shellConfig, injectorConfig, commandConfig);
if (generateResult != null) {
Files.write(Paths.get(generateResult.getInjectorClassName() + ".class"), generateResult.getInjectorBytes(), StandardOpenOption.CREATE_NEW);
Files.write(Paths.get(generateResult.getShellClassName() + ".class"), generateResult.getShellBytes(), StandardOpenOption.CREATE_NEW);
// Files.write(Paths.get(generateResult.getInjectorClassName() + ".class"), generateResult.getInjectorBytes(), StandardOpenOption.CREATE_NEW);
// Files.write(Paths.get(generateResult.getShellClassName() + ".class"), generateResult.getShellBytes(), StandardOpenOption.CREATE_NEW);
System.out.println(Base64.encodeBase64String(generateResult.getInjectorBytes()));
System.out.println(Base64.encodeBase64String(Packer.INSTANCE.JSP.getPacker().pack(generateResult)));
System.out.println(new String(Packer.INSTANCE.JSP.getPacker().pack(generateResult)));
}
}
@@ -50,7 +50,6 @@ public class ShellAssertionTool {
}
public static void assertInjectIsOk(String url, String shellType, ShellTool shellTool, byte[] content, Packer.INSTANCE packer) {
log.info(new String(content));
switch (packer) {
case JSP -> {
String uploadEntry = url + "/upload";
@@ -50,7 +50,7 @@ public class VulTool {
.url(uploadUrl).post(requestBody)
.build();
try (Response response = new OkHttpClient().newCall(request).execute()) {
log.info(response.body().string());
// log.info(response.body().string());
Assertions.assertNotEquals(404, response.code());
}
}
@@ -58,6 +58,7 @@ public class Tomcat6ContainerTest {
@AfterAll
static void tearDown() {
String logs = container.getLogs();
log.info(logs);
assertThat("Logs should not contain any exceptions", logs, doesNotContainException());
}
+1 -1
View File
@@ -21,6 +21,6 @@ dependencies {
implementation 'org.apache.velocity:velocity:1.7'
implementation 'ognl:ognl:2.7.3'
implementation 'org.springframework:spring-expression:4.3.30.RELEASE'
implementation 'de.odysseus.juel:juel-api:2.2.7'
providedCompile 'de.odysseus.juel:juel-api:2.2.7'
providedCompile "javax.servlet:servlet-api:2.5"
}
+16
View File
@@ -0,0 +1,16 @@
<%--
Created by IntelliJ IDEA.
User: ReaJason
Date: 2024/12/14
Time: 20:29
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>