Class writing, call graph, eclipse project
This commit is contained in:
26
.classpath
Normal file
26
.classpath
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
||||||
12
.settings/org.eclipse.jdt.core.prefs
Normal file
12
.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
||||||
@@ -5,6 +5,7 @@ import info.sigterm.deob.pool.Class;
|
|||||||
import info.sigterm.deob.pool.NameAndType;
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -55,6 +56,28 @@ public class ClassFile
|
|||||||
attributes = new Attributes(this);
|
attributes = new Attributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeInt(0xcafebabe);
|
||||||
|
|
||||||
|
out.writeShort(minor_version);
|
||||||
|
out.writeShort(major_version);
|
||||||
|
|
||||||
|
pool.write(out);
|
||||||
|
|
||||||
|
out.writeShort(access_flags);
|
||||||
|
out.writeShort(this_class);
|
||||||
|
out.writeShort(super_class);
|
||||||
|
|
||||||
|
interfaces.write(out);
|
||||||
|
|
||||||
|
fields.write(out);
|
||||||
|
|
||||||
|
methods.write(out);
|
||||||
|
|
||||||
|
attributes.write(out);
|
||||||
|
}
|
||||||
|
|
||||||
public ClassGroup getGroup()
|
public ClassGroup getGroup()
|
||||||
{
|
{
|
||||||
return group;
|
return group;
|
||||||
@@ -75,6 +98,11 @@ public class ClassFile
|
|||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Methods getMethods()
|
||||||
|
{
|
||||||
|
return methods;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
Class entry = (Class) pool.getEntry(this_class);
|
Class entry = (Class) pool.getEntry(this_class);
|
||||||
@@ -144,6 +172,11 @@ public class ClassFile
|
|||||||
methods.buildInstructionGraph();
|
methods.buildInstructionGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
methods.buildCallGraph();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean instanceOf(ClassFile other)
|
public boolean instanceOf(ClassFile other)
|
||||||
{
|
{
|
||||||
return this == other || interfaces.instanceOf(other) || (getParent() != null && getParent().instanceOf(other));
|
return this == other || interfaces.instanceOf(other) || (getParent() != null && getParent().instanceOf(other));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ClassGroup
|
public class ClassGroup
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,11 @@ public class ClassGroup
|
|||||||
return cf;
|
return cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ClassFile> getClasses()
|
||||||
|
{
|
||||||
|
return classes;
|
||||||
|
}
|
||||||
|
|
||||||
public ClassFile findClass(String name)
|
public ClassFile findClass(String name)
|
||||||
{
|
{
|
||||||
// XXX handle arrays
|
// XXX handle arrays
|
||||||
@@ -39,4 +45,10 @@ public class ClassGroup
|
|||||||
for (ClassFile c : classes)
|
for (ClassFile c : classes)
|
||||||
c.buildInstructionGraph();
|
c.buildInstructionGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
for (ClassFile c : classes)
|
||||||
|
c.buildCallGraph();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package info.sigterm.deob;
|
package info.sigterm.deob;
|
||||||
|
|
||||||
|
import info.sigterm.deob.attributes.code.instructions.Return;
|
||||||
import info.sigterm.deob.pool.ConstantType;
|
import info.sigterm.deob.pool.ConstantType;
|
||||||
import info.sigterm.deob.pool.PoolEntry;
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
import info.sigterm.deob.pool.UTF8;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
@@ -35,12 +38,7 @@ public class ConstantPool
|
|||||||
PoolEntry entry = con.newInstance(this);
|
PoolEntry entry = con.newInstance(this);
|
||||||
|
|
||||||
pool[i] = entry;
|
pool[i] = entry;
|
||||||
|
i += entry.getSlots() - 1;
|
||||||
for (int j = 1; j < entry.getSlots(); ++j)
|
|
||||||
{
|
|
||||||
pool[i + 1] = entry;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -49,6 +47,19 @@ public class ConstantPool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(count);
|
||||||
|
for (int i = 1; i < count; ++i)
|
||||||
|
{
|
||||||
|
PoolEntry entry = pool[i];
|
||||||
|
if (entry == null)
|
||||||
|
continue;
|
||||||
|
out.writeByte(entry.getType().getType());
|
||||||
|
entry.write(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ClassFile getClassFile()
|
public ClassFile getClassFile()
|
||||||
{
|
{
|
||||||
return classFile;
|
return classFile;
|
||||||
@@ -58,4 +69,22 @@ public class ConstantPool
|
|||||||
{
|
{
|
||||||
return pool[index];
|
return pool[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int findUTF8Index(String s)
|
||||||
|
{
|
||||||
|
for (int i = 1; i < count; ++i)
|
||||||
|
{
|
||||||
|
PoolEntry entry = pool[i];
|
||||||
|
if (entry instanceof UTF8)
|
||||||
|
{
|
||||||
|
UTF8 u = (UTF8) entry;
|
||||||
|
if (s.equals(u.getValue()))
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,17 @@ package info.sigterm.deob;
|
|||||||
|
|
||||||
import info.sigterm.deob.execution.Execution;
|
import info.sigterm.deob.execution.Execution;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
import java.util.jar.JarOutputStream;
|
||||||
|
import java.util.jar.Manifest;
|
||||||
|
|
||||||
public class Deob
|
public class Deob
|
||||||
{
|
{
|
||||||
@@ -30,8 +35,27 @@ public class Deob
|
|||||||
|
|
||||||
group.buildClassGraph();
|
group.buildClassGraph();
|
||||||
group.buildInstructionGraph();
|
group.buildInstructionGraph();
|
||||||
|
group.buildCallGraph();
|
||||||
|
|
||||||
execute(group);
|
//checkCallGraph(group);
|
||||||
|
|
||||||
|
//execute(group);
|
||||||
|
|
||||||
|
JarOutputStream jout = new JarOutputStream(new FileOutputStream("d:/rs/07/adamout.jar"), new Manifest());
|
||||||
|
|
||||||
|
for (ClassFile cf : group.getClasses())
|
||||||
|
{
|
||||||
|
JarEntry entry = new JarEntry(cf.getName() + ".class");
|
||||||
|
jout.putNextEntry(entry);
|
||||||
|
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
cf.write(new DataOutputStream(bout));
|
||||||
|
jout.write(bout.toByteArray());
|
||||||
|
|
||||||
|
jout.closeEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
jout.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void execute(ClassGroup group) throws IOException
|
private static void execute(ClassGroup group) throws IOException
|
||||||
@@ -42,4 +66,18 @@ public class Deob
|
|||||||
Execution e = new Execution(group);
|
Execution e = new Execution(group);
|
||||||
e.run(cf, method);
|
e.run(cf, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void checkCallGraph(ClassGroup group)
|
||||||
|
{
|
||||||
|
for (ClassFile cf : group.getClasses())
|
||||||
|
{
|
||||||
|
for (Method m : cf.getMethods().getMethods())
|
||||||
|
{
|
||||||
|
if (m.callsFrom.isEmpty())
|
||||||
|
{
|
||||||
|
System.out.println(cf.getName() + " " + m.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import info.sigterm.deob.attributes.code.Instruction;
|
|||||||
import info.sigterm.deob.pool.UTF8;
|
import info.sigterm.deob.pool.UTF8;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -41,6 +42,14 @@ public class Field
|
|||||||
attributes = new Attributes(this);
|
attributes = new Attributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(accessFlags);
|
||||||
|
out.writeShort(nameIndex);
|
||||||
|
out.writeShort(descriptorIndex);
|
||||||
|
attributes.write(out);
|
||||||
|
}
|
||||||
|
|
||||||
public Fields getFields()
|
public Fields getFields()
|
||||||
{
|
{
|
||||||
return fields;
|
return fields;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob;
|
|||||||
import info.sigterm.deob.pool.NameAndType;
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Fields
|
public class Fields
|
||||||
@@ -25,6 +26,13 @@ public class Fields
|
|||||||
fields[i] = new Field(this);
|
fields[i] = new Field(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(count);
|
||||||
|
for (Field f : fields)
|
||||||
|
f.write(out);
|
||||||
|
}
|
||||||
|
|
||||||
public ClassFile getClassFile()
|
public ClassFile getClassFile()
|
||||||
{
|
{
|
||||||
return classFile;
|
return classFile;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob;
|
|||||||
import info.sigterm.deob.pool.Class;
|
import info.sigterm.deob.pool.Class;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Interfaces
|
public class Interfaces
|
||||||
@@ -25,6 +26,13 @@ public class Interfaces
|
|||||||
interfaces[i] = is.readUnsignedShort();
|
interfaces[i] = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(count);
|
||||||
|
for (int i : interfaces)
|
||||||
|
out.writeShort(i);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean instanceOf(ClassFile cf)
|
public boolean instanceOf(ClassFile cf)
|
||||||
{
|
{
|
||||||
for (int i : interfaces)
|
for (int i : interfaces)
|
||||||
|
|||||||
@@ -3,10 +3,15 @@ package info.sigterm.deob;
|
|||||||
import info.sigterm.deob.attributes.AttributeType;
|
import info.sigterm.deob.attributes.AttributeType;
|
||||||
import info.sigterm.deob.attributes.Attributes;
|
import info.sigterm.deob.attributes.Attributes;
|
||||||
import info.sigterm.deob.attributes.Code;
|
import info.sigterm.deob.attributes.Code;
|
||||||
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
|
import info.sigterm.deob.callgraph.Node;
|
||||||
import info.sigterm.deob.pool.UTF8;
|
import info.sigterm.deob.pool.UTF8;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Method
|
public class Method
|
||||||
{
|
{
|
||||||
@@ -16,6 +21,8 @@ public class Method
|
|||||||
private int nameIndex;
|
private int nameIndex;
|
||||||
private int descriptorIndex;
|
private int descriptorIndex;
|
||||||
private Attributes attributes;
|
private Attributes attributes;
|
||||||
|
public List<Node> callsTo = new ArrayList<>(),
|
||||||
|
callsFrom = new ArrayList<>();
|
||||||
|
|
||||||
Method(Methods methods) throws IOException
|
Method(Methods methods) throws IOException
|
||||||
{
|
{
|
||||||
@@ -29,6 +36,19 @@ public class Method
|
|||||||
attributes = new Attributes(this);
|
attributes = new Attributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(accessFlags);
|
||||||
|
out.writeShort(nameIndex);
|
||||||
|
out.writeShort(descriptorIndex);
|
||||||
|
attributes.write(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void remove()
|
||||||
|
{
|
||||||
|
assert callsFrom.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public Methods getMethods()
|
public Methods getMethods()
|
||||||
{
|
{
|
||||||
return methods;
|
return methods;
|
||||||
@@ -58,4 +78,19 @@ public class Method
|
|||||||
if (code != null)
|
if (code != null)
|
||||||
code.buildInstructionGraph();
|
code.buildInstructionGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
Code code = getCode();
|
||||||
|
|
||||||
|
if (code != null)
|
||||||
|
code.buildCallGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCallTo(Instruction ins, Method method)
|
||||||
|
{
|
||||||
|
Node node = new Node(this, method, ins);
|
||||||
|
callsTo.add(node);
|
||||||
|
method.callsFrom.add(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ package info.sigterm.deob;
|
|||||||
import info.sigterm.deob.pool.NameAndType;
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Methods
|
public class Methods
|
||||||
{
|
{
|
||||||
ClassFile classFile;
|
ClassFile classFile;
|
||||||
|
|
||||||
private int count;
|
private List<Method> methods = new ArrayList<>();
|
||||||
private Method[] methods;
|
|
||||||
|
|
||||||
Methods(ClassFile cf) throws IOException
|
Methods(ClassFile cf) throws IOException
|
||||||
{
|
{
|
||||||
@@ -18,11 +20,23 @@ public class Methods
|
|||||||
|
|
||||||
DataInputStream is = cf.getStream();
|
DataInputStream is = cf.getStream();
|
||||||
|
|
||||||
count = is.readUnsignedShort();
|
int count = is.readUnsignedShort();
|
||||||
methods = new Method[count];
|
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
methods[i] = new Method(this);
|
methods.add(new Method(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(methods.size());
|
||||||
|
for (Method m : methods)
|
||||||
|
m.write(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeMethod(Method m)
|
||||||
|
{
|
||||||
|
m.remove();
|
||||||
|
methods.remove(methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassFile getClassFile()
|
public ClassFile getClassFile()
|
||||||
@@ -30,6 +44,11 @@ public class Methods
|
|||||||
return classFile;
|
return classFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Method> getMethods()
|
||||||
|
{
|
||||||
|
return methods;
|
||||||
|
}
|
||||||
|
|
||||||
public Method findMethod(NameAndType nat)
|
public Method findMethod(NameAndType nat)
|
||||||
{
|
{
|
||||||
for (Method m : methods)
|
for (Method m : methods)
|
||||||
@@ -51,4 +70,10 @@ public class Methods
|
|||||||
for (Method m : methods)
|
for (Method m : methods)
|
||||||
m.buildInstructionGraph();
|
m.buildInstructionGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
for (Method m : methods)
|
||||||
|
m.buildCallGraph();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
package info.sigterm.deob.attributes;
|
package info.sigterm.deob.attributes;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Attribute
|
public abstract class Attribute
|
||||||
{
|
{
|
||||||
private Attributes attributes;
|
private Attributes attributes;
|
||||||
private AttributeType type;
|
private AttributeType type;
|
||||||
private int length;
|
private int length;
|
||||||
|
public int nameIndex;
|
||||||
|
|
||||||
Attribute(Attributes attr, AttributeType type) throws IOException
|
Attribute(Attributes attr, AttributeType type) throws IOException
|
||||||
{
|
{
|
||||||
@@ -18,6 +21,18 @@ public class Attribute
|
|||||||
this.length = is.readInt();
|
this.length = is.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
writeAttr(new DataOutputStream(bout));
|
||||||
|
|
||||||
|
byte[] b = bout.toByteArray();
|
||||||
|
out.writeInt(b.length);
|
||||||
|
out.write(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void writeAttr(DataOutputStream out) throws IOException;
|
||||||
|
|
||||||
public Attributes getAttributes()
|
public Attributes getAttributes()
|
||||||
{
|
{
|
||||||
return attributes;
|
return attributes;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public enum AttributeType
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private Class<? extends Attribute> clazz;
|
private Class<? extends Attribute> clazz;
|
||||||
|
public int nameIndex;
|
||||||
|
|
||||||
AttributeType(String name, Class<? extends Attribute> clazz)
|
AttributeType(String name, Class<? extends Attribute> clazz)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.Method;
|
|||||||
import info.sigterm.deob.pool.UTF8;
|
import info.sigterm.deob.pool.UTF8;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
@@ -99,6 +100,7 @@ public class Attributes
|
|||||||
{
|
{
|
||||||
Constructor<? extends Attribute> con = type.getAttributeClass().getConstructor(new Class[] { Attributes.class });
|
Constructor<? extends Attribute> con = type.getAttributeClass().getConstructor(new Class[] { Attributes.class });
|
||||||
Attribute attr = con.newInstance(this);
|
Attribute attr = con.newInstance(this);
|
||||||
|
attr.nameIndex = nameIndex;
|
||||||
|
|
||||||
attributes[i] = attr;
|
attributes[i] = attr;
|
||||||
}
|
}
|
||||||
@@ -108,4 +110,14 @@ public class Attributes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(count);
|
||||||
|
for (Attribute a : attributes)
|
||||||
|
{
|
||||||
|
out.writeShort(a.nameIndex);
|
||||||
|
a.write(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import info.sigterm.deob.attributes.code.Exceptions;
|
|||||||
import info.sigterm.deob.attributes.code.Instructions;
|
import info.sigterm.deob.attributes.code.Instructions;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Code extends Attribute
|
public class Code extends Attribute
|
||||||
@@ -26,7 +27,7 @@ public class Code extends Attribute
|
|||||||
instructions = new Instructions(this);
|
instructions = new Instructions(this);
|
||||||
|
|
||||||
exceptions = new Exceptions(this);
|
exceptions = new Exceptions(this);
|
||||||
attributes = new Attributes(this);
|
this.attributes = new Attributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxStack()
|
public int getMaxStack()
|
||||||
@@ -53,4 +54,20 @@ public class Code extends Attribute
|
|||||||
{
|
{
|
||||||
instructions.buildInstructionGraph();
|
instructions.buildInstructionGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
instructions.buildCallGraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeAttr(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(maxStack);
|
||||||
|
out.writeShort(maxLocals);
|
||||||
|
|
||||||
|
instructions.write(out);
|
||||||
|
exceptions.write(out);
|
||||||
|
attributes.write(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,22 +3,29 @@ package info.sigterm.deob.attributes;
|
|||||||
import info.sigterm.deob.pool.PoolEntry;
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ConstantValue extends Attribute
|
public class ConstantValue extends Attribute
|
||||||
{
|
{
|
||||||
private int constantVlaueIndex;
|
private int constantValueIndex;
|
||||||
|
|
||||||
public ConstantValue(Attributes attributes) throws IOException
|
public ConstantValue(Attributes attributes) throws IOException
|
||||||
{
|
{
|
||||||
super(attributes, AttributeType.CONSTANT_VALUE);
|
super(attributes, AttributeType.CONSTANT_VALUE);
|
||||||
|
|
||||||
DataInputStream is = attributes.getStream();
|
DataInputStream is = attributes.getStream();
|
||||||
constantVlaueIndex = is.readUnsignedShort();
|
constantValueIndex = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PoolEntry getValue()
|
public PoolEntry getValue()
|
||||||
{
|
{
|
||||||
return this.getAttributes().getClassFile().getPool().getEntry(constantVlaueIndex);
|
return this.getAttributes().getClassFile().getPool().getEntry(constantValueIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeAttr(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(constantValueIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package info.sigterm.deob.attributes;
|
package info.sigterm.deob.attributes;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Unknown extends Attribute
|
public class Unknown extends Attribute
|
||||||
@@ -29,4 +30,10 @@ public class Unknown extends Attribute
|
|||||||
|
|
||||||
assert read == len;
|
assert read == len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeAttr(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.write(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.attributes.code;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Exception
|
public class Exception
|
||||||
@@ -26,6 +27,14 @@ public class Exception
|
|||||||
catchType = is.readUnsignedShort();
|
catchType = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(startPc);
|
||||||
|
out.writeShort(endPc);
|
||||||
|
out.writeShort(handlerPc);
|
||||||
|
out.writeShort(catchType);
|
||||||
|
}
|
||||||
|
|
||||||
public Exceptions getExceptions()
|
public Exceptions getExceptions()
|
||||||
{
|
{
|
||||||
return exceptions;
|
return exceptions;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import info.sigterm.deob.attributes.Code;
|
|||||||
import info.sigterm.deob.execution.ObjectInstance;
|
import info.sigterm.deob.execution.ObjectInstance;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -26,6 +27,13 @@ public class Exceptions
|
|||||||
exceptions[i] = new Exception(this);
|
exceptions[i] = new Exception(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(exceptions.length);
|
||||||
|
for (Exception e : exceptions)
|
||||||
|
e.write(out);
|
||||||
|
}
|
||||||
|
|
||||||
public Code getCode()
|
public Code getCode()
|
||||||
{
|
{
|
||||||
return code;
|
return code;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package info.sigterm.deob.attributes.code;
|
|||||||
|
|
||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public abstract class Instruction
|
public abstract class Instruction
|
||||||
@@ -22,6 +24,11 @@ public abstract class Instruction
|
|||||||
this.pc = pc;
|
this.pc = pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
out.writeByte(type.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
public Instructions getInstructions()
|
public Instructions getInstructions()
|
||||||
{
|
{
|
||||||
return instructions;
|
return instructions;
|
||||||
@@ -60,5 +67,9 @@ public abstract class Instruction
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void execute(Frame e);
|
public abstract void execute(Frame e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,18 @@ package info.sigterm.deob.attributes.code;
|
|||||||
|
|
||||||
import info.sigterm.deob.attributes.Code;
|
import info.sigterm.deob.attributes.Code;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Instructions
|
public class Instructions
|
||||||
{
|
{
|
||||||
private Code code;
|
private Code code;
|
||||||
private ArrayList<Instruction> instructions = new ArrayList<Instruction>();
|
private List<Instruction> instructions = new ArrayList<>();
|
||||||
|
|
||||||
public Instructions(Code code) throws IOException
|
public Instructions(Code code) throws IOException
|
||||||
{
|
{
|
||||||
@@ -47,6 +50,21 @@ public class Instructions
|
|||||||
buildJumpGraph();
|
buildJumpGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream o = new DataOutputStream(b);
|
||||||
|
int pc = 0;
|
||||||
|
for (Instruction i : instructions)
|
||||||
|
{
|
||||||
|
i.write(o, pc);
|
||||||
|
pc = o.size();
|
||||||
|
}
|
||||||
|
byte[] ba = b.toByteArray();
|
||||||
|
out.writeInt(ba.length);
|
||||||
|
out.write(ba);
|
||||||
|
}
|
||||||
|
|
||||||
private void buildJumpGraph()
|
private void buildJumpGraph()
|
||||||
{
|
{
|
||||||
for (Instruction i : instructions)
|
for (Instruction i : instructions)
|
||||||
@@ -59,6 +77,12 @@ public class Instructions
|
|||||||
i.buildInstructionGraph();
|
i.buildInstructionGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
for (Instruction i : instructions)
|
||||||
|
i.buildCallGraph();
|
||||||
|
}
|
||||||
|
|
||||||
public Code getCode()
|
public Code getCode()
|
||||||
{
|
{
|
||||||
return code;
|
return code;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ALoad extends Instruction
|
public class ALoad extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class ALoad extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.pool.Class;
|
import info.sigterm.deob.pool.Class;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ANewArray extends Instruction
|
public class ANewArray extends Instruction
|
||||||
@@ -25,6 +26,13 @@ public class ANewArray extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class AStore extends Instruction
|
public class AStore extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class AStore extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class BiPush extends Instruction
|
public class BiPush extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class BiPush extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(b);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import info.sigterm.deob.execution.ObjectInstance;
|
|||||||
import info.sigterm.deob.pool.Class;
|
import info.sigterm.deob.pool.Class;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class CheckCast extends Instruction
|
public class CheckCast extends Instruction
|
||||||
@@ -25,6 +26,13 @@ public class CheckCast extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class DLoad extends Instruction
|
public class DLoad extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class DLoad extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class DStore extends Instruction
|
public class DStore extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class DStore extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class FLoad extends Instruction
|
public class FLoad extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class FLoad extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class FStore extends Instruction
|
public class FStore extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class FStore extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import info.sigterm.deob.pool.Field;
|
|||||||
import info.sigterm.deob.pool.NameAndType;
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class GetField extends Instruction
|
public class GetField extends Instruction
|
||||||
@@ -27,6 +28,13 @@ public class GetField extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import info.sigterm.deob.pool.Field;
|
|||||||
import info.sigterm.deob.pool.NameAndType;
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class GetStatic extends Instruction
|
public class GetStatic extends Instruction
|
||||||
@@ -28,6 +29,13 @@ public class GetStatic extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Goto extends Instruction
|
public class Goto extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class Goto extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildJumpGraph()
|
public void buildJumpGraph()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class GotoW extends Instruction
|
public class GotoW extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class GotoW extends Instruction
|
|||||||
length += 4;
|
length += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeInt(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildJumpGraph()
|
public void buildJumpGraph()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IInc extends Instruction
|
public class IInc extends Instruction
|
||||||
@@ -23,6 +24,14 @@ public class IInc extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
out.writeByte(inc);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ILoad extends Instruction
|
public class ILoad extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class ILoad extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class IStore extends Instruction
|
public class IStore extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class IStore extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.execution.Path;
|
import info.sigterm.deob.execution.Path;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class If extends Instruction
|
public class If extends Instruction
|
||||||
@@ -22,6 +23,13 @@ public class If extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildJumpGraph()
|
public void buildJumpGraph()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.execution.Path;
|
import info.sigterm.deob.execution.Path;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class If0 extends Instruction
|
public class If0 extends Instruction
|
||||||
@@ -22,6 +23,13 @@ public class If0 extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildJumpGraph()
|
public void buildJumpGraph()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import info.sigterm.deob.execution.ObjectInstanceBase;
|
|||||||
import info.sigterm.deob.pool.Class;
|
import info.sigterm.deob.pool.Class;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InstanceOf extends Instruction
|
public class InstanceOf extends Instruction
|
||||||
@@ -25,6 +26,13 @@ public class InstanceOf extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ import info.sigterm.deob.execution.ClassInstance;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.ObjectInstance;
|
import info.sigterm.deob.execution.ObjectInstance;
|
||||||
import info.sigterm.deob.pool.InterfaceMethod;
|
import info.sigterm.deob.pool.InterfaceMethod;
|
||||||
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InvokeInterface extends Instruction
|
public class InvokeInterface extends Instruction
|
||||||
@@ -30,6 +32,36 @@ public class InvokeInterface extends Instruction
|
|||||||
length += 4;
|
length += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
out.writeByte(count);
|
||||||
|
out.writeByte(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
|
||||||
|
|
||||||
|
ConstantPool pool = thisClass.getPool();
|
||||||
|
InterfaceMethod method = (InterfaceMethod) pool.getEntry(index);
|
||||||
|
|
||||||
|
info.sigterm.deob.pool.Class clazz = method.getClassEntry();
|
||||||
|
NameAndType nat = method.getNameAndType();
|
||||||
|
|
||||||
|
info.sigterm.deob.Method thisMethod = this.getInstructions().getCode().getAttributes().getMethod();
|
||||||
|
|
||||||
|
ClassFile otherClass = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||||
|
if (otherClass == null)
|
||||||
|
return;
|
||||||
|
info.sigterm.deob.Method other = otherClass.findMethod(nat);
|
||||||
|
|
||||||
|
thisMethod.addCallTo(this, other);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ import info.sigterm.deob.execution.ClassInstance;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.ObjectInstance;
|
import info.sigterm.deob.execution.ObjectInstance;
|
||||||
import info.sigterm.deob.pool.Method;
|
import info.sigterm.deob.pool.Method;
|
||||||
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
import info.sigterm.deob.pool.PoolEntry;
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InvokeSpecial extends Instruction
|
public class InvokeSpecial extends Instruction
|
||||||
@@ -27,6 +29,35 @@ public class InvokeSpecial extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
|
||||||
|
|
||||||
|
ConstantPool pool = thisClass.getPool();
|
||||||
|
Method method = (Method) pool.getEntry(index);
|
||||||
|
|
||||||
|
info.sigterm.deob.pool.Class clazz = method.getClassEntry();
|
||||||
|
NameAndType nat = method.getNameAndType();
|
||||||
|
|
||||||
|
info.sigterm.deob.Method thisMethod = this.getInstructions().getCode().getAttributes().getMethod();
|
||||||
|
|
||||||
|
ClassFile otherClass = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||||
|
if (otherClass == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
info.sigterm.deob.Method other = otherClass.findMethod(nat);
|
||||||
|
|
||||||
|
thisMethod.addCallTo(this, other);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ 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.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.pool.Method;
|
import info.sigterm.deob.pool.Method;
|
||||||
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InvokeStatic extends Instruction
|
public class InvokeStatic extends Instruction
|
||||||
@@ -24,6 +26,35 @@ public class InvokeStatic extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
|
||||||
|
|
||||||
|
ConstantPool pool = thisClass.getPool();
|
||||||
|
Method method = (Method) pool.getEntry(index);
|
||||||
|
|
||||||
|
info.sigterm.deob.pool.Class clazz = method.getClassEntry();
|
||||||
|
NameAndType nat = method.getNameAndType();
|
||||||
|
|
||||||
|
info.sigterm.deob.Method thisMethod = this.getInstructions().getCode().getAttributes().getMethod();
|
||||||
|
|
||||||
|
ClassFile otherClass = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||||
|
if (otherClass == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
info.sigterm.deob.Method other = otherClass.findMethod(nat);
|
||||||
|
|
||||||
|
thisMethod.addCallTo(this, other);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import info.sigterm.deob.execution.ClassInstance;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
import info.sigterm.deob.execution.ObjectInstance;
|
import info.sigterm.deob.execution.ObjectInstance;
|
||||||
import info.sigterm.deob.pool.Method;
|
import info.sigterm.deob.pool.Method;
|
||||||
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InvokeVirtual extends Instruction
|
public class InvokeVirtual extends Instruction
|
||||||
@@ -26,6 +28,36 @@ public class InvokeVirtual extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildCallGraph()
|
||||||
|
{
|
||||||
|
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
|
||||||
|
|
||||||
|
ConstantPool pool = thisClass.getPool();
|
||||||
|
Method method = (Method) pool.getEntry(index);
|
||||||
|
|
||||||
|
info.sigterm.deob.pool.Class clazz = method.getClassEntry();
|
||||||
|
NameAndType nat = method.getNameAndType();
|
||||||
|
|
||||||
|
info.sigterm.deob.Method thisMethod = this.getInstructions().getCode().getAttributes().getMethod();
|
||||||
|
|
||||||
|
ClassFile otherClass = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
|
||||||
|
if (otherClass == null)
|
||||||
|
return;
|
||||||
|
info.sigterm.deob.Method other = otherClass.findMethod(nat);
|
||||||
|
if (other == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
thisMethod.addCallTo(this, other);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.pool.PoolEntry;
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LDC extends Instruction
|
public class LDC extends Instruction
|
||||||
@@ -23,6 +24,13 @@ public class LDC extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.pool.PoolEntry;
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LDC2_W extends Instruction
|
public class LDC2_W extends Instruction
|
||||||
@@ -23,6 +24,13 @@ public class LDC2_W extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.pool.PoolEntry;
|
import info.sigterm.deob.pool.PoolEntry;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LDC_W extends Instruction
|
public class LDC_W extends Instruction
|
||||||
@@ -23,6 +24,13 @@ public class LDC_W extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LLoad extends Instruction
|
public class LLoad extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class LLoad extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LStore extends Instruction
|
public class LStore extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class LStore extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.execution.Path;
|
import info.sigterm.deob.execution.Path;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class LookupSwitch extends Instruction
|
public class LookupSwitch extends Instruction
|
||||||
@@ -41,6 +42,25 @@ public class LookupSwitch extends Instruction
|
|||||||
length += tableSkip + 8 + (count * 8);
|
length += tableSkip + 8 + (count * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
|
||||||
|
int tableSkip = 4 - (pc + 1) % 4;
|
||||||
|
if (tableSkip == 4) tableSkip = 0;
|
||||||
|
if (tableSkip > 0) out.write(new byte[tableSkip]);
|
||||||
|
|
||||||
|
out.writeInt(def);
|
||||||
|
|
||||||
|
out.writeInt(count);
|
||||||
|
for (int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
out.writeInt(match[i]);
|
||||||
|
out.writeInt(branch[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildJumpGraph()
|
public void buildJumpGraph()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import info.sigterm.deob.execution.Stack;
|
|||||||
import info.sigterm.deob.pool.Class;
|
import info.sigterm.deob.pool.Class;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class MultiANewArray extends Instruction
|
public class MultiANewArray extends Instruction
|
||||||
@@ -26,6 +27,14 @@ public class MultiANewArray extends Instruction
|
|||||||
length += 3;
|
length += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
out.writeByte(dimensions);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import info.sigterm.deob.execution.ObjectInstance;
|
|||||||
import info.sigterm.deob.pool.Class;
|
import info.sigterm.deob.pool.Class;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class New extends Instruction
|
public class New extends Instruction
|
||||||
@@ -25,6 +26,13 @@ public class New extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class NewArray extends Instruction
|
public class NewArray extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class NewArray extends Instruction
|
|||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeByte(type);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import info.sigterm.deob.pool.Field;
|
|||||||
import info.sigterm.deob.pool.NameAndType;
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PutField extends Instruction
|
public class PutField extends Instruction
|
||||||
@@ -27,6 +28,13 @@ public class PutField extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import info.sigterm.deob.pool.Field;
|
|||||||
import info.sigterm.deob.pool.NameAndType;
|
import info.sigterm.deob.pool.NameAndType;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PutStatic extends Instruction
|
public class PutStatic extends Instruction
|
||||||
@@ -28,6 +29,13 @@ public class PutStatic extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class SiPush extends Instruction
|
public class SiPush extends Instruction
|
||||||
@@ -21,6 +22,13 @@ public class SiPush extends Instruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
out.writeShort(s);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame frame)
|
public void execute(Frame frame)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import info.sigterm.deob.execution.Frame;
|
|||||||
import info.sigterm.deob.execution.Path;
|
import info.sigterm.deob.execution.Path;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class TableSwitch extends Instruction
|
public class TableSwitch extends Instruction
|
||||||
@@ -39,6 +40,23 @@ public class TableSwitch extends Instruction
|
|||||||
length += tableSkip + 12 + (count * 4);
|
length += tableSkip + 12 + (count * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
|
||||||
|
int tableSkip = 4 - (pc + 1) % 4;
|
||||||
|
if (tableSkip == 4) tableSkip = 0;
|
||||||
|
if (tableSkip > 0) out.write(new byte[tableSkip]);
|
||||||
|
|
||||||
|
out.writeInt(def);
|
||||||
|
out.writeInt(low);
|
||||||
|
out.writeInt(high);
|
||||||
|
|
||||||
|
for (int i = 0; i < high - low + 1; ++i)
|
||||||
|
out.writeInt(jumps[i]);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildJumpGraph()
|
public void buildJumpGraph()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import info.sigterm.deob.attributes.code.Instructions;
|
|||||||
import info.sigterm.deob.execution.Frame;
|
import info.sigterm.deob.execution.Frame;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Wide extends Instruction
|
public class Wide extends Instruction
|
||||||
@@ -34,6 +35,22 @@ public class Wide extends Instruction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out, int pc) throws IOException
|
||||||
|
{
|
||||||
|
super.write(out, pc);
|
||||||
|
|
||||||
|
out.writeByte(opcode);
|
||||||
|
out.writeShort(index);
|
||||||
|
|
||||||
|
InstructionType optype = InstructionType.findInstructionFromCode(opcode);
|
||||||
|
assert optype != null;
|
||||||
|
if (optype == InstructionType.IINC)
|
||||||
|
{
|
||||||
|
out.writeShort(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Frame e)
|
public void execute(Frame e)
|
||||||
{
|
{
|
||||||
|
|||||||
17
src/main/java/info/sigterm/deob/callgraph/Node.java
Normal file
17
src/main/java/info/sigterm/deob/callgraph/Node.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package info.sigterm.deob.callgraph;
|
||||||
|
|
||||||
|
import info.sigterm.deob.Method;
|
||||||
|
import info.sigterm.deob.attributes.code.Instruction;
|
||||||
|
|
||||||
|
public class Node
|
||||||
|
{
|
||||||
|
public Method from, to;
|
||||||
|
public Instruction ins;
|
||||||
|
|
||||||
|
public Node(Method from, Method to, Instruction ins)
|
||||||
|
{
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
this.ins = ins;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Class extends PoolEntry
|
public class Class extends PoolEntry
|
||||||
@@ -22,4 +23,10 @@ public class Class extends PoolEntry
|
|||||||
UTF8 u = (UTF8) this.getPool().getEntry(index);
|
UTF8 u = (UTF8) this.getPool().getEntry(index);
|
||||||
return u.getValue();
|
return u.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Double extends PoolEntry
|
public class Double extends PoolEntry
|
||||||
@@ -29,4 +30,10 @@ public class Double extends PoolEntry
|
|||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeDouble(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Field extends PoolEntry
|
public class Field extends PoolEntry
|
||||||
@@ -29,4 +30,11 @@ public class Field extends PoolEntry
|
|||||||
{
|
{
|
||||||
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
|
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(classIndex);
|
||||||
|
out.writeShort(nameAndTypeIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Float extends PoolEntry
|
public class Float extends PoolEntry
|
||||||
@@ -23,4 +24,10 @@ public class Float extends PoolEntry
|
|||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeFloat(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Integer extends PoolEntry
|
public class Integer extends PoolEntry
|
||||||
@@ -23,4 +24,10 @@ public class Integer extends PoolEntry
|
|||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeInt(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InterfaceMethod extends PoolEntry
|
public class InterfaceMethod extends PoolEntry
|
||||||
@@ -29,4 +30,11 @@ public class InterfaceMethod extends PoolEntry
|
|||||||
{
|
{
|
||||||
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
|
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(classIndex);
|
||||||
|
out.writeShort(nameAndTypeIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Long extends PoolEntry
|
public class Long extends PoolEntry
|
||||||
@@ -29,4 +30,10 @@ public class Long extends PoolEntry
|
|||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeLong(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Method extends PoolEntry
|
public class Method extends PoolEntry
|
||||||
@@ -29,4 +30,11 @@ public class Method extends PoolEntry
|
|||||||
{
|
{
|
||||||
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
|
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(classIndex);
|
||||||
|
out.writeShort(nameAndTypeIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -87,4 +88,11 @@ public class NameAndType extends PoolEntry
|
|||||||
return true;
|
return true;
|
||||||
return !methodRefType.endsWith(")V");
|
return !methodRefType.endsWith(")V");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(nameIndex);
|
||||||
|
out.writeShort(descriptorIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package info.sigterm.deob.pool;
|
package info.sigterm.deob.pool;
|
||||||
|
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
public abstract class PoolEntry
|
public abstract class PoolEntry
|
||||||
@@ -13,11 +16,18 @@ public abstract class PoolEntry
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void write(DataOutputStream out) throws IOException;
|
||||||
|
|
||||||
public ConstantPool getPool()
|
public ConstantPool getPool()
|
||||||
{
|
{
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConstantType getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
public int getSlots()
|
public int getSlots()
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class String extends PoolEntry
|
public class String extends PoolEntry
|
||||||
@@ -23,4 +24,10 @@ public class String extends PoolEntry
|
|||||||
{
|
{
|
||||||
return this.getPool().getEntry(stringIndex).getObject();
|
return this.getPool().getEntry(stringIndex).getObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
out.writeShort(stringIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.sigterm.deob.pool;
|
|||||||
import info.sigterm.deob.ConstantPool;
|
import info.sigterm.deob.ConstantPool;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class UTF8 extends PoolEntry
|
public class UTF8 extends PoolEntry
|
||||||
@@ -51,4 +52,14 @@ public class UTF8 extends PoolEntry
|
|||||||
{
|
{
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
{
|
||||||
|
java.lang.String s = getValue();
|
||||||
|
byte[] bytes = s.getBytes("UTF-8");
|
||||||
|
|
||||||
|
out.writeShort(bytes.length);
|
||||||
|
out.write(bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user