Package cuchaz.enigma.mapping

Examples of cuchaz.enigma.mapping.ClassEntry


    return true;
  }

  private BehaviorEntry isAnonymousClass( CtClass c, String outerClassName )
  {
    ClassEntry innerClassEntry = new ClassEntry( Descriptor.toJvmName( c.getName() ) );
   
    // anonymous classes:
    //    can't be abstract
    //    have only one constructor
    //    it's called exactly once by the outer class
    //    the type the instance is assigned to can't be this type
   
    // is abstract?
    if( Modifier.isAbstract( c.getModifiers() ) )
    {
      return null;
    }
   
    // is there exactly one constructor?
    if( c.getDeclaredConstructors().length != 1 )
    {
      return null;
    }
    CtConstructor constructor = c.getDeclaredConstructors()[0];
   
    // is this constructor called exactly once?
    ConstructorEntry constructorEntry = new ConstructorEntry( innerClassEntry, constructor.getMethodInfo().getDescriptor() );
    Collection<EntryReference<BehaviorEntry,BehaviorEntry>> references = getBehaviorReferences( constructorEntry );
    if( references.size() != 1 )
    {
      return null;
    }
   
    // does the caller use this type?
    BehaviorEntry caller = references.iterator().next().context;
    for( FieldEntry fieldEntry : getReferencedFields( caller ) )
    {
      ClassEntry fieldClass = getFieldClass( fieldEntry );
      if( fieldClass != null && fieldClass.equals( innerClassEntry ) )
      {
        // caller references this type, so it can't be anonymous
        return null;
      }
    }
View Full Code Here


    // travel to the ancestor implementation
    String baseImplementationClassName = obfMethodEntry.getClassName();
    for( String ancestorClassName : m_translationIndex.getAncestry( obfMethodEntry.getClassName() ) )
    {
      MethodEntry ancestorMethodEntry = new MethodEntry(
        new ClassEntry( ancestorClassName ),
        obfMethodEntry.getName(),
        obfMethodEntry.getSignature()
      );
      if( containsObfBehavior( ancestorMethodEntry ) )
      {
        baseImplementationClassName = ancestorClassName;
      }
    }
   
    // make a root node at the base
    MethodEntry methodEntry = new MethodEntry(
      new ClassEntry( baseImplementationClassName ),
      obfMethodEntry.getName(),
      obfMethodEntry.getSignature()
    );
    MethodInheritanceTreeNode rootNode = new MethodInheritanceTreeNode(
      deobfuscatingTranslator,
View Full Code Here

    return classPool.get( className );
  }
 
  private static ClassEntry getClassEntry( JarEntry entry )
  {
    return new ClassEntry( entry.getName().substring( 0, entry.getName().length() - ".class".length() ) );
  }
View Full Code Here

         
          Object node = path.getLastPathComponent();
          if( node instanceof ClassInheritanceTreeNode )
          {
            ClassInheritanceTreeNode classNode = (ClassInheritanceTreeNode)node;
            navigateTo( new ClassEntry( classNode.getObfClassName() ) );
          }
          else if( node instanceof MethodInheritanceTreeNode )
          {
            MethodInheritanceTreeNode methodNode = (MethodInheritanceTreeNode)node;
            if( methodNode.isImplemented() )
View Full Code Here

  {
    // get all method implementations
    List<ClassImplementationsTreeNode> nodes = Lists.newArrayList();
    for( String implementingClassName : index.getImplementingClasses( m_entry.getClassName() ) )
    {
      nodes.add( new ClassImplementationsTreeNode( m_deobfuscatingTranslator, new ClassEntry( implementingClassName ) ) );
    }
   
    // add them to this node
    for( ClassImplementationsTreeNode node : nodes )
    {
View Full Code Here

    // get all method implementations
    List<MethodImplementationsTreeNode> nodes = Lists.newArrayList();
    for( String implementingClassName : index.getImplementingClasses( m_entry.getClassName() ) )
    {
      MethodEntry methodEntry = new MethodEntry(
        new ClassEntry( implementingClassName ),
        m_entry.getName(),
        m_entry.getSignature()
      );
      if( index.containsObfBehavior( methodEntry ) )
      {
View Full Code Here

    // rename declared methods
    for( CtMethod method : c.getDeclaredMethods() )
    {
      // get the method entry
      MethodEntry methodEntry = new MethodEntry(
        new ClassEntry( Descriptor.toJvmName( c.getName() ) ),
        method.getName(),
        method.getSignature()
      );
      MethodEntry bridgeMethodEntry = m_index.getBridgeMethod( methodEntry );
      if( bridgeMethodEntry != null )
View Full Code Here

    return m_deobfuscator.isRenameable( m_deobfuscator.obfuscateReference( deobfReference ) );
  }
 
  public ClassInheritanceTreeNode getClassInheritance( ClassEntry deobfClassEntry )
  {
    ClassEntry obfClassEntry = m_deobfuscator.obfuscateEntry( deobfClassEntry );
    ClassInheritanceTreeNode rootNode = m_deobfuscator.getJarIndex().getClassInheritance(
      m_deobfuscator.getTranslator( TranslationDirection.Deobfuscating ),
      obfClassEntry
    );
    return ClassInheritanceTreeNode.findNode( rootNode, obfClassEntry );
View Full Code Here

    return ClassInheritanceTreeNode.findNode( rootNode, obfClassEntry );
  }
 
  public ClassImplementationsTreeNode getClassImplementations( ClassEntry deobfClassEntry )
  {
    ClassEntry obfClassEntry = m_deobfuscator.obfuscateEntry( deobfClassEntry );
    return m_deobfuscator.getJarIndex().getClassImplementations(
      m_deobfuscator.getTranslator( TranslationDirection.Deobfuscating ),
      obfClassEntry
    );
  }
View Full Code Here

      throw new IllegalArgumentException( "Reference cannot be null!" );
    }
   
    // get the reference target class
    EntryReference<Entry,Entry> obfReference = m_deobfuscator.obfuscateReference( deobfReference );
    ClassEntry obfClassEntry = obfReference.getLocationClassEntry().getOuterClassEntry();
    if( !m_deobfuscator.isObfuscatedIdentifier( obfClassEntry ) )
    {
      throw new IllegalArgumentException( "Obfuscated class " + obfClassEntry + " was not found in the jar!" );
    }
    if( m_currentObfClass == null || !m_currentObfClass.equals( obfClassEntry ) )
View Full Code Here

TOP

Related Classes of cuchaz.enigma.mapping.ClassEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.