feat: support AntSword shell generate (#34)

This commit is contained in:
ReaJason
2025-02-19 00:04:29 +08:00
parent f38b72fb5f
commit 2f256fc97e
98 changed files with 2860 additions and 152 deletions
@@ -1,6 +1,7 @@
package com.reajason.javaweb.integration;
import com.reajason.javaweb.GeneratorMain;
import com.reajason.javaweb.antsword.AntSwordManager;
import com.reajason.javaweb.behinder.BehinderManager;
import com.reajason.javaweb.godzilla.GodzillaManager;
import com.reajason.javaweb.memshell.SpringWebFluxShell;
@@ -92,6 +93,9 @@ public class ShellAssertionTool {
case Suo5:
testSuo5IsOk(shellUrl, ((Suo5Config) generateResult.getShellToolConfig()));
break;
case AntSword:
testAntSwordIsOk(shellUrl, ((AntSwordConfig) generateResult.getShellToolConfig()));
break;
}
}
@@ -137,6 +141,15 @@ public class ShellAssertionTool {
assertTrue(Suo5Manager.test(entrypoint, shellConfig.getHeaderValue()));
}
public static void testAntSwordIsOk(String entrypoint, AntSwordConfig shellConfig) {
AntSwordManager antSwordManager = AntSwordManager.builder()
.entrypoint(entrypoint)
.pass(shellConfig.getPass())
.header(shellConfig.getHeaderName()
, shellConfig.getHeaderValue()).build();
assertTrue(antSwordManager.getInfo().contains("ok"));
}
public static GenerateResult generate(String urlPattern, Server server, String shellType, ShellTool shellTool, int targetJdkVersion, Packers packer) {
InjectorConfig injectorConfig = new InjectorConfig();
if (StringUtils.isNotBlank(urlPattern)) {
@@ -185,6 +198,15 @@ public class ShellAssertionTool {
.build();
log.info("generated {} suo5 with headerValue: {}", shellType, uniqueName);
break;
case AntSword:
String antPassword = "ant";
shellToolConfig = AntSwordConfig.builder()
.pass(antPassword)
.headerName("User-Agent")
.headerValue(uniqueName)
.build();
log.info("generated {} antSword with pass: {}, headerValue: {}", shellType, antPassword, uniqueName);
break;
}
return GeneratorMain.generate(shellConfig, injectorConfig, shellToolConfig);
}