mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
feat: support appendLambdaSuffix
This commit is contained in:
@@ -46,6 +46,11 @@ public class MemShellGenerator {
|
||||
injectorConfig.setInjectorClassName(CommonUtil.generateInjectorClassName());
|
||||
}
|
||||
|
||||
if (shellConfig.isLambdaSuffix()) {
|
||||
shellToolConfig.setShellClassName(CommonUtil.appendLambdaSuffix(shellToolConfig.getShellClassName()));
|
||||
injectorConfig.setInjectorClassName(CommonUtil.appendLambdaSuffix(injectorConfig.getInjectorClassName()));
|
||||
}
|
||||
|
||||
byte[] shellBytes = ShellToolFactory.generateBytes(shellConfig, shellToolConfig);
|
||||
|
||||
injectorConfig.setInjectorClass(injectorClass);
|
||||
|
||||
@@ -61,6 +61,12 @@ public class ShellConfig {
|
||||
@Builder.Default
|
||||
private boolean shrink = false;
|
||||
|
||||
/**
|
||||
* 追加 Lambda 类名后缀
|
||||
*/
|
||||
@Builder.Default
|
||||
private boolean lambdaSuffix = false;
|
||||
|
||||
public boolean isDebugOff() {
|
||||
return !debug;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ public class ProbeShellGenerator {
|
||||
if (StringUtils.isBlank(probeConfig.getShellClassName())) {
|
||||
probeConfig.setShellClassName(CommonUtil.generateInjectorClassName());
|
||||
}
|
||||
if (probeConfig.isLambdaSuffix()) {
|
||||
probeConfig.setShellClassName(CommonUtil.appendLambdaSuffix(probeConfig.getShellClassName()));
|
||||
}
|
||||
byte[] bytes = probeConfig.getProbeMethod().generateBytes(probeConfig, contentConfig);
|
||||
return ProbeShellResult.builder()
|
||||
.shellClassName(probeConfig.getShellClassName())
|
||||
|
||||
@@ -53,6 +53,12 @@ public class ProbeConfig {
|
||||
@Builder.Default
|
||||
private boolean staticInitialize = false;
|
||||
|
||||
/**
|
||||
* 追加 Lambda 类名后缀
|
||||
*/
|
||||
@Builder.Default
|
||||
private boolean lambdaSuffix = false;
|
||||
|
||||
public boolean isDebugOff() {
|
||||
return !debug;
|
||||
}
|
||||
|
||||
@@ -101,6 +101,13 @@ public class CommonUtil {
|
||||
return getRandomPackageName() + "." + INJECTOR_CLASS_NAMES[new Random().nextInt(INJECTOR_CLASS_NAMES.length)];
|
||||
}
|
||||
|
||||
public static String appendLambdaSuffix(String className) {
|
||||
if (className.contains("$Lambda$")) {
|
||||
return className;
|
||||
}
|
||||
return className + "$Proxy0$$Lambda$1";
|
||||
}
|
||||
|
||||
public static String generateShellClassName(String server, String shellType) {
|
||||
String packageName;
|
||||
switch (server) {
|
||||
|
||||
Reference in New Issue
Block a user