List of usage examples for org.objectweb.asm Opcodes ACC_PRIVATE
int ACC_PRIVATE
To view the source code for org.objectweb.asm Opcodes ACC_PRIVATE.
Click Source Link
From source file:the.bytecode.club.bytecodeviewer.decompilers.bytecode.ClassNodeDecompiler.java
License:Open Source License
public static String getAccessString(int access) { List<String> tokens = new ArrayList<String>(); if ((access & Opcodes.ACC_PUBLIC) != 0) tokens.add("public"); if ((access & Opcodes.ACC_PRIVATE) != 0) tokens.add("private"); if ((access & Opcodes.ACC_PROTECTED) != 0) tokens.add("protected"); if ((access & Opcodes.ACC_FINAL) != 0) tokens.add("final"); if ((access & Opcodes.ACC_SYNTHETIC) != 0) tokens.add("synthetic"); // if ((access & Opcodes.ACC_SUPER) != 0) // tokens.add("super"); implied by invokespecial insn if ((access & Opcodes.ACC_ABSTRACT) != 0) tokens.add("abstract"); if ((access & Opcodes.ACC_INTERFACE) != 0) tokens.add("interface"); if ((access & Opcodes.ACC_ENUM) != 0) tokens.add("enum"); if ((access & Opcodes.ACC_ANNOTATION) != 0) tokens.add("annotation"); if (!tokens.contains("interface") && !tokens.contains("enum") && !tokens.contains("annotation")) tokens.add("class"); if (tokens.size() == 0) return "[Error parsing]"; // hackery delimeters StringBuilder sb = new StringBuilder(tokens.get(0)); for (int i = 1; i < tokens.size(); i++) { sb.append(" "); sb.append(tokens.get(i));/* w ww .j a va2 s .com*/ } return sb.toString(); }
From source file:the.bytecode.club.bytecodeviewer.decompilers.bytecode.FieldNodeDecompiler.java
License:Open Source License
private static String getAccessString(int access) { List<String> tokens = new ArrayList<String>(); if ((access & Opcodes.ACC_PUBLIC) != 0) tokens.add("public"); if ((access & Opcodes.ACC_PRIVATE) != 0) tokens.add("private"); if ((access & Opcodes.ACC_PROTECTED) != 0) tokens.add("protected"); if ((access & Opcodes.ACC_SYNTHETIC) != 0) tokens.add("synthetic"); if ((access & Opcodes.ACC_STATIC) != 0) tokens.add("static"); if ((access & Opcodes.ACC_FINAL) != 0) tokens.add("final"); if ((access & Opcodes.ACC_TRANSIENT) != 0) tokens.add("transient"); if ((access & Opcodes.ACC_VOLATILE) != 0) tokens.add("volatile"); if (tokens.size() == 0) return ""; // hackery delimeters StringBuilder sb = new StringBuilder(tokens.get(0)); for (int i = 1; i < tokens.size(); i++) { sb.append(" "); sb.append(tokens.get(i));/*from ww w . j a va 2 s .c o m*/ } return sb.toString(); }
From source file:the.bytecode.club.bytecodeviewer.decompilers.bytecode.MethodNodeDecompiler.java
License:Open Source License
private static String getAccessString(int access) { // public, protected, private, abstract, static, // final, synchronized, native & strictfp are permitted List<String> tokens = new ArrayList<String>(); if ((access & Opcodes.ACC_PUBLIC) != 0) tokens.add("public"); if ((access & Opcodes.ACC_PRIVATE) != 0) tokens.add("private"); if ((access & Opcodes.ACC_PROTECTED) != 0) tokens.add("protected"); if ((access & Opcodes.ACC_STATIC) != 0) tokens.add("static"); if ((access & Opcodes.ACC_ABSTRACT) != 0) tokens.add("abstract"); if ((access & Opcodes.ACC_FINAL) != 0) tokens.add("final"); if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) tokens.add("synchronized"); if ((access & Opcodes.ACC_NATIVE) != 0) tokens.add("native"); if ((access & Opcodes.ACC_STRICT) != 0) tokens.add("strictfp"); if ((access & Opcodes.ACC_BRIDGE) != 0) tokens.add("bridge"); if ((access & Opcodes.ACC_VARARGS) != 0) tokens.add("varargs"); if (tokens.size() == 0) return ""; // hackery delimeters StringBuilder sb = new StringBuilder(tokens.get(0)); for (int i = 1; i < tokens.size(); i++) { sb.append(" "); sb.append(tokens.get(i));// w w w . jav a 2 s .c o m } return sb.toString(); }
From source file:the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameMethods.java
License:Open Source License
@Override public void obfuscate() { int stringLength = getStringLength(); System.out.println("Obfuscating method names..."); for (ClassNode c : BytecodeViewer.getLoadedClasses()) { methodLoop: for (Object o : c.methods.toArray()) { MethodNode m = (MethodNode) o; /* As we dont want to rename native dll methods */ if ((m.access & Opcodes.ACC_NATIVE) != 0) continue methodLoop; if (m.access != Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PROTECTED && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PROTECTED) { if (!m.name.equals("main") && !m.name.equals("<init>") && !m.name.equals("<clinit>")) { String newName = generateUniqueName(stringLength); BytecodeViewer.refactorer.getHooks() .addMethod(new MethodMappingData(c.name, new MappingData(m.name, newName), m.desc)); /*ASMUtil_OLD.renameMethodNode(c.name, m.name, m.desc, null, newName, null);*/ }/* www .j av a 2 s .c o m*/ } } } System.out.println("Obfuscated method names."); }
From source file:the.bytecode.club.bytecodeviewer.obfuscators.RenameMethods.java
License:Open Source License
@Override public void obfuscate() { int stringLength = getStringLength(); System.out.println("Obfuscating method names..."); for (ClassNode c : BytecodeViewer.getLoadedClasses()) { for (Object o : c.methods.toArray()) { MethodNode m = (MethodNode) o; if (m.access != Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PROTECTED && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PUBLIC && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PRIVATE && m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PROTECTED) { if (!m.name.equals("main") && !m.name.equals("<init>") && !m.name.equals("<clinit>")) { String newName = generateUniqueName(stringLength); ASMUtil_OLD.renameMethodNode(c.name, m.name, m.desc, null, newName, null); }//www.ja va 2s .com } } } System.out.println("Obfuscated method names."); }
From source file:the.bytecode.club.bytecodeviewer.plugin.preinstalled.EZInjection.java
License:Open Source License
@SuppressWarnings("deprecation") @Override/*from ww w . ja va 2s. co m*/ public void execute(ArrayList<ClassNode> classNodeList) { BytecodeViewer.viewer.setIcon(true); gui.setText(""); if (console) gui.setVisible(true); if (accessModifiers) print("Setting all of the access modifiers to public/public static."); if (injectHooks) print("Injecting hook..."); if (debugHooks) print("Hooks are debugging."); else if (injectHooks) print("Hooks are not debugging."); else print("Hooks are disabled completely."); if (useProxy) print("Forcing proxy as '" + proxy + "'."); if (launchKit) print("Launching the Graphicial Reflection Kit upon a succcessful invoke of the main method."); for (ClassNode classNode : classNodeList) { for (Object o : classNode.fields.toArray()) { FieldNode f = (FieldNode) o; if (accessModifiers) { if (f.access == Opcodes.ACC_PRIVATE || f.access == Opcodes.ACC_PROTECTED) f.access = Opcodes.ACC_PUBLIC; if (f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC) f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC; if (f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL) f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL; if (f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC) f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC; } } for (Object o : classNode.methods.toArray()) { MethodNode m = (MethodNode) o; if (accessModifiers) { if (m.access == Opcodes.ACC_PRIVATE || m.access == Opcodes.ACC_PROTECTED) m.access = Opcodes.ACC_PUBLIC; if (m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC) m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC; if (m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL) m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL; if (m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC) m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC; } if (injectHooks && m.access != Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PRIVATE + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PROTECTED + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_FINAL + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC + Opcodes.ACC_ABSTRACT && m.access != Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC + Opcodes.ACC_ABSTRACT) { boolean inject = true; if (m.instructions.size() >= 2 && m.instructions.get(1) instanceof MethodInsnNode) { MethodInsnNode mn = (MethodInsnNode) m.instructions.get(1); if (mn.owner.equals("the/bytecode/club/bytecodeviewer/plugins/EZInjection")) // already // been // injected inject = false; } if (inject) { // make this function grab parameters eventually m.instructions.insert(new MethodInsnNode(Opcodes.INVOKESTATIC, "the/bytecode/club/bytecodeviewer/plugins/EZInjection", "hook", "(Ljava/lang/String;)V")); m.instructions.insert(new LdcInsnNode(classNode.name + "." + m.name + m.desc)); } } } } if (useProxy) { try { String[] split = proxy.split(":"); setProxy(split[0], split[1]); } catch (Exception e) { // ignore } } print("Done setting up."); setFinished(); if (invokeMethod) { for (ClassNode cn : BytecodeViewer.getLoadedClasses()) // load all the classnodes into the classloader the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn); print("Invoking " + invokeMethodInformation + ":" + BytecodeViewer.nl + BytecodeViewer.nl); for (ClassNode classNode : classNodeList) { for (Object o : classNode.methods.toArray()) { MethodNode m = (MethodNode) o; String methodInformation = classNode.name + "." + m.name + m.desc; if (invokeMethodInformation.equals(methodInformation)) { for (Method m2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader() .nodeToClass(classNode).getMethods()) { if (m2.getName().equals(m.name)) { try { m2.invoke(classNode.getClass().newInstance(), (Object[]) new String[1]); if (launchKit) new GraphicialReflectionKit().setVisible(true); } catch (Exception e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(); print(sw.toString()); } } } } } } } BytecodeViewer.viewer.setIcon(false); }
From source file:tk.wurst_client.hooks.injector.ClassHookInjector.java
License:Open Source License
@Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {//from w ww . j a v a 2 s.c om access = access & ~Opcodes.ACC_PRIVATE & ~Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC; super.visit(version, access, name, signature, superName, interfaces); className = name; }
From source file:tk.wurst_client.hooks.injector.ClassHookInjector.java
License:Open Source License
@Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { access = access & ~Opcodes.ACC_PRIVATE & ~Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC; return super.visitField(access, name, desc, signature, value); }
From source file:tk.wurst_client.hooks.injector.ClassHookInjector.java
License:Open Source License
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { access = access & ~Opcodes.ACC_PRIVATE & ~Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC; MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); if (classData.hasHooks() && classData.getMethod(name + desc).hasHooks()) return new MethodHookInjector(api, mv, classData.getMethod(name + desc), className, name + desc); else/*www . j a v a2s. com*/ return mv; }
From source file:travis.model.project.structure.StructUtil.java
License:Open Source License
public static Visibility getVisibility(int access) { Visibility visibility = Visibility.DEFAULT; if ((access & Opcodes.ACC_PRIVATE) == Opcodes.ACC_PRIVATE) visibility = Visibility.PRIVATE; else if ((access & Opcodes.ACC_PROTECTED) == Opcodes.ACC_PROTECTED) visibility = Visibility.PROTECTED; else if ((access & Opcodes.ACC_PUBLIC) == Opcodes.ACC_PUBLIC) visibility = Visibility.PUBLIC; return visibility; }