these const push instructions are also push instructions. need to fix jumps to the logically dead conditionals.
This commit is contained in:
@@ -43,14 +43,13 @@ public class Deob
|
|||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
ClassGroup group = loadJar(args[0]);
|
ClassGroup group = loadJar(args[0]);
|
||||||
|
long bstart, bdur;
|
||||||
|
|
||||||
new ConstantParameter().run(group);
|
// bstart = System.currentTimeMillis();
|
||||||
|
|
||||||
// long bstart = System.currentTimeMillis();
|
|
||||||
// new RenameUnique().run(group);
|
// new RenameUnique().run(group);
|
||||||
// long bdur = System.currentTimeMillis() - bstart;
|
// bdur = System.currentTimeMillis() - bstart;
|
||||||
// System.out.println("rename unique took " + bdur/1000L + " seconds");
|
// System.out.println("rename unique took " + bdur/1000L + " seconds");
|
||||||
//
|
|
||||||
// // remove except RuntimeException
|
// // remove except RuntimeException
|
||||||
// bstart = System.currentTimeMillis();
|
// bstart = System.currentTimeMillis();
|
||||||
// new RuntimeExceptions().run(group);
|
// new RuntimeExceptions().run(group);
|
||||||
@@ -59,18 +58,21 @@ public class Deob
|
|||||||
// new UnusedBlocks().run(group);
|
// new UnusedBlocks().run(group);
|
||||||
// bdur = System.currentTimeMillis() - bstart;
|
// bdur = System.currentTimeMillis() - bstart;
|
||||||
// System.out.println("runtime exception took " + bdur/1000L + " seconds");
|
// System.out.println("runtime exception took " + bdur/1000L + " seconds");
|
||||||
//
|
|
||||||
// // remove unused methods
|
// remove unused methods
|
||||||
// bstart = System.currentTimeMillis();
|
bstart = System.currentTimeMillis();
|
||||||
// new UnusedMethods().run(group);
|
new UnusedMethods().run(group);
|
||||||
// bdur = System.currentTimeMillis() - bstart;
|
bdur = System.currentTimeMillis() - bstart;
|
||||||
// System.out.println("unused methods took " + bdur/1000L + " seconds");
|
System.out.println("unused methods took " + bdur/1000L + " seconds");
|
||||||
//
|
|
||||||
// // remove illegal state exceptions, frees up some parameters
|
// // remove illegal state exceptions, frees up some parameters
|
||||||
// bstart = System.currentTimeMillis();
|
// bstart = System.currentTimeMillis();
|
||||||
// new IllegalStateExceptions().run(group);
|
// new IllegalStateExceptions().run(group);
|
||||||
// bdur = System.currentTimeMillis() - bstart;
|
// bdur = System.currentTimeMillis() - bstart;
|
||||||
// System.out.println("illegal state exception took " + bdur/1000L + " seconds");
|
// System.out.println("illegal state exception took " + bdur/1000L + " seconds");
|
||||||
|
|
||||||
|
// remove constant logically dead parameters
|
||||||
|
new ConstantParameter().run(group);
|
||||||
//
|
//
|
||||||
// // remove unhit blocks
|
// // remove unhit blocks
|
||||||
// bstart = System.currentTimeMillis();
|
// bstart = System.currentTimeMillis();
|
||||||
@@ -103,7 +105,7 @@ public class Deob
|
|||||||
|
|
||||||
public static boolean isObfuscated(String name)
|
public static boolean isObfuscated(String name)
|
||||||
{
|
{
|
||||||
return name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class");
|
return name.length() <= 2 || name.startsWith("method") || name.startsWith("vmethod") || name.startsWith("field") || name.startsWith("class");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ClassGroup loadJar(String jarfile) throws IOException
|
private static ClassGroup loadJar(String jarfile) throws IOException
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class DConst_0 extends Instruction
|
public class DConst_0 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public DConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
public DConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class DConst_0 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Double(0.0d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class DConst_1 extends Instruction
|
public class DConst_1 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public DConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
public DConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class DConst_1 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Double(1.0d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class FConst_0 extends Instruction
|
public class FConst_0 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public FConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
public FConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class FConst_0 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Float(0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class FConst_1 extends Instruction
|
public class FConst_1 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public FConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
public FConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class FConst_1 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Float(1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class FConst_2 extends Instruction
|
public class FConst_2 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public FConst_2(Instructions instructions, InstructionType type, int pc) throws IOException
|
public FConst_2(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class FConst_2 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Float(2.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IConst_0 extends Instruction
|
public class IConst_0 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public IConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class IConst_0 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Integer(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IConst_1 extends Instruction
|
public class IConst_1 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public IConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class IConst_1 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Integer(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IConst_2 extends Instruction
|
public class IConst_2 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public IConst_2(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IConst_2(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class IConst_2 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Integer(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IConst_3 extends Instruction
|
public class IConst_3 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public IConst_3(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IConst_3(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class IConst_3 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Integer(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IConst_4 extends Instruction
|
public class IConst_4 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public IConst_4(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IConst_4(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class IConst_4 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Integer(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IConst_5 extends Instruction
|
public class IConst_5 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public IConst_5(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IConst_5(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class IConst_5 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Integer(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IConst_M1 extends Instruction
|
public class IConst_M1 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public IConst_M1(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IConst_M1(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class IConst_M1 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Integer(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LConst_0 extends Instruction
|
public class LConst_0 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public LConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
public LConst_0(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class LConst_0 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Long(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob.attributes.code.instructions;
|
|||||||
import info.sigterm.deob.attributes.code.Instruction;
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
import info.sigterm.deob.attributes.code.InstructionType;
|
import info.sigterm.deob.attributes.code.InstructionType;
|
||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
import info.sigterm.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.InstructionContext;
|
import info.sigterm.deob.execution.InstructionContext;
|
||||||
import info.sigterm.deob.execution.Stack;
|
import info.sigterm.deob.execution.Stack;
|
||||||
import info.sigterm.deob.execution.StackContext;
|
import info.sigterm.deob.execution.StackContext;
|
||||||
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LConst_1 extends Instruction
|
public class LConst_1 extends Instruction implements PushConstantInstruction
|
||||||
{
|
{
|
||||||
public LConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
public LConst_1(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
@@ -30,4 +32,16 @@ public class LConst_1 extends Instruction
|
|||||||
|
|
||||||
frame.addInstructionContext(ins);
|
frame.addInstructionContext(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PoolEntry getConstant()
|
||||||
|
{
|
||||||
|
return new info.sigterm.deob.pool.Long(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConstant(PoolEntry entry)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,12 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
{
|
{
|
||||||
PushConstantInstruction pc = (PushConstantInstruction) ctx.getPushed().getInstruction();
|
PushConstantInstruction pc = (PushConstantInstruction) ctx.getPushed().getInstruction();
|
||||||
|
|
||||||
if (!(pc.getConstant().getObject() instanceof Integer))
|
if (method.getMethods().getClassFile().getName().equals("client") && method.getName().equals("i"))
|
||||||
|
{
|
||||||
|
int i = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(pc.getConstant().getObject() instanceof Integer) && (!(pc.getConstant().getObject() instanceof Byte)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ConstantMethodParameter cmp = new ConstantMethodParameter();
|
ConstantMethodParameter cmp = new ConstantMethodParameter();
|
||||||
@@ -149,11 +154,6 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
if (c.equals(cmp))
|
if (c.equals(cmp))
|
||||||
continue outer;
|
continue outer;
|
||||||
|
|
||||||
if (method.getMethods().getClassFile().getName().equals("gy") && method.getName().equals("y"))
|
|
||||||
{
|
|
||||||
int i = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
parameters.add(cmp);
|
parameters.add(cmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -167,7 +167,7 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
|
|
||||||
if (c.methods.equals(methods) && c.lvtIndex == lvtOffset)
|
if (c.methods.equals(methods) && c.lvtIndex == lvtOffset)
|
||||||
{
|
{
|
||||||
it.remove();;
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
Instruction ins = (Instruction) comparison;
|
Instruction ins = (Instruction) comparison;
|
||||||
|
|
||||||
assert (comparison instanceof If0) == (otherValue == null);
|
assert (comparison instanceof If0) == (otherValue == null);
|
||||||
assert otherValue == null || otherValue instanceof Integer;
|
assert otherValue == null || otherValue instanceof Integer || otherValue instanceof Byte;
|
||||||
|
|
||||||
switch (ins.getType())
|
switch (ins.getType())
|
||||||
{
|
{
|
||||||
@@ -514,26 +514,36 @@ public class ConstantParameter implements Deobfuscator
|
|||||||
for (LogicallyDeadOp op : ops)
|
for (LogicallyDeadOp op : ops)
|
||||||
{
|
{
|
||||||
InstructionContext ctx = op.compCtx; // comparison
|
InstructionContext ctx = op.compCtx; // comparison
|
||||||
|
Instruction ins = ctx.getInstruction();
|
||||||
boolean branch = op.branch;
|
boolean branch = op.branch;
|
||||||
|
assert branch;
|
||||||
|
|
||||||
Instructions instructions = ctx.getInstruction().getInstructions();
|
Instructions instructions = ins.getInstructions();
|
||||||
|
|
||||||
// remove the if
|
// remove the if
|
||||||
if (ctx.getInstruction() instanceof If)
|
if (ctx.getInstruction() instanceof If)
|
||||||
ctx.removeStack(1);
|
ctx.removeStack(1);
|
||||||
ctx.removeStack(0);
|
ctx.removeStack(0);
|
||||||
|
|
||||||
int idx = instructions.getInstructions().indexOf(ctx.getInstruction());
|
int idx = instructions.getInstructions().indexOf(ins);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
continue; // already removed?
|
continue; // already removed?
|
||||||
|
|
||||||
JumpingInstruction jumpIns = (JumpingInstruction) ctx.getInstruction();
|
JumpingInstruction jumpIns = (JumpingInstruction) ins;
|
||||||
assert jumpIns.getJumps().size() == 1;
|
assert jumpIns.getJumps().size() == 1;
|
||||||
Instruction to = jumpIns.getJumps().get(0);
|
Instruction to = jumpIns.getJumps().get(0);
|
||||||
|
|
||||||
|
// move things that jump here to instead jump to 'to'
|
||||||
|
for (Instruction fromI : ins.from)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
instructions.remove(ctx.getInstruction());
|
instructions.remove(ctx.getInstruction());
|
||||||
|
|
||||||
if (branch)
|
//assert branch;
|
||||||
|
|
||||||
|
//if (branch)
|
||||||
{
|
{
|
||||||
// insert goto
|
// insert goto
|
||||||
instructions.getInstructions().add(idx, new Goto(instructions, to));
|
instructions.getInstructions().add(idx, new Goto(instructions, to));
|
||||||
|
|||||||
Reference in New Issue
Block a user