Beginning work of rename unique, now renames classes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -33,4 +34,17 @@ public class Exceptions extends Attribute
|
||||
for (Class c : classes)
|
||||
out.writeShort(this.getAttributes().getClassFile().getPool().make(c));
|
||||
}
|
||||
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
for (Class c : classes)
|
||||
{
|
||||
if (c.getName().equals(cf.getName()))
|
||||
{
|
||||
int idx = classes.indexOf(c);
|
||||
classes.remove(idx);
|
||||
classes.add(idx, new Class(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ConstantPool;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
|
||||
@@ -93,4 +94,10 @@ public class Exception
|
||||
{
|
||||
return catchType;
|
||||
}
|
||||
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (catchType != null && cf.getName().equals(catchType.getName()))
|
||||
catchType = new Class(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.Code;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -47,4 +48,10 @@ public class Exceptions
|
||||
{
|
||||
return exceptions;
|
||||
}
|
||||
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
for (Exception e : exceptions)
|
||||
e.renameClass(cf, name);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.ConstantPool;
|
||||
import info.sigterm.deob.execution.Frame;
|
||||
|
||||
@@ -206,4 +207,8 @@ public abstract class Instruction
|
||||
public void replace(Instruction oldi, Instruction newi)
|
||||
{
|
||||
}
|
||||
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.Code;
|
||||
import info.sigterm.deob.attributes.code.instruction.types.JumpingInstruction;
|
||||
import info.sigterm.deob.attributes.code.instructions.LDC;
|
||||
@@ -196,4 +197,10 @@ public class Instructions
|
||||
return i;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
for (Instruction i : instructions)
|
||||
i.renameClass(cf, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -53,4 +54,11 @@ public class ANewArray extends Instruction
|
||||
|
||||
frame.addInstructionContext(ins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (clazz.getName().equals(cf.getName()))
|
||||
clazz = new Class(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -11,6 +12,7 @@ import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.execution.VariableContext;
|
||||
import info.sigterm.deob.execution.Variables;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -69,4 +70,11 @@ public class CheckCast extends Instruction
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (clazz.getName().equals(cf.getName()))
|
||||
clazz = new Class(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -9,6 +10,7 @@ import info.sigterm.deob.execution.InstructionContext;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.execution.Type;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.Field;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -57,4 +59,11 @@ public class GetField extends Instruction implements GetFieldInstruction
|
||||
{
|
||||
return field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,4 +74,10 @@ public class GetStatic extends Instruction implements GetFieldInstruction
|
||||
return field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -49,4 +50,11 @@ public class InstanceOf extends Instruction
|
||||
|
||||
frame.addInstructionContext(ins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (clazz.getName().equals(cf.getName()))
|
||||
clazz = new Class(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import info.sigterm.deob.execution.InstructionContext;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.execution.Type;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.InterfaceMethod;
|
||||
import info.sigterm.deob.pool.NameAndType;
|
||||
import info.sigterm.deob.pool.PoolEntry;
|
||||
@@ -155,4 +156,11 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
|
||||
{
|
||||
return method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (method.getClassEntry().getName().equals(cf.getName()))
|
||||
method = new InterfaceMethod(new Class(name), method.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import info.sigterm.deob.execution.InstructionContext;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.execution.Type;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.Method;
|
||||
import info.sigterm.deob.pool.NameAndType;
|
||||
import info.sigterm.deob.pool.PoolEntry;
|
||||
@@ -147,4 +148,11 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
|
||||
{
|
||||
return method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (method.getClassEntry().getName().equals(cf.getName()))
|
||||
method = new Method(new Class(name), method.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import info.sigterm.deob.execution.InstructionContext;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.execution.Type;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.Method;
|
||||
import info.sigterm.deob.pool.NameAndType;
|
||||
import info.sigterm.deob.pool.PoolEntry;
|
||||
@@ -144,4 +145,11 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
||||
{
|
||||
return method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (method.getClassEntry().getName().equals(cf.getName()))
|
||||
method = new Method(new Class(name), method.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import info.sigterm.deob.execution.InstructionContext;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.execution.Type;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.Method;
|
||||
import info.sigterm.deob.pool.NameAndType;
|
||||
import info.sigterm.deob.pool.PoolEntry;
|
||||
@@ -154,4 +155,11 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
|
||||
{
|
||||
return method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (method.getClassEntry().getName().equals(cf.getName()))
|
||||
method = new Method(new Class(name), method.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -57,4 +58,11 @@ public class MultiANewArray extends Instruction
|
||||
|
||||
frame.addInstructionContext(ins);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (clazz.getName().equals(cf.getName()))
|
||||
clazz = new Class(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -52,4 +53,11 @@ public class New extends Instruction
|
||||
{
|
||||
return clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (clazz.getName().equals(cf.getName()))
|
||||
clazz = new Class(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -8,6 +9,7 @@ import info.sigterm.deob.execution.Frame;
|
||||
import info.sigterm.deob.execution.InstructionContext;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.Field;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -53,4 +55,10 @@ public class PutField extends Instruction implements SetFieldInstruction
|
||||
return field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
@@ -8,6 +9,7 @@ import info.sigterm.deob.execution.Frame;
|
||||
import info.sigterm.deob.execution.InstructionContext;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.execution.StackContext;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
import info.sigterm.deob.pool.Field;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -51,4 +53,11 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
||||
{
|
||||
return field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameClass(ClassFile cf, String name)
|
||||
{
|
||||
if (field.getClassEntry().getName().equals(cf.getName()))
|
||||
field = new Field(new Class(name), field.getNameAndType());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user