Split intValue/longValue.
This commit is contained in:
@@ -25,53 +25,53 @@ public class Deob
|
|||||||
{
|
{
|
||||||
public static void main(String[] args) throws IOException
|
public static void main(String[] args) throws IOException
|
||||||
{
|
{
|
||||||
merge(); if(true) return;
|
//merge(); if(true) return;
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
ClassGroup group = JarUtil.loadJar(new File(args[0]));
|
ClassGroup group = JarUtil.loadJar(new File(args[0]));
|
||||||
|
|
||||||
// run(group, new RenameUnique());
|
run(group, new RenameUnique());
|
||||||
//
|
|
||||||
// // remove except RuntimeException
|
// remove except RuntimeException
|
||||||
// run(group, new RuntimeExceptions());
|
run(group, new RuntimeExceptions());
|
||||||
//
|
|
||||||
// // remove unused methods
|
// remove unused methods
|
||||||
// run(group, new UnreachedCode());
|
run(group, new UnreachedCode());
|
||||||
// run(group, new UnusedMethods());
|
run(group, new UnusedMethods());
|
||||||
//
|
|
||||||
// // remove illegal state exceptions, frees up some parameters
|
// remove illegal state exceptions, frees up some parameters
|
||||||
// run(group, new IllegalStateExceptions());
|
run(group, new IllegalStateExceptions());
|
||||||
//
|
|
||||||
// // remove constant logically dead parameters
|
// remove constant logically dead parameters
|
||||||
// run(group, new ConstantParameter());
|
run(group, new ConstantParameter());
|
||||||
//
|
|
||||||
// // remove unhit blocks
|
// remove unhit blocks
|
||||||
// run(group, new UnreachedCode());
|
run(group, new UnreachedCode());
|
||||||
// run(group, new UnusedMethods());
|
run(group, new UnusedMethods());
|
||||||
//
|
|
||||||
// // remove unused parameters
|
// remove unused parameters
|
||||||
// run(group, new UnusedParameters());
|
run(group, new UnusedParameters());
|
||||||
//
|
|
||||||
// // remove unused fields
|
// remove unused fields
|
||||||
// run(group, new UnusedFields());
|
run(group, new UnusedFields());
|
||||||
//
|
|
||||||
// // remove unused methods, again?
|
// remove unused methods, again?
|
||||||
// run(group, new UnusedMethods());
|
run(group, new UnusedMethods());
|
||||||
//
|
|
||||||
//// run(group, new MethodInliner());
|
// run(group, new MethodInliner());
|
||||||
//// run(group, new UnusedMethods()); // inliner might leave unused methods
|
// run(group, new UnusedMethods()); // inliner might leave unused methods
|
||||||
//
|
|
||||||
//// // broken because rename was removed
|
// // broken because rename was removed
|
||||||
//// //run(group, new MethodMover());
|
// //run(group, new MethodMover());
|
||||||
//
|
|
||||||
// run(group, new FieldInliner());
|
run(group, new FieldInliner());
|
||||||
//
|
|
||||||
//// // XXX this is broken because when moving clinit around, some fields can depend on other fields
|
// // XXX this is broken because when moving clinit around, some fields can depend on other fields
|
||||||
//// // (like multianewarray)
|
// // (like multianewarray)
|
||||||
//// //new FieldMover().run(group);
|
// //new FieldMover().run(group);
|
||||||
//
|
|
||||||
// run(group, new UnusedClass());
|
run(group, new UnusedClass());
|
||||||
|
|
||||||
ModArith mod = new ModArith();
|
ModArith mod = new ModArith();
|
||||||
mod.run(group);
|
mod.run(group);
|
||||||
@@ -91,6 +91,8 @@ public class Deob
|
|||||||
last = cur;
|
last = cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod.annotateEncryption();
|
||||||
|
|
||||||
// eval constant fields (only set once to a constant in ctor) maybe just inline them
|
// eval constant fields (only set once to a constant in ctor) maybe just inline them
|
||||||
|
|
||||||
// make fields private
|
// make fields private
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class Attributes
|
|||||||
attributes.add(a);
|
attributes.add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAnnotation(Type type, PoolEntry value)
|
public void addAnnotation(Type type, String etype, PoolEntry value)
|
||||||
{
|
{
|
||||||
Annotations an = (Annotations) findType(AttributeType.RUNTIMEVISIBLEANNOTATIONS);
|
Annotations an = (Annotations) findType(AttributeType.RUNTIMEVISIBLEANNOTATIONS);
|
||||||
if (an == null)
|
if (an == null)
|
||||||
@@ -142,7 +142,7 @@ public class Attributes
|
|||||||
an.addAnnotation(annotation);
|
an.addAnnotation(annotation);
|
||||||
|
|
||||||
Element element = new Element(annotation);
|
Element element = new Element(annotation);
|
||||||
element.setType(new Type("value"));
|
element.setType(new Type(etype));
|
||||||
element.setValue(value);
|
element.setValue(value);
|
||||||
annotation.addElement(element);
|
annotation.addElement(element);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,15 +80,6 @@ public class RenameUnique implements Deobfuscator
|
|||||||
this.generatFieldNames(mappings, group);
|
this.generatFieldNames(mappings, group);
|
||||||
this.generateMethodNames(mappings, group);
|
this.generateMethodNames(mappings, group);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mappings.save(new File("d:/rs/07/uniquemappings.json"));
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
Logger.getLogger(RenameUnique.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
renamer = new Renamer(mappings);
|
renamer = new Renamer(mappings);
|
||||||
renamer.run(group);
|
renamer.run(group);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class Renamer implements Deobfuscator
|
|||||||
field.setType(new Type("L" + name + ";", field.getType().getArrayDims()));
|
field.setType(new Type("L" + name + ";", field.getType().getArrayDims()));
|
||||||
}
|
}
|
||||||
|
|
||||||
cf.getAttributes().addAnnotation(OBFUSCATED_NAME_TYPE, new UTF8(cf.getName()));
|
cf.getAttributes().addAnnotation(OBFUSCATED_NAME_TYPE, "value", new UTF8(cf.getName()));
|
||||||
cf.setName(name);
|
cf.setName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ public class Renamer implements Deobfuscator
|
|||||||
if (newName == null)
|
if (newName == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
field.getAttributes().addAnnotation(OBFUSCATED_NAME_TYPE, new UTF8(field.getName()));
|
field.getAttributes().addAnnotation(OBFUSCATED_NAME_TYPE, "value", new UTF8(field.getName()));
|
||||||
field.setName(newName);
|
field.setName(newName);
|
||||||
++fields;
|
++fields;
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ public class Renamer implements Deobfuscator
|
|||||||
|
|
||||||
for (Method m : virtualMethods)
|
for (Method m : virtualMethods)
|
||||||
{
|
{
|
||||||
m.getAttributes().addAnnotation(OBFUSCATED_NAME_TYPE, new UTF8(m.getName()));
|
m.getAttributes().addAnnotation(OBFUSCATED_NAME_TYPE, "value", new UTF8(m.getName()));
|
||||||
m.setName(newName);
|
m.setName(newName);
|
||||||
}
|
}
|
||||||
methods += virtualMethods.size();
|
methods += virtualMethods.size();
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class ModArith implements Deobfuscator
|
|||||||
private MultiValueMap<Field, Number> constantGetters = new MultiValueMap<>(),
|
private MultiValueMap<Field, Number> constantGetters = new MultiValueMap<>(),
|
||||||
constantSetters = new MultiValueMap<>();
|
constantSetters = new MultiValueMap<>();
|
||||||
private List<Pair> pairs = new ArrayList<>();
|
private List<Pair> pairs = new ArrayList<>();
|
||||||
|
private Encryption encryption = new Encryption();
|
||||||
|
|
||||||
private List<InstructionContext> getInsInExpr(InstructionContext ctx, Set<Instruction> set)
|
private List<InstructionContext> getInsInExpr(InstructionContext ctx, Set<Instruction> set)
|
||||||
{
|
{
|
||||||
@@ -651,8 +652,6 @@ public class ModArith implements Deobfuscator
|
|||||||
execution.populateInitialMethods();
|
execution.populateInitialMethods();
|
||||||
execution.run();
|
execution.run();
|
||||||
|
|
||||||
Encryption encryption = new Encryption();
|
|
||||||
|
|
||||||
findUses();
|
findUses();
|
||||||
findUses2();
|
findUses2();
|
||||||
reduce2();
|
reduce2();
|
||||||
@@ -671,23 +670,12 @@ public class ModArith implements Deobfuscator
|
|||||||
System.out.println("Changed " + ++i);
|
System.out.println("Changed " + ++i);
|
||||||
}
|
}
|
||||||
|
|
||||||
annotateEncryption(encryption);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
encryption.save(new File("d:/rs/07/encryption.json"));
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
Logger.getLogger(ModArith.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Type OBFUSCATED_GETTER = new Type("Lnet/runelite/mapping/ObfuscatedGetter;");
|
private static final Type OBFUSCATED_GETTER = new Type("Lnet/runelite/mapping/ObfuscatedGetter;");
|
||||||
|
|
||||||
private void annotateEncryption(Encryption encryption)
|
public void annotateEncryption()
|
||||||
{
|
{
|
||||||
for (ClassFile cf : group.getClasses())
|
for (ClassFile cf : group.getClasses())
|
||||||
{
|
{
|
||||||
@@ -700,7 +688,10 @@ public class ModArith implements Deobfuscator
|
|||||||
PoolEntry value = pair.getType() == Long.class ?
|
PoolEntry value = pair.getType() == Long.class ?
|
||||||
new net.runelite.deob.pool.Long((long) pair.getter) :
|
new net.runelite.deob.pool.Long((long) pair.getter) :
|
||||||
new net.runelite.deob.pool.Integer((int) pair.getter);
|
new net.runelite.deob.pool.Integer((int) pair.getter);
|
||||||
f.getAttributes().addAnnotation(OBFUSCATED_GETTER, value);
|
String ename = pair.getType() == Long.class ?
|
||||||
|
"longValue" :
|
||||||
|
"intValue";
|
||||||
|
f.getAttributes().addAnnotation(OBFUSCATED_GETTER, ename, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user