Solved methods 952, solved fields 1028, unsolved methods 106, unsolved fields 1267
This commit is contained in:
@@ -158,6 +158,13 @@ public class Rename2
|
||||
|
||||
assert s.getGraph() != other.getGraph();
|
||||
|
||||
boolean b =false;
|
||||
if (s.toString().equals("Vertex{object=B[] class118.field1980}")
|
||||
&& other.toString().equals("Vertex{object=B[] class118.field1986}"))
|
||||
{
|
||||
b=true;
|
||||
}
|
||||
|
||||
for (Edge e : s.getEdges())
|
||||
{
|
||||
assert e.getFrom() == s;
|
||||
@@ -166,12 +173,11 @@ public class Rename2
|
||||
continue; // skip solved edges
|
||||
|
||||
Vertex v = e.getTo(); // end of edge in g1
|
||||
|
||||
boolean b = false;
|
||||
if (s.toString().equals("Vertex{object=class0.<init>()V}") &&
|
||||
v.toString().equals("Vertex{object=class207.<init>()V}"))
|
||||
|
||||
boolean b2 = false;
|
||||
if (b && v.toString().equals("Vertex{object=class118.method2566()B}"))
|
||||
{
|
||||
b = true;
|
||||
b2 = true;
|
||||
}
|
||||
|
||||
List<Vertex> l = new ArrayList<>();
|
||||
@@ -180,15 +186,24 @@ public class Rename2
|
||||
if (e2.getTo().getOther() != null)
|
||||
continue; // skip solved edges
|
||||
|
||||
if (b2)
|
||||
{
|
||||
Method m = (Method) e2.getTo().getObject();
|
||||
if (m.getName().equals("method2489"))
|
||||
{
|
||||
b2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!e.getTo().couldBeEqual(e2.getTo()))
|
||||
{
|
||||
System.out.println(e.getTo() + " != " + e2.getTo());
|
||||
// System.out.println(e.getTo() + " != " + e2.getTo());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!e.couldBeEqual(e2))
|
||||
{
|
||||
System.out.println(e + " != " + e2);
|
||||
// System.out.println(e + " != " + e2);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -239,21 +254,21 @@ public class Rename2
|
||||
ClassFile cf1 = one.findClass("client"), cf2 = two.findClass("client");
|
||||
mapDeobfuscatedMethods(cf1, cf2);
|
||||
|
||||
// List<Field> fl1 = getClientFields(one, eone);
|
||||
// List<Field> fl2 = getClientFields(two, etwo);
|
||||
//
|
||||
// for (int i = 0; i < Math.min(fl1.size(), fl2.size()); ++i)
|
||||
// {
|
||||
// Field f1 = fl1.get(i), f2 = fl2.get(i);
|
||||
//
|
||||
// Vertex v1 = g1.getVertexFor(f1);
|
||||
// Vertex v2 = g2.getVertexFor(f2);
|
||||
//
|
||||
// v1.is(v2);
|
||||
// v2.is(v1);
|
||||
//
|
||||
// System.out.println(fname(f1) + " is " + fname(f2));
|
||||
// }
|
||||
List<Field> fl1 = getClientFields(one, eone);
|
||||
List<Field> fl2 = getClientFields(two, etwo);
|
||||
|
||||
for (int i = 0; i < Math.min(fl1.size(), fl2.size()); ++i)
|
||||
{
|
||||
Field f1 = fl1.get(i), f2 = fl2.get(i);
|
||||
|
||||
Vertex v1 = g1.getVertexFor(f1);
|
||||
Vertex v2 = g2.getVertexFor(f2);
|
||||
|
||||
v1.is(v2);
|
||||
v2.is(v1);
|
||||
|
||||
System.out.println(fname(f1) + " is " + fname(f2));
|
||||
}
|
||||
|
||||
System.out.println("g1 verticies " + g1.getVerticies().size() + " reachable " + g1.reachableVerticiesFromSolvedVerticies().size());
|
||||
Set<Vertex> reachable = g1.reachableVerticiesFromSolvedVerticies();
|
||||
@@ -314,7 +329,7 @@ public class Rename2
|
||||
//
|
||||
// show(mappings);
|
||||
|
||||
System.out.println("Solved methods "+ g1.solved(VertexType.METHOD) + ", solved fields " + g1.solved(VertexType.FIELD) + ", total " + g1.getVerticies().size());
|
||||
System.out.println("Solved methods "+ g1.solved(VertexType.METHOD) + ", solved fields " + g1.solved(VertexType.FIELD) + ", unsolved methods " +g1.unsolved(VertexType.METHOD) + ", unsolved fields " + g1.unsolved(VertexType.FIELD));
|
||||
|
||||
//rename(mappings, two);
|
||||
|
||||
|
||||
@@ -6,5 +6,7 @@ public enum EdgeType
|
||||
GETFIELD,
|
||||
SETFIELD,
|
||||
|
||||
INVOKED_FROM;
|
||||
INVOKED_FROM,
|
||||
GETFIELD_FROM,
|
||||
SETFIELD_FROM;
|
||||
}
|
||||
|
||||
@@ -93,6 +93,15 @@ public class Graph
|
||||
return solved;
|
||||
}
|
||||
|
||||
public int unsolved(VertexType type)
|
||||
{
|
||||
int solved = 0;
|
||||
for (Vertex v : verticies)
|
||||
if (v.getOther() == null && type == v.getType())
|
||||
++solved;
|
||||
return solved;
|
||||
}
|
||||
|
||||
private void recurse(Vertex v, Set<Vertex> verticies)
|
||||
{
|
||||
if (verticies.contains(v))
|
||||
|
||||
@@ -122,9 +122,14 @@ public class Vertex
|
||||
public void merge(Collection<Vertex> maybe)
|
||||
{
|
||||
boolean b = false;
|
||||
if (this.toString().equals("Vertex{object=class207.<init>()V}"))
|
||||
if (this.object instanceof Method)
|
||||
{
|
||||
b = true;
|
||||
Method m = (Method) object;
|
||||
|
||||
if (m.getName().equals("method2566"))
|
||||
{
|
||||
b = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mightBe == null)
|
||||
@@ -133,7 +138,7 @@ public class Vertex
|
||||
{
|
||||
int old = mightBe.size();
|
||||
mightBe = CollectionUtils.intersection(mightBe, maybe);
|
||||
if (old == 1 && mightBe.isEmpty())
|
||||
if (b && old == 1 && mightBe.isEmpty())
|
||||
{
|
||||
int i = 6;
|
||||
}
|
||||
@@ -152,11 +157,11 @@ public class Vertex
|
||||
|
||||
if (mightBe != null && mightBe.size() > 1)
|
||||
{
|
||||
System.out.println("Can't decide for " + this);
|
||||
// System.out.println("Can't decide for " + this);
|
||||
|
||||
for(Vertex v : mightBe)
|
||||
System.out.println(v);
|
||||
int i = 5;
|
||||
// for(Vertex v : mightBe)
|
||||
// System.out.println(v);
|
||||
// int i = 5;
|
||||
}
|
||||
if (mightBe.isEmpty())
|
||||
{
|
||||
@@ -166,6 +171,7 @@ public class Vertex
|
||||
if (mightBe != null && mightBe.size() == 1)
|
||||
{
|
||||
Vertex v = mightBe.stream().findAny().get();
|
||||
|
||||
//if (v.getOther() == null || v.getOther() == this)
|
||||
{
|
||||
is(v);
|
||||
@@ -173,6 +179,12 @@ public class Vertex
|
||||
mightBe = null;
|
||||
System.out.println(this + " is " + is);
|
||||
}
|
||||
|
||||
if (object instanceof Method)
|
||||
{
|
||||
//Method m = (Method) object;
|
||||
//if (m.getName().equals
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,9 +192,11 @@ public class Vertex
|
||||
{
|
||||
if (is != null)
|
||||
{
|
||||
assert graph != other.graph;
|
||||
assert is.graph == other.graph;
|
||||
Rename2.collide(object, is.object, other.object);
|
||||
assert is.is == this;
|
||||
is.is = null;
|
||||
is = null;
|
||||
|
||||
//Rename2.collide(object, is.object, other.object);
|
||||
}
|
||||
assert is == null;
|
||||
assert other.graph != graph;
|
||||
|
||||
@@ -184,7 +184,7 @@ public class Execution
|
||||
|
||||
for (Field f : cf.getFields().getFields())
|
||||
{
|
||||
// graph.addVertex(f, VertexType.FIELD);
|
||||
graph.addVertex(f, VertexType.FIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,9 @@ public class Execution
|
||||
return;
|
||||
|
||||
EdgeType type = fi instanceof GetFieldInstruction ? EdgeType.GETFIELD : EdgeType.SETFIELD;
|
||||
//graph.addEdge(frame.nonStatic, fi.getMyField(), type);
|
||||
graph.addEdge(frame.nonStatic, fi.getMyField(), type);
|
||||
EdgeType typeRev = fi instanceof GetFieldInstruction ? EdgeType.GETFIELD_FROM : EdgeType.SETFIELD_FROM;
|
||||
graph.addEdge(fi.getMyField(), frame.nonStatic, typeRev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user