Unfinished
This commit is contained in:
@@ -2,6 +2,7 @@ package info.sigterm.deob.attributes;
|
|||||||
|
|
||||||
import info.sigterm.deob.Attributes;
|
import info.sigterm.deob.Attributes;
|
||||||
import info.sigterm.deob.attributes.code.Exceptions;
|
import info.sigterm.deob.attributes.code.Exceptions;
|
||||||
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -10,6 +11,7 @@ public class Code extends Attribute
|
|||||||
{
|
{
|
||||||
private int maxStack;
|
private int maxStack;
|
||||||
private int maxLocals;
|
private int maxLocals;
|
||||||
|
private Instructions instructions;
|
||||||
private Exceptions exceptions;
|
private Exceptions exceptions;
|
||||||
private Attributes attributes;
|
private Attributes attributes;
|
||||||
|
|
||||||
@@ -22,8 +24,7 @@ public class Code extends Attribute
|
|||||||
maxStack = is.readUnsignedShort();
|
maxStack = is.readUnsignedShort();
|
||||||
maxLocals = is.readUnsignedShort();
|
maxLocals = is.readUnsignedShort();
|
||||||
|
|
||||||
int codeLen = is.readInt();
|
instructions = new Instructions(this);
|
||||||
is.skip(codeLen);
|
|
||||||
|
|
||||||
exceptions = new Exceptions(this);
|
exceptions = new Exceptions(this);
|
||||||
attributes = new Attributes(this);
|
attributes = new Attributes(this);
|
||||||
|
|||||||
19
src/main/java/info/sigterm/deob/attributes/code/ALoad.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/ALoad.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ALoad extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
ALoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/AStore.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/AStore.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class AStore extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
AStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/BiPush.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/BiPush.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class BiPush extends Instruction
|
||||||
|
{
|
||||||
|
byte b;
|
||||||
|
|
||||||
|
BiPush(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
b = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/Branch.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/Branch.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Branch extends Instruction
|
||||||
|
{
|
||||||
|
short offset;
|
||||||
|
|
||||||
|
Branch(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
offset = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/DLoad.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/DLoad.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class DLoad extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
DLoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/DStore.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/DStore.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class DStore extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
DStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/FLoad.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/FLoad.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class FLoad extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
FLoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/FStore.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/FStore.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class FStore extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
FStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
21
src/main/java/info/sigterm/deob/attributes/code/IInc.java
Normal file
21
src/main/java/info/sigterm/deob/attributes/code/IInc.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class IInc extends Instruction
|
||||||
|
{
|
||||||
|
byte index;
|
||||||
|
byte inc;
|
||||||
|
|
||||||
|
IInc(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
inc = is.readByte();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/ILoad.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/ILoad.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class ILoad extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
ILoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/IStore.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/IStore.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class IStore extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
IStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
public class Instruction
|
||||||
|
{
|
||||||
|
private Instructions instructions;
|
||||||
|
private InstructionType type;
|
||||||
|
private int pc;
|
||||||
|
protected int length = 1;
|
||||||
|
|
||||||
|
Instruction(Instructions instructions, InstructionType type, int pc)
|
||||||
|
{
|
||||||
|
this.instructions = instructions;
|
||||||
|
this.type = type;
|
||||||
|
this.pc = pc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLength()
|
||||||
|
{
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
public enum InstructionType
|
||||||
|
{
|
||||||
|
NOP(0x00, "nop", Instruction.class),
|
||||||
|
ACONST_NULL(0x01, "aconst_null", Instruction.class),
|
||||||
|
ICONST_M1(0x02, "iconst_m1", Instruction.class),
|
||||||
|
ICONST_0(0x03, "iconst_0", Instruction.class),
|
||||||
|
ICONST_1(0x04, "iconst_1", Instruction.class),
|
||||||
|
ICONST_2(0x05, "iconst_2", Instruction.class),
|
||||||
|
ICONST_3(0x06, "iconst_3", Instruction.class),
|
||||||
|
ICONST_4(0x07, "iconst_4", Instruction.class),
|
||||||
|
ICONST_5(0x08, "iconst_5", Instruction.class),
|
||||||
|
LCONST_0(0x09, "lconst_0", Instruction.class),
|
||||||
|
LCONST_1(0x0a, "lconst_1", Instruction.class),
|
||||||
|
FCONST_0(0x0b, "fconst_0", Instruction.class),
|
||||||
|
FCONST_1(0x0c, "fconst_1", Instruction.class),
|
||||||
|
FCONST_2(0x0d, "fconst_2", Instruction.class),
|
||||||
|
DCONST_0(0x0e, "dconst_0", Instruction.class),
|
||||||
|
DCONST_1(0x0f, "dconst_1", Instruction.class),
|
||||||
|
BIPUSH(0x10, "bipush", BiPush.class),
|
||||||
|
SIPUSH(0x11, "sipush", SiPush.class),
|
||||||
|
LDC(0x12, "ldc", LDC.class),
|
||||||
|
LDC_W(0x13, "lcd_w", LDC_W.class),
|
||||||
|
LDC2_W(0x14, "ldc2_w", LDC2_W.class),
|
||||||
|
ILOAD(0x15, "iload", ILoad.class),
|
||||||
|
LLOAD(0x16, "lload", LLoad.class),
|
||||||
|
FLOAD(0x17, "fload", FLoad.class),
|
||||||
|
DLOAD(0x18, "dload", DLoad.class),
|
||||||
|
ALOAD(0x19, "aload", ALoad.class),
|
||||||
|
ILOAD_0(0x1a, "iload_0", Instruction.class),
|
||||||
|
ILOAD_1(0x1b, "iload_1", Instruction.class),
|
||||||
|
ILOAD_2(0x1c, "iload_2", Instruction.class),
|
||||||
|
ILOAD_3(0x1d, "iload_3", Instruction.class),
|
||||||
|
LLOAD_0(0x1e, "lload_0", Instruction.class),
|
||||||
|
LLOAD_1(0x1f, "lload_1", Instruction.class),
|
||||||
|
LLOAD_2(0x20, "lload_2", Instruction.class),
|
||||||
|
LLOAD_3(0x21, "lload_3", Instruction.class),
|
||||||
|
FLOAD_0(0x22, "fload_0", Instruction.class),
|
||||||
|
FLOAD_1(0x23, "fload_1", Instruction.class),
|
||||||
|
FLOAD_2(0x24, "fload_2", Instruction.class),
|
||||||
|
FLOAD_3(0x25, "fload_3", Instruction.class),
|
||||||
|
DLOAD_0(0x26, "dload_0", Instruction.class),
|
||||||
|
DLOAD_1(0x27, "dload_1", Instruction.class),
|
||||||
|
DLOAD_2(0x28, "dload_2", Instruction.class),
|
||||||
|
DLOAD_3(0x29, "dload_3", Instruction.class),
|
||||||
|
ALOAD_0(0x2a, "aload_0", Instruction.class),
|
||||||
|
ALOAD_1(0x2b, "aload_1", Instruction.class),
|
||||||
|
ALOAD_2(0x2c, "aload_2", Instruction.class),
|
||||||
|
ALOAD_3(0x2d, "aload_3", Instruction.class),
|
||||||
|
IALOAD(0x2e, "iaload", Instruction.class),
|
||||||
|
LALOAD(0x2f, "laload", Instruction.class),
|
||||||
|
FALOAD(0x30, "faload", Instruction.class),
|
||||||
|
DALOAD(0x31, "daload", Instruction.class),
|
||||||
|
AALOAD(0x32, "aaload", Instruction.class),
|
||||||
|
BALOAD(0x33, "baload", Instruction.class),
|
||||||
|
CALOAD(0x34, "caload", Instruction.class),
|
||||||
|
SALOAD(0x35, "saload", Instruction.class),
|
||||||
|
ISTORE(0x36, "istore", IStore.class),
|
||||||
|
LSTORE(0x37, "lstore", LStore.class),
|
||||||
|
FSTORE(0x38, "fstore", FStore.class),
|
||||||
|
DSTORE(0x39, "dstore", DStore.class),
|
||||||
|
ASTORE(0x3a, "astore", AStore.class),
|
||||||
|
ISTORE_0(0x3b, "istore_0", Instruction.class),
|
||||||
|
ISTORE_1(0x3c, "istore_1", Instruction.class),
|
||||||
|
ISTORE_2(0x3d, "istore_2", Instruction.class),
|
||||||
|
ISTORE_3(0x3e, "istore_3", Instruction.class),
|
||||||
|
LSTORE_0(0x3f, "lstore_0", Instruction.class),
|
||||||
|
LSTORE_1(0x40, "lstore_1", Instruction.class),
|
||||||
|
LSTORE_2(0x41, "lstore_2", Instruction.class),
|
||||||
|
LSTORE_3(0x42, "lstore_3", Instruction.class),
|
||||||
|
FSTORE_0(0x43, "fstore_0", Instruction.class),
|
||||||
|
FSTORE_1(0x44, "fstore_1", Instruction.class),
|
||||||
|
FSTORE_2(0x45, "fstore_2", Instruction.class),
|
||||||
|
FSTORE_3(0x46, "fstore_3", Instruction.class),
|
||||||
|
DST0RE_0(0x47, "dstore_0", Instruction.class),
|
||||||
|
DSTORE_1(0x48, "dstore_1", Instruction.class),
|
||||||
|
DSTORE_2(0x49, "dstore_2", Instruction.class),
|
||||||
|
DSTORE_3(0x4a, "dstore_3", Instruction.class),
|
||||||
|
ASTORE_0(0x4b, "astore_0", Instruction.class),
|
||||||
|
ASTORE_1(0x4c, "astore_1", Instruction.class),
|
||||||
|
ASTORE_2(0x4d, "astore_2", Instruction.class),
|
||||||
|
ASTORE_3(0x4e, "astore_3", Instruction.class),
|
||||||
|
IASTORE(0x4f, "iastore", Instruction.class),
|
||||||
|
LASTORE(0x50, "lastore", Instruction.class),
|
||||||
|
FASTORE(0x51, "fastore", Instruction.class),
|
||||||
|
DASTORE(0x52, "dastore", Instruction.class),
|
||||||
|
AASTORE(0x53, "aastore", Instruction.class),
|
||||||
|
BASTORE(0x54, "bastore", Instruction.class),
|
||||||
|
CASTORE(0x55, "castore", Instruction.class),
|
||||||
|
SASTORE(0x56, "sastore", Instruction.class),
|
||||||
|
POP(0x57, "pop", Instruction.class),
|
||||||
|
POP2(0x58, "pop2", Instruction.class),
|
||||||
|
DUP(0x59, "dup", Instruction.class),
|
||||||
|
DUP_X1(0x5a, "dup_x1", Instruction.class),
|
||||||
|
DUP_X2(0x5b, "dup_x2", Instruction.class),
|
||||||
|
DUP2(0x5c, "dup2", Instruction.class),
|
||||||
|
DUP2_X1(0x5d, "dup2_x1", Instruction.class),
|
||||||
|
DUP2_X2(0x5e, "dup2_x2", Instruction.class),
|
||||||
|
SWAP(0x5f, "swap", Instruction.class),
|
||||||
|
IADD(0x60, "iadd", Instruction.class),
|
||||||
|
LADD(0x61, "ladd", Instruction.class),
|
||||||
|
FADD(0x62, "fadd", Instruction.class),
|
||||||
|
DADD(0x63, "dadd", Instruction.class),
|
||||||
|
ISUB(0x64, "isub", Instruction.class),
|
||||||
|
LSUB(0x65, "lsub", Instruction.class),
|
||||||
|
FSUB(0x66, "fsub", Instruction.class),
|
||||||
|
DSUB(0x67, "dsub", Instruction.class),
|
||||||
|
IMUL(0x68, "imul", Instruction.class),
|
||||||
|
LMUL(0x69, "lmul", Instruction.class),
|
||||||
|
FMUL(0x6a, "fmul", Instruction.class),
|
||||||
|
DMUL(0x6b, "dmul", Instruction.class),
|
||||||
|
IDIV(0x6c, "idiv", Instruction.class),
|
||||||
|
LDIV(0x6d, "ldiv", Instruction.class),
|
||||||
|
FDIV(0x6e, "fdiv", Instruction.class),
|
||||||
|
DDIV(0x6f, "ddiv", Instruction.class),
|
||||||
|
IREM(0x70, "irem", Instruction.class),
|
||||||
|
LREM(0x71, "lrem", Instruction.class),
|
||||||
|
FREM(0x72, "frem", Instruction.class),
|
||||||
|
DREM(0x73, "drem", Instruction.class),
|
||||||
|
INEG(0x74, "ineg", Instruction.class),
|
||||||
|
LNEG(0x75, "lneg", Instruction.class),
|
||||||
|
FNEG(0x76, "fneg", Instruction.class),
|
||||||
|
DNEG(0x77, "dneg", Instruction.class),
|
||||||
|
ISHL(0x78, "ishl", Instruction.class),
|
||||||
|
LSHL(0x79, "lshl", Instruction.class),
|
||||||
|
ISHR(0x7a, "ishr", Instruction.class),
|
||||||
|
LSHR(0x7b, "lshr", Instruction.class),
|
||||||
|
IUSHR(0x7c, "iushr", Instruction.class),
|
||||||
|
LUSHR(0x7d, "lushr", Instruction.class),
|
||||||
|
IAND(0x7e, "iand", Instruction.class),
|
||||||
|
LAND(0x7f, "land", Instruction.class),
|
||||||
|
IOR(0x80, "ior", Instruction.class),
|
||||||
|
LOR(0x81, "lor", Instruction.class),
|
||||||
|
IXOR(0x82, "ixor", Instruction.class),
|
||||||
|
LXOR(0x83, "lxor", Instruction.class),
|
||||||
|
IINC(0x84, "iinc", IInc.class),
|
||||||
|
I2L(0x85, "i2l", Instruction.class),
|
||||||
|
I2F(0x86, "i2f", Instruction.class),
|
||||||
|
I2D(0x87, "i2d", Instruction.class),
|
||||||
|
L2I(0x88, "l2i", Instruction.class),
|
||||||
|
L2F(0x89, "l2f", Instruction.class),
|
||||||
|
L2D(0x8a, "l2d", Instruction.class),
|
||||||
|
F2I(0x8b, "f2i", Instruction.class),
|
||||||
|
F2L(0x8c, "f2l", Instruction.class),
|
||||||
|
F2D(0x8d, "f2d", Instruction.class),
|
||||||
|
D2I(0x8e, "d2i", Instruction.class),
|
||||||
|
D2L(0x8f, "d2l", Instruction.class),
|
||||||
|
D2F(0x90, "d2f", Instruction.class),
|
||||||
|
I2B(0x91, "i2b", Instruction.class),
|
||||||
|
I2C(0x92, "i2c", Instruction.class),
|
||||||
|
I2S(0x93, "i2s", Instruction.class),
|
||||||
|
LCMP(0x94, "lcmp", Instruction.class),
|
||||||
|
FCMPL(0x95, "fcmpl", Instruction.class),
|
||||||
|
FCMPG(0x96, "fcmpg", Instruction.class),
|
||||||
|
DCMPL(0x97, "dcmpl", Instruction.class),
|
||||||
|
DCMPG(0x98, "dcmpg", Instruction.class),
|
||||||
|
IFEQ(0x99, "ifeq", Branch.class),
|
||||||
|
IFNE(0x9a, "ifne", Branch.class),
|
||||||
|
IFLT(0x9b, "iflt", Branch.class),
|
||||||
|
IFGE(0x9c, "ifge", Branch.class),
|
||||||
|
IFGT(0x9d, "ifgt", Branch.class),
|
||||||
|
IFLE(0x9e, "ifle", Branch.class),
|
||||||
|
IF_ICMPEQ(0x9f, "if_icmpeq", Branch.class),
|
||||||
|
IF_ICMPNE(0xa0, "if_icmpne", Branch.class),
|
||||||
|
IF_ICMPLT(0xa1, "if_cmplt", Branch.class);
|
||||||
|
|
||||||
|
/*
|
||||||
|
{"0xa2", "3", "if_icmpge", Code_Branch.class},
|
||||||
|
{"0xa3", "3", "if_icmpgt", Code_Branch.class},
|
||||||
|
{"0xa4", "3", "if_icmple", Code_Branch.class},
|
||||||
|
{"0xa5", "3", "if_acmpeq", Code_Branch.class},
|
||||||
|
{"0xa6", "3", "if_acmpne", Code_Branch.class},
|
||||||
|
{"0xa7", "3", "goto", Code_Branch.class},
|
||||||
|
{"0xa8", "3", "jsr", Code_Branch.class},
|
||||||
|
{"0xa9", "2", "ret", Code_VarTable.class},
|
||||||
|
{"0xaa", "0", "tableswitch", Code_tableswitch.class},
|
||||||
|
{"0xab", "0", "lookupswitch", Code_lookupswitch.class},
|
||||||
|
{"0xac", "1", "ireturn", null},
|
||||||
|
{"0xad", "1", "lreturn", null},
|
||||||
|
{"0xae", "1", "freturn", null},
|
||||||
|
{"0xaf", "1", "dreturn", null},
|
||||||
|
{"0xb0", "1", "areturn", null},
|
||||||
|
{"0xb1", "1", "return", null},
|
||||||
|
{"0xb2", "3", "getstatic", Code_Pool.class},
|
||||||
|
{"0xb3", "3", "putstatic", Code_Pool.class},
|
||||||
|
{"0xb4", "3", "getfield", Code_Pool.class},
|
||||||
|
{"0xb5", "3", "putfield", Code_Pool.class},
|
||||||
|
{"0xb6", "3", "invokevirtual", Code_Pool.class},
|
||||||
|
{"0xb7", "3", "invokespecial", Code_Pool.class},
|
||||||
|
{"0xb8", "3", "invokestatic", Code_Pool.class},
|
||||||
|
{"0xb9", "5", "invokeinterface", Code_invokeinterface.class},
|
||||||
|
{"0xba", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xbb", "3", "new", Code_Pool.class},
|
||||||
|
{"0xbc", "2", "newarray", Code_newarray.class},
|
||||||
|
{"0xbd", "3", "anewarray", Code_Pool.class},
|
||||||
|
{"0xbe", "1", "arraylength", null},
|
||||||
|
{"0xbf", "1", "athrow", null},
|
||||||
|
{"0xc0", "3", "checkcast", Code_Pool.class},
|
||||||
|
{"0xc1", "3", "instanceof", Code_Pool.class},
|
||||||
|
{"0xc2", "1", "monitorenter", null},
|
||||||
|
{"0xc3", "1", "monitorexit", null},
|
||||||
|
{"0xc4", "4", "wide", Code_wide.class},
|
||||||
|
{"0xc5", "4", "multianewarray", Code_multianewarray.class},
|
||||||
|
{"0xc6", "3", "ifnull", Code_Branch.class},
|
||||||
|
{"0xc7", "3", "ifnonnull", Code_Branch.class},
|
||||||
|
{"0xc8", "5", "goto_w", Code_BranchInt.class},
|
||||||
|
{"0xc9", "5", "jsr_w", Code_BranchInt.class},
|
||||||
|
{"0xca", "1", "breakpoint", null},
|
||||||
|
{"0xcb", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xcc", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xcd", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xce", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xcf", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd0", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd1", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd2", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd3", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd4", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd5", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd6", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd7", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd8", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xd9", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xda", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xdb", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xdc", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xdd", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xde", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xdf", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe0", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe1", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe2", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe3", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe4", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe5", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe6", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe7", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe8", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xe9", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xea", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xeb", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xec", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xed", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xee", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xef", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf0", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf1", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf2", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf3", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf4", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf5", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf6", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf7", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf8", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xf9", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xfa", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xfb", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xfc", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xfd", "1", "xxxunusedxxx", null},
|
||||||
|
{"0xfe", "1", "impdep1", null},
|
||||||
|
{"0xff", "1", "impdep2", null}
|
||||||
|
*/
|
||||||
|
private byte code;
|
||||||
|
private String name;
|
||||||
|
private Class<? extends Instruction> clazz;
|
||||||
|
|
||||||
|
InstructionType(int op, String name, Class<? extends Instruction> clazz)
|
||||||
|
{
|
||||||
|
this.code = (byte) op;
|
||||||
|
this.name = name;
|
||||||
|
this.clazz = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getCode()
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<? extends Instruction> getInstructionClass()
|
||||||
|
{
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InstructionType findInstructionFromCode(byte code)
|
||||||
|
{
|
||||||
|
for (InstructionType t : InstructionType.values())
|
||||||
|
if (t.getCode() == code)
|
||||||
|
return t;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import info.sigterm.deob.attributes.Code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
|
public class Instructions
|
||||||
|
{
|
||||||
|
private Code code;
|
||||||
|
|
||||||
|
public Instructions(Code code) throws IOException
|
||||||
|
{
|
||||||
|
DataInputStream is = code.getAttributes().getStream();
|
||||||
|
|
||||||
|
int length = is.readInt();
|
||||||
|
|
||||||
|
for (int pc = 0; pc < length;)
|
||||||
|
{
|
||||||
|
byte opcode = is.readByte();
|
||||||
|
|
||||||
|
InstructionType type = InstructionType.findInstructionFromCode(opcode);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Constructor<? extends Instruction> con = type.getInstructionClass().getConstructor(new Class[] { Instructions.class, InstructionType.class, Integer.class });
|
||||||
|
Instruction ins = con.newInstance(this, type, pc);
|
||||||
|
}
|
||||||
|
catch (java.lang.Exception ex)
|
||||||
|
{
|
||||||
|
throw new IOException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Code getCode()
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/LDC.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/LDC.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LDC extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
LDC(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/LDC2_W.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/LDC2_W.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LDC2_W extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
LDC2_W(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readUnsignedShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/LDC_W.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/LDC_W.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LDC_W extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
LDC_W(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readUnsignedShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/LLoad.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/LLoad.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LLoad extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
LLoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/LStore.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/LStore.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LStore extends Instruction
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
LStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
19
src/main/java/info/sigterm/deob/attributes/code/SiPush.java
Normal file
19
src/main/java/info/sigterm/deob/attributes/code/SiPush.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package info.sigterm.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class SiPush extends Instruction
|
||||||
|
{
|
||||||
|
short s;
|
||||||
|
|
||||||
|
SiPush(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super(instructions, type, pc);
|
||||||
|
|
||||||
|
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
||||||
|
s = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user