update: 其他

This commit is contained in:
pen4uin
2024-08-24 00:46:36 +08:00
parent 916d12982f
commit ac9c608699
7 changed files with 128 additions and 9 deletions
@@ -304,4 +304,105 @@ public class AbstractConfig {
}
public byte[] getExtenderBytes() {
return extenderBytes;
}
public void setExtenderBytes(byte[] extenderBytes) {
this.extenderBytes = extenderBytes;
}
private int extenderBytesLength;
private String extenderClassName;
private byte[] extenderBytes;
private String detectWay;
public String getDetectWay() {
return detectWay;
}
public void setDetectWay(String detectWay) {
this.detectWay = detectWay;
}
private boolean enabledExtender = false;
public boolean isEnabledExtender() {
return enabledExtender;
}
public void setEnabledExtender(boolean enabledExtender) {
this.enabledExtender = enabledExtender;
}
public int getExtenderBytesLength() {
return extenderBytesLength;
}
public void setExtenderBytesLength(int extenderBytesLength) {
this.extenderBytesLength = extenderBytesLength;
}
public String getExtenderClassName() {
return extenderClassName;
}
public void setExtenderClassName(String extenderClassName) {
this.extenderClassName = extenderClassName;
}
private String dnsDomain;
public String getDnsDomain() {
return dnsDomain;
}
public void setDnsDomain(String dnsDomain) {
this.dnsDomain = dnsDomain;
}
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public String baseUrl;
public String getSleepTime() {
return sleepTime;
}
public void setSleepTime(String sleepTime) {
this.sleepTime = sleepTime;
}
public String sleepTime;
public void setExtenderSimpleClassName(String extenderSimpleClassName) {
this.extenderSimpleClassName = extenderSimpleClassName;
}
public String getJarClassName() {
return this.jarClassName;
}
public void setJarClassName(String jarClassName) {
this.jarClassName = jarClassName;
}
private String jarClassName;
}
@@ -15,10 +15,10 @@ public class Constants {
public static final String SERVER_JETTY = "Jetty";
public static final String SERVER_RESIN = "Resin";
public static final String SERVER_WEBLOGIC = "Weblogic";
public static final String SERVER_WEBSPHERE = "Websphere";
public static final String SERVER_WEBLOGIC = "WebLogic";
public static final String SERVER_WEBSPHERE = "WebSphere";
public static final String SERVER_UNDERTOW = "Undertow";
public static final String SERVER_GLASSFISH = "Glassfish";
public static final String SERVER_GLASSFISH = "GlassFish";
public static final String SERVER_JBOSS = "JBoss";
@@ -43,6 +43,8 @@ public class Constants {
public static final String GADGET_SNAKEYAML = "SnakeYaml";
public static final String GADGET_NONE = "NONE";
public static final String GADGET_JDK_TRANSLET = "JDK_AbstractTranslet";
public static final String GADGET_XALAN_TRANSLET = "XALAN_AbstractTranslet";
@@ -52,7 +54,7 @@ public class Constants {
public static final String TOOL_CUSTOM = "Custom";
public static final String TOOL_NEOREGEORG = "NeoreGeorg";
public static final String TOOL_NEOREGEORG = "Neo-reGeorg";
public static final String TOOL_SUO5 = "Suo5";
public static final String EXPR_EL = "EL";
@@ -61,4 +63,11 @@ public class Constants {
public static final String EXPR_FREEMARKER = "FreeMarker";
public static final String EXPR_VELOCITY = "Velocity";
public static final String EXPR_JS = "ScriptEngineManager(JS)";
public static final String DETECT_DNS = "DNSLog";
public static final String DETECT_HTTP = "HTTPLog";
public static final String DETECT_SLEEP = "Sleep";
public static final String DETECT_DFSECHO = "DFSEcho";
}
@@ -14,7 +14,11 @@ public class jMGCodeApi {
public byte[] generate() throws Throwable {
byte[] clazzBytes;
if (config.isEnabledExtender()) {
clazzBytes = config.getExtenderBytes();
} else {
clazzBytes = config.getInjectorBytes();
}
if (clazzBytes == null) {
return null;
}
@@ -290,6 +290,13 @@ public class CommonUtil {
}
public static void transformExtenderToFile(AbstractConfig config) throws Throwable {
config.setJarClassName(config.getExtenderClassName());
config.setSavePath(getFileOutputPath(config.getOutputFormat(), config.getExtenderSimpleClassName(), config.getSavePath()));
jMGCodeApi codeApi = new jMGCodeApi(config);
FileUtil.writeFile(config.getSavePath(), codeApi.generate());
}
public static void transformToFile(AbstractConfig config) throws Throwable {
config.setSavePath(getFileOutputPath(config.getOutputFormat(), config.getInjectorSimpleClassName(), config.getSavePath()));
jMGCodeApi codeApi = new jMGCodeApi(config);
@@ -101,8 +101,5 @@ public class InjectorUtil {
Map<String, String> springWebFluxMap = new HashMap();
springWebFluxMap.put(Constants.SHELL_WF_HANDLERMETHOD, "SpringWebFluxHandlerMethodInjector");
classMap.put(Constants.SERVER_SPRING_WEBFLUX, springWebFluxMap);
}
}
@@ -10,6 +10,7 @@ public class ResponseUtil {
static {
METHOD_BODY_MAP.put("tomcat", getCommonMethodBody());
METHOD_BODY_MAP.put("jboss", getCommonMethodBody());
METHOD_BODY_MAP.put("weblogic", getCommonMethodBody());
METHOD_BODY_MAP.put("glassfish", getCommonMethodBody());
METHOD_BODY_MAP.put("resin", getResinMethodBody());
@@ -41,7 +41,7 @@ public class ShellUtil {
godzillaMap.put(Constants.SHELL_LISTENER, GodzillaListener.class.getSimpleName());
godzillaMap.put(Constants.SHELL_INTERCEPTOR, GodzillaInterceptor.class.getSimpleName());
godzillaMap.put(Constants.SHELL_WF_HANDLERMETHOD, GodzillaWebFluxHandlerMethod.class.getSimpleName());
toolMap.put("Godzilla", godzillaMap);
toolMap.put(Constants.TOOL_GODZILLA, godzillaMap);
}