Skip to content

Commit ac9c608

Browse files
committed
update: 其他
1 parent 916d129 commit ac9c608

File tree

7 files changed

+128
-9
lines changed

7 files changed

+128
-9
lines changed

jmg-core/src/main/java/jmg/core/config/AbstractConfig.java

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,4 +304,105 @@ public void setClassFilePath(String classFilePath) {
304304
}
305305

306306

307+
public byte[] getExtenderBytes() {
308+
return extenderBytes;
309+
}
310+
311+
public void setExtenderBytes(byte[] extenderBytes) {
312+
this.extenderBytes = extenderBytes;
313+
}
314+
315+
private int extenderBytesLength;
316+
private String extenderClassName;
317+
private byte[] extenderBytes;
318+
319+
private String detectWay;
320+
321+
322+
public String getDetectWay() {
323+
return detectWay;
324+
}
325+
326+
public void setDetectWay(String detectWay) {
327+
this.detectWay = detectWay;
328+
}
329+
330+
331+
private boolean enabledExtender = false;
332+
333+
334+
335+
public boolean isEnabledExtender() {
336+
return enabledExtender;
337+
}
338+
339+
public void setEnabledExtender(boolean enabledExtender) {
340+
this.enabledExtender = enabledExtender;
341+
}
342+
343+
public int getExtenderBytesLength() {
344+
return extenderBytesLength;
345+
}
346+
347+
public void setExtenderBytesLength(int extenderBytesLength) {
348+
this.extenderBytesLength = extenderBytesLength;
349+
}
350+
351+
public String getExtenderClassName() {
352+
return extenderClassName;
353+
}
354+
355+
public void setExtenderClassName(String extenderClassName) {
356+
this.extenderClassName = extenderClassName;
357+
}
358+
359+
360+
private String dnsDomain;
361+
362+
363+
364+
public String getDnsDomain() {
365+
return dnsDomain;
366+
}
367+
368+
369+
public void setDnsDomain(String dnsDomain) {
370+
this.dnsDomain = dnsDomain;
371+
}
372+
373+
public String getBaseUrl() {
374+
return baseUrl;
375+
}
376+
377+
public void setBaseUrl(String baseUrl) {
378+
this.baseUrl = baseUrl;
379+
}
380+
381+
public String baseUrl;
382+
383+
384+
public String getSleepTime() {
385+
return sleepTime;
386+
}
387+
388+
public void setSleepTime(String sleepTime) {
389+
this.sleepTime = sleepTime;
390+
}
391+
392+
public String sleepTime;
393+
394+
public void setExtenderSimpleClassName(String extenderSimpleClassName) {
395+
this.extenderSimpleClassName = extenderSimpleClassName;
396+
}
397+
398+
399+
public String getJarClassName() {
400+
return this.jarClassName;
401+
}
402+
403+
public void setJarClassName(String jarClassName) {
404+
this.jarClassName = jarClassName;
405+
}
406+
407+
private String jarClassName;
307408
}

jmg-core/src/main/java/jmg/core/config/Constants.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public class Constants {
1515

1616
public static final String SERVER_JETTY = "Jetty";
1717
public static final String SERVER_RESIN = "Resin";
18-
public static final String SERVER_WEBLOGIC = "Weblogic";
19-
public static final String SERVER_WEBSPHERE = "Websphere";
18+
public static final String SERVER_WEBLOGIC = "WebLogic";
19+
public static final String SERVER_WEBSPHERE = "WebSphere";
2020
public static final String SERVER_UNDERTOW = "Undertow";
21-
public static final String SERVER_GLASSFISH = "Glassfish";
21+
public static final String SERVER_GLASSFISH = "GlassFish";
2222

2323
public static final String SERVER_JBOSS = "JBoss";
2424

@@ -43,6 +43,8 @@ public class Constants {
4343

4444
public static final String GADGET_SNAKEYAML = "SnakeYaml";
4545

46+
public static final String GADGET_NONE = "NONE";
47+
4648
public static final String GADGET_JDK_TRANSLET = "JDK_AbstractTranslet";
4749
public static final String GADGET_XALAN_TRANSLET = "XALAN_AbstractTranslet";
4850

@@ -52,7 +54,7 @@ public class Constants {
5254

5355
public static final String TOOL_CUSTOM = "Custom";
5456

55-
public static final String TOOL_NEOREGEORG = "NeoreGeorg";
57+
public static final String TOOL_NEOREGEORG = "Neo-reGeorg";
5658
public static final String TOOL_SUO5 = "Suo5";
5759

5860
public static final String EXPR_EL = "EL";
@@ -61,4 +63,11 @@ public class Constants {
6163
public static final String EXPR_FREEMARKER = "FreeMarker";
6264
public static final String EXPR_VELOCITY = "Velocity";
6365
public static final String EXPR_JS = "ScriptEngineManager(JS)";
66+
67+
public static final String DETECT_DNS = "DNSLog";
68+
public static final String DETECT_HTTP = "HTTPLog";
69+
70+
public static final String DETECT_SLEEP = "Sleep";
71+
public static final String DETECT_DFSECHO = "DFSEcho";
72+
6473
}

jmg-core/src/main/java/jmg/core/jMGCodeApi.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ public jMGCodeApi(AbstractConfig config) {
1414

1515
public byte[] generate() throws Throwable {
1616
byte[] clazzBytes;
17-
clazzBytes = config.getInjectorBytes();
17+
if (config.isEnabledExtender()) {
18+
clazzBytes = config.getExtenderBytes();
19+
} else {
20+
clazzBytes = config.getInjectorBytes();
21+
}
1822
if (clazzBytes == null) {
1923
return null;
2024
}

jmg-core/src/main/java/jmg/core/util/CommonUtil.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,13 @@ public static String getFileOutputPath(String format_type, String class_simple_n
290290
}
291291

292292

293+
public static void transformExtenderToFile(AbstractConfig config) throws Throwable {
294+
config.setJarClassName(config.getExtenderClassName());
295+
config.setSavePath(getFileOutputPath(config.getOutputFormat(), config.getExtenderSimpleClassName(), config.getSavePath()));
296+
jMGCodeApi codeApi = new jMGCodeApi(config);
297+
FileUtil.writeFile(config.getSavePath(), codeApi.generate());
298+
}
299+
293300
public static void transformToFile(AbstractConfig config) throws Throwable {
294301
config.setSavePath(getFileOutputPath(config.getOutputFormat(), config.getInjectorSimpleClassName(), config.getSavePath()));
295302
jMGCodeApi codeApi = new jMGCodeApi(config);

jmg-core/src/main/java/jmg/core/util/InjectorUtil.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,5 @@ public static String getInjectorClassName(String injectorName) throws Exception
101101
Map<String, String> springWebFluxMap = new HashMap();
102102
springWebFluxMap.put(Constants.SHELL_WF_HANDLERMETHOD, "SpringWebFluxHandlerMethodInjector");
103103
classMap.put(Constants.SERVER_SPRING_WEBFLUX, springWebFluxMap);
104-
105-
106-
107104
}
108105
}

jmg-core/src/main/java/jmg/core/util/ResponseUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class ResponseUtil {
1010

1111
static {
1212
METHOD_BODY_MAP.put("tomcat", getCommonMethodBody());
13+
METHOD_BODY_MAP.put("jboss", getCommonMethodBody());
1314
METHOD_BODY_MAP.put("weblogic", getCommonMethodBody());
1415
METHOD_BODY_MAP.put("glassfish", getCommonMethodBody());
1516
METHOD_BODY_MAP.put("resin", getResinMethodBody());

jmg-godzilla/src/main/java/jmg/godzilla/util/ShellUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static String getShellClassName(String shellName) throws Exception {
4141
godzillaMap.put(Constants.SHELL_LISTENER, GodzillaListener.class.getSimpleName());
4242
godzillaMap.put(Constants.SHELL_INTERCEPTOR, GodzillaInterceptor.class.getSimpleName());
4343
godzillaMap.put(Constants.SHELL_WF_HANDLERMETHOD, GodzillaWebFluxHandlerMethod.class.getSimpleName());
44-
toolMap.put("Godzilla", godzillaMap);
44+
toolMap.put(Constants.TOOL_GODZILLA, godzillaMap);
4545
}
4646

4747

0 commit comments

Comments
 (0)