mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-03 12:15:15 +00:00
AS3 deobfuscation from commandline.
Separated deobfuscation settings
This commit is contained in:
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.ClassPath;
|
||||
import com.jpexs.decompiler.flash.abc.RenameType;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.DeobfuscationLevel;
|
||||
import com.jpexs.decompiler.flash.abc.types.MethodBody;
|
||||
import com.jpexs.decompiler.flash.abc.types.ScriptInfo;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
@@ -2859,4 +2860,19 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
public String toString() {
|
||||
return getShortFileName();
|
||||
}
|
||||
|
||||
public void deobfuscate(DeobfuscationLevel level) throws InterruptedException {
|
||||
List<ABCContainerTag> atags = getAbcList();
|
||||
|
||||
for (ABCContainerTag tag : atags) {
|
||||
if (level == DeobfuscationLevel.LEVEL_REMOVE_DEAD_CODE) {
|
||||
tag.getABC().removeDeadCode();
|
||||
} else if (level == DeobfuscationLevel.LEVEL_REMOVE_TRAPS) {
|
||||
tag.getABC().removeTraps();
|
||||
} else if (level == DeobfuscationLevel.LEVEL_RESTORE_CONTROL_FLOW) {
|
||||
tag.getABC().removeTraps();
|
||||
tag.getABC().restoreControlFlow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jpexs.decompiler.flash.abc.avm2.deobfuscation;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum DeobfuscationLevel {
|
||||
|
||||
LEVEL_REMOVE_DEAD_CODE(1),
|
||||
LEVEL_REMOVE_TRAPS(2),
|
||||
LEVEL_RESTORE_CONTROL_FLOW(3);
|
||||
|
||||
private final int level;
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
DeobfuscationLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user