mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 23:11:52 +08:00
feat: support boot-ui
This commit is contained in:
@@ -13,8 +13,6 @@ import net.bytebuddy.matcher.ElementMatchers;
|
||||
import net.bytebuddy.pool.TypePool;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
@@ -88,7 +86,7 @@ class LogRemoveVisitorWrapperTest {
|
||||
.method(ElementMatchers.any(), LogRemoveMethodVisitor.INSTANCE))
|
||||
.make();
|
||||
byte[] bytes = make.getBytes();
|
||||
Files.write(Paths.get("xx.class"), bytes);
|
||||
// Files.write(Paths.get("xx.class"), bytes);
|
||||
Class<?> modifiedClass = make.load(getClass().getClassLoader()).getLoaded();
|
||||
Object instance = modifiedClass.getDeclaredConstructor().newInstance();
|
||||
modifiedClass.getMethod("methodWithLogs").invoke(instance);
|
||||
|
||||
File diff suppressed because one or more lines are too long
+3
-3
@@ -33,13 +33,13 @@ class CommandFilterTest {
|
||||
void generate(Class<?> clazz, String className) {
|
||||
ShellConfig generateConfig = new ShellConfig();
|
||||
CommandConfig shellConfig = CommandConfig.builder()
|
||||
.clazz(clazz)
|
||||
.className(className)
|
||||
.shellClass(clazz)
|
||||
.shellClassName(className)
|
||||
.paramName("cmd")
|
||||
.build();
|
||||
byte[] bytes = CommandGenerator.generate(generateConfig, shellConfig);
|
||||
Object obj = ClassUtils.newInstance(bytes);
|
||||
assertEquals(shellConfig.getClassName(), obj.getClass().getName());
|
||||
assertEquals(shellConfig.getShellClassName(), obj.getClass().getName());
|
||||
assertEquals(shellConfig.getParamName(), ClassUtils.getFieldValue(obj, "paramName"));
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -40,12 +40,12 @@ class GodzillaTest {
|
||||
@MethodSource("casesProvider")
|
||||
void generate(Class<?> clazz, String className) {
|
||||
GodzillaConfig shellConfig = shellConfigBuilder
|
||||
.className(className)
|
||||
.clazz(clazz)
|
||||
.shellClassName(className)
|
||||
.shellClass(clazz)
|
||||
.build();
|
||||
byte[] bytes = new GodzillaGenerator(config, shellConfig).getBytes();
|
||||
Object obj = ClassUtils.newInstance(bytes);
|
||||
assertEquals(shellConfig.getClassName(), obj.getClass().getName());
|
||||
assertEquals(shellConfig.getShellClassName(), obj.getClass().getName());
|
||||
assertEquals(shellConfig.getPass(), ClassUtils.getFieldValue(obj, "pass"));
|
||||
assertEquals(shellConfig.getHeaderName(), ClassUtils.getFieldValue(obj, "headerName"));
|
||||
assertEquals(shellConfig.getHeaderValue(), ClassUtils.getFieldValue(obj, "headerValue"));
|
||||
|
||||
Reference in New Issue
Block a user