rendered paste bodyimport com.sun.org.apache.bcel.internal.classfile.ClassParser;import com.sun.org.apache.bcel.internal.classfile.JavaClass;import com.sun.org.apache.bcel.internal.classfile.Method;import com.sun.org.apache.bcel.internal.classfile.Field;import com.sun.org.apache.bcel.internal.classfile.Attribute;import com.sun.org.apache.bcel.internal.generic.*;import com.sun.org.apache.bcel.internal.util.InstructionFinder;import com.sun.org.apache.bcel.internal.Constants;import java.lang.instrument.ClassFileTransformer;import java.security.ProtectionDomain;import java.io.ByteArrayInputStream;import java.util.Iterator;import java.math.*;public class Transformer implements ClassFileTransformer{ gui mainFrame = new gui(); public byte[] transform( ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classFileBuffer) { // mainFrame.add("Starting javaagent"); if (className.contains("/")) { return classFileBuffer; } try { ClassGen clazz = new ClassGen(new ClassParser(new ByteArrayInputStream(classFileBuffer), null).parse()); ConstantPoolGen cpg = clazz.getConstantPool(); for (Method m : clazz.getMethods()) { if(m.getName().equals("random")) { mainFrame.add("Found the Math class and the random() function");// MethodGen methodGen = new MethodGen(m, className,cpg);// InstructionList il = methodGen.getInstructionList();// Iterator<InstructionHandle> ilit = il.iterator();// while (ilit.hasNext())// {// Instruction instruction = ilit.next().getInstruction();// if (instruction instanceof SIPUSH)// {// int val = ((SIPUSH) (instruction)).getValue().intValue();// if (val < 400 || val > 800 || val == 503 || val == 765)// {// continue;// }// mainFrame.add("Client Version: "+ val);// }// } } } // !for } // !try catch (Exception e) { e.printStackTrace(); return classFileBuffer; } return classFileBuffer; } // !function} // !class