mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 02:20:44 +00:00
organize imorts & code formatting
This commit is contained in:
@@ -341,11 +341,11 @@ public class ABC {
|
||||
minor_version = ais.readU16("minor_version");
|
||||
major_version = ais.readU16("major_version");
|
||||
logger.log(Level.FINE, "ABC minor_version: {0}, major_version: {1}", new Object[]{minor_version, major_version});
|
||||
|
||||
|
||||
constants = new ConstantPool();
|
||||
deobfuscation = new AVM2Deobfuscation(constants);
|
||||
ais.newDumpLevel("constant_pool", "cpool_info");
|
||||
|
||||
|
||||
//constant integers
|
||||
int constant_int_pool_count = ais.readU30("int_count");
|
||||
constants.constant_int = new ArrayList<>(constant_int_pool_count);
|
||||
@@ -471,7 +471,7 @@ public class ABC {
|
||||
}
|
||||
ais.endDumpLevel();
|
||||
}
|
||||
|
||||
|
||||
ais.endDumpLevel(); //cpool_info
|
||||
|
||||
//method info
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ABCInputStream implements AutoCloseable {
|
||||
dumpInfo.getChildInfos().add(di);
|
||||
dumpInfo = di;
|
||||
}
|
||||
|
||||
|
||||
return dumpInfo;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ABCInputStream implements AutoCloseable {
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
public int read(String name) throws IOException {
|
||||
newDumpLevel(name, "byte");
|
||||
int ret = readInternal();
|
||||
|
||||
@@ -48,32 +48,32 @@ public class ActionList extends ArrayList<Action> {
|
||||
|
||||
public ActionList(Collection<Action> actions) {
|
||||
super(actions);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActions(List<Action> list) {
|
||||
clear();
|
||||
addAll(list);
|
||||
}
|
||||
|
||||
|
||||
public void removeAction(int index) {
|
||||
ActionListReader.removeAction(this, index, SWF.DEFAULT_VERSION, true);
|
||||
}
|
||||
|
||||
|
||||
public void removeAction(int index, int count) {
|
||||
if (size() <= index + count - 1) {
|
||||
// Can't remove count elements, only size - index is available
|
||||
count = size() - index;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
ActionListReader.removeAction(this, index, SWF.DEFAULT_VERSION, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addAction(int index, Action action) {
|
||||
ActionListReader.addAction(this, index, action, SWF.DEFAULT_VERSION, false, false);
|
||||
}
|
||||
|
||||
|
||||
public void fixActionList() {
|
||||
ActionListReader.fixActionList(this, null, SWF.DEFAULT_VERSION);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class ActionList extends ArrayList<Action> {
|
||||
public List<Action> getContainerLastActions(Action action) {
|
||||
return ActionListReader.getContainerLastActions(this, action);
|
||||
}
|
||||
|
||||
|
||||
public Iterator<Action> getReferencesFor(final Action target) {
|
||||
final ActionList diz = this;
|
||||
return new Iterator<Action>() {
|
||||
@@ -89,7 +89,7 @@ public class ActionList extends ArrayList<Action> {
|
||||
private final Iterator<Action> iterator = diz.iterator();
|
||||
|
||||
private Action action = getNext();
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return action != null;
|
||||
@@ -101,7 +101,7 @@ public class ActionList extends ArrayList<Action> {
|
||||
action = getNext();
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
private Action getNext() {
|
||||
while (iterator.hasNext()) {
|
||||
Action a = iterator.next();
|
||||
@@ -140,12 +140,12 @@ public class ActionList extends ArrayList<Action> {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void removeNops() {
|
||||
for (int i = 0; i < size(); i++) {
|
||||
if (get(i) instanceof ActionNop) {
|
||||
removeAction(i);
|
||||
}
|
||||
if (get(i) instanceof ActionNop) {
|
||||
removeAction(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,5 +181,5 @@ public class ActionList extends ArrayList<Action> {
|
||||
Logger.getLogger(EmptySWFDecompilerListener.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscator;
|
||||
import com.jpexs.decompiler.flash.AppStrings;
|
||||
import com.jpexs.decompiler.flash.DisassemblyListener;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscator;
|
||||
import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscatorSimple;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
@@ -100,7 +100,7 @@ public class ActionListReader {
|
||||
return readActionList(listeners, sis, version, ip, endIp, path, Configuration.deobfuscationMode.get());
|
||||
}
|
||||
}, Configuration.decompilationTimeoutSingleMethod.get(), TimeUnit.SECONDS);
|
||||
|
||||
|
||||
return actions;
|
||||
} catch (ExecutionException ex) {
|
||||
Throwable cause = ex.getCause();
|
||||
@@ -144,7 +144,7 @@ public class ActionListReader {
|
||||
if (actionMap.isEmpty()) {
|
||||
return new ActionList();
|
||||
}
|
||||
|
||||
|
||||
List<Long> addresses = new ArrayList<>(actionMap.keySet());
|
||||
|
||||
// add end action
|
||||
@@ -157,7 +157,7 @@ public class ActionListReader {
|
||||
actionMap.put(aEnd.getAddress(), aEnd);
|
||||
nextOffsets.put(endAddress, endAddress + 1);
|
||||
}
|
||||
|
||||
|
||||
ActionList actions = fixActionList(new ActionList(actionMap.values()), nextOffsets, version);
|
||||
|
||||
// jump to the entry action when it is diffrent from the first action in the map
|
||||
@@ -198,13 +198,13 @@ public class ActionListReader {
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
public static ActionList fixActionList(ActionList actions, Map<Long, Long> nextOffsets, int version) {
|
||||
Map<Action, List<Action>> containerLastActions = new HashMap<>();
|
||||
getContainerLastActions(actions, containerLastActions);
|
||||
|
||||
ActionList ret = new ActionList();
|
||||
|
||||
|
||||
if (nextOffsets != null) {
|
||||
int index = 0;
|
||||
while (index != -1 && index < actions.size()) {
|
||||
@@ -240,7 +240,7 @@ public class ActionListReader {
|
||||
updateJumps(ret, jumps, containerLastActions, endAddress);
|
||||
updateActionStores(ret, jumps);
|
||||
updateContainerSizes(ret, containerLastActions);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -303,15 +303,15 @@ public class ActionListReader {
|
||||
}
|
||||
}
|
||||
|
||||
deobfustaceActionListAtPosRecursive(listeners,
|
||||
new ArrayList<GraphTargetItem>(),
|
||||
new HashMap<Long, List<GraphSourceItemContainer>>(),
|
||||
new ActionLocalData(),
|
||||
new TranslateStack(),
|
||||
new ConstantPool(),
|
||||
actionMap, ip, retMap, ip, endIp, path,
|
||||
new HashMap<Integer, Integer>(), false,
|
||||
new HashMap<Integer, HashMap<String, GraphTargetItem>>(),
|
||||
deobfustaceActionListAtPosRecursive(listeners,
|
||||
new ArrayList<GraphTargetItem>(),
|
||||
new HashMap<Long, List<GraphSourceItemContainer>>(),
|
||||
new ActionLocalData(),
|
||||
new TranslateStack(),
|
||||
new ConstantPool(),
|
||||
actionMap, ip, retMap, ip, endIp, path,
|
||||
new HashMap<Integer, Integer>(), false,
|
||||
new HashMap<Integer, HashMap<String, GraphTargetItem>>(),
|
||||
version, 0, maxRecursionLevel);
|
||||
|
||||
ActionList ret = new ActionList();
|
||||
@@ -413,7 +413,7 @@ public class ActionListReader {
|
||||
}
|
||||
return lasts;
|
||||
}
|
||||
|
||||
|
||||
private static void getContainerLastActions(ActionList actions, Map<Action, List<Action>> lastActions) {
|
||||
for (Action a : actions) {
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
@@ -540,8 +540,9 @@ public class ActionListReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an action from the action list, and updates all references
|
||||
* This method will keep the inner actions of the container when you remove the container
|
||||
* Removes an action from the action list, and updates all references This
|
||||
* method will keep the inner actions of the container when you remove the
|
||||
* container
|
||||
*
|
||||
* @param actions
|
||||
* @param index
|
||||
@@ -604,7 +605,8 @@ public class ActionListReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an action to the action list to the specified location, and updates all references
|
||||
* Adds an action to the action list to the specified location, and updates
|
||||
* all references
|
||||
*
|
||||
* @param actions
|
||||
* @param index
|
||||
@@ -614,7 +616,7 @@ public class ActionListReader {
|
||||
* @param replaceJump
|
||||
* @return
|
||||
*/
|
||||
public static boolean addAction(ActionList actions, int index, Action action,
|
||||
public static boolean addAction(ActionList actions, int index, Action action,
|
||||
int version, boolean addToContainer, boolean replaceJump) {
|
||||
|
||||
if (index < 0 || actions.size() < index) {
|
||||
@@ -629,7 +631,7 @@ public class ActionListReader {
|
||||
actions.add(aEnd);
|
||||
lastAction = aEnd;
|
||||
}
|
||||
|
||||
|
||||
long endAddress = lastAction.getAddress();
|
||||
|
||||
Map<Action, List<Action>> containerLastActions = new HashMap<>();
|
||||
@@ -651,7 +653,7 @@ public class ActionListReader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (replaceJump) {
|
||||
for (Action a : jumps.keySet()) {
|
||||
Action targetAction = jumps.get(a);
|
||||
@@ -999,7 +1001,7 @@ public class ActionListReader {
|
||||
|
||||
TranslateStack subStack = (TranslateStack) stack.clone();
|
||||
ActionLocalData subLocalData = new ActionLocalData(new HashMap<>(localData.regNames),
|
||||
new HashMap<>(localData.variables), new HashMap<>(localData.functions));
|
||||
new HashMap<>(localData.variables), new HashMap<>(localData.functions));
|
||||
deobfustaceActionListAtPosRecursive(listeners, output, containers, subLocalData, subStack, cpool, actions, ip + actionLen + aif.getJumpOffset(), ret, startIp, endip, path, visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ import java.util.logging.Logger;
|
||||
public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
|
||||
private final int executionLimit = 30000;
|
||||
|
||||
|
||||
@Override
|
||||
public void actionListParsed(ActionList actions, SWF swf) {
|
||||
combinePushs(actions);
|
||||
@@ -88,15 +88,15 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
removeZeroJumps(actions);
|
||||
rereadActionList(actions, swf); // this call will fix the contant pool assigments
|
||||
}
|
||||
|
||||
|
||||
private void combinePushs(ActionList actions) {
|
||||
for (int i = 0; i < actions.size() - 1; i++) {
|
||||
Action action = actions.get(i);
|
||||
Action action2 = actions.get(i + 1);
|
||||
Action action = actions.get(i);
|
||||
Action action2 = actions.get(i + 1);
|
||||
if (action instanceof ActionPush && action2 instanceof ActionPush) {
|
||||
if (!actions.getReferencesFor(action2).hasNext()) {
|
||||
ActionPush push = (ActionPush) action;
|
||||
ActionPush push2 = (ActionPush) action2;
|
||||
ActionPush push = (ActionPush) action;
|
||||
ActionPush push2 = (ActionPush) action2;
|
||||
push.values.addAll(push2.values);
|
||||
actions.remove(i + 1);
|
||||
i--;
|
||||
@@ -104,7 +104,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean rereadActionList(ActionList actions, SWF swf) {
|
||||
byte[] actionBytes = Action.actionsToBytes(actions, true, SWF.DEFAULT_VERSION);
|
||||
try {
|
||||
@@ -116,7 +116,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private boolean removeUnreachableActions(ActionList actions) {
|
||||
Set<Action> reachableActions = new HashSet<>();
|
||||
Set<Action> processedActions = new HashSet<>();
|
||||
@@ -174,7 +174,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean result = false;
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
if (!reachableActions.contains(actions.get(i))) {
|
||||
@@ -183,10 +183,10 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private boolean removeZeroJumps(ActionList actions) {
|
||||
boolean result = false;
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
@@ -199,12 +199,12 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean removeObfuscationIfs(ActionList actions, Map<String,Object> fakeFunctions) {
|
||||
|
||||
private boolean removeObfuscationIfs(ActionList actions, Map<String, Object> fakeFunctions) {
|
||||
if (actions.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
ExecutionResult result = new ExecutionResult();
|
||||
executeActions(actions, i, actions.size() - 1, result, fakeFunctions);
|
||||
@@ -271,11 +271,11 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void executeActions(ActionList actions, int idx, int endIdx, ExecutionResult result, Map<String,Object> fakeFunctions) {
|
||||
private void executeActions(ActionList actions, int idx, int endIdx, ExecutionResult result, Map<String, Object> fakeFunctions) {
|
||||
List<GraphTargetItem> output = new ArrayList<>();
|
||||
ActionLocalData localData = new ActionLocalData();
|
||||
FixItemCounterTranslateStack stack = new FixItemCounterTranslateStack();
|
||||
@@ -296,11 +296,10 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
|
||||
/*System.out.print(action.getASMSource(actions, new ArrayList<Long>(), ScriptExportMode.PCODE));
|
||||
for (int j = 0; j < stack.size(); j++) {
|
||||
System.out.print(" '" + stack.get(j).getResult() + "'");
|
||||
}
|
||||
System.out.println();*/
|
||||
|
||||
for (int j = 0; j < stack.size(); j++) {
|
||||
System.out.print(" '" + stack.get(j).getResult() + "'");
|
||||
}
|
||||
System.out.println();*/
|
||||
if (action instanceof ActionConstantPool) {
|
||||
constantPool = (ActionConstantPool) action;
|
||||
}
|
||||
@@ -319,7 +318,7 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
}
|
||||
|
||||
if (action instanceof ActionCallFunction){
|
||||
if (action instanceof ActionCallFunction) {
|
||||
String functionName = stack.pop().getResult().toString();
|
||||
long numArgs = EcmaScript.toUint32(stack.pop().getResult());
|
||||
if (numArgs == 0) {
|
||||
@@ -335,35 +334,35 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
action.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
|
||||
}
|
||||
|
||||
if (!(action instanceof ActionPush ||
|
||||
action instanceof ActionPushDuplicate ||
|
||||
action instanceof ActionAdd ||
|
||||
action instanceof ActionAdd2 ||
|
||||
action instanceof ActionSubtract ||
|
||||
action instanceof ActionModulo ||
|
||||
action instanceof ActionMultiply ||
|
||||
action instanceof ActionBitXor ||
|
||||
action instanceof ActionBitAnd ||
|
||||
action instanceof ActionBitOr ||
|
||||
action instanceof ActionBitLShift ||
|
||||
action instanceof ActionBitRShift ||
|
||||
action instanceof ActionDefineLocal ||
|
||||
action instanceof ActionJump ||
|
||||
action instanceof ActionGetVariable ||
|
||||
action instanceof ActionSetVariable ||
|
||||
action instanceof ActionEquals ||
|
||||
action instanceof ActionNot ||
|
||||
action instanceof ActionIf ||
|
||||
action instanceof ActionConstantPool ||
|
||||
action instanceof ActionCallFunction ||
|
||||
action instanceof ActionReturn ||
|
||||
action instanceof ActionEnd)) {
|
||||
if (!(action instanceof ActionPush
|
||||
|| action instanceof ActionPushDuplicate
|
||||
|| action instanceof ActionAdd
|
||||
|| action instanceof ActionAdd2
|
||||
|| action instanceof ActionSubtract
|
||||
|| action instanceof ActionModulo
|
||||
|| action instanceof ActionMultiply
|
||||
|| action instanceof ActionBitXor
|
||||
|| action instanceof ActionBitAnd
|
||||
|| action instanceof ActionBitOr
|
||||
|| action instanceof ActionBitLShift
|
||||
|| action instanceof ActionBitRShift
|
||||
|| action instanceof ActionDefineLocal
|
||||
|| action instanceof ActionJump
|
||||
|| action instanceof ActionGetVariable
|
||||
|| action instanceof ActionSetVariable
|
||||
|| action instanceof ActionEquals
|
||||
|| action instanceof ActionNot
|
||||
|| action instanceof ActionIf
|
||||
|| action instanceof ActionConstantPool
|
||||
|| action instanceof ActionCallFunction
|
||||
|| action instanceof ActionReturn
|
||||
|| action instanceof ActionEnd)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (action instanceof ActionPush) {
|
||||
ActionPush push = (ActionPush) action;
|
||||
boolean ok = true;
|
||||
boolean ok = true;
|
||||
for (Object value : push.values) {
|
||||
if (value instanceof ConstantIndex || value instanceof RegisterNumber) {
|
||||
ok = false;
|
||||
@@ -376,9 +375,8 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
|
||||
/*for (String variable : localData.variables.keySet()) {
|
||||
System.out.println(Helper.byteArrToString(variable.getBytes()));
|
||||
}*/
|
||||
|
||||
System.out.println(Helper.byteArrToString(variable.getBytes()));
|
||||
}*/
|
||||
idx++;
|
||||
|
||||
if (action instanceof ActionJump) {
|
||||
@@ -422,8 +420,8 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
|
||||
if (action instanceof ActionReturn) {
|
||||
if (output.size() > 0) {
|
||||
ReturnActionItem ret = (ReturnActionItem) output.get(output.size() - 1);
|
||||
if (output.size() > 0) {
|
||||
ReturnActionItem ret = (ReturnActionItem) output.get(output.size() - 1);
|
||||
result.resultValue = ret.value.getResult();
|
||||
}
|
||||
break;
|
||||
@@ -432,22 +430,22 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
} catch (EmptyStackException | TranslateException | InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> getFakeFunctionResults(ActionList actions) {
|
||||
/*
|
||||
DefineFunction "fakeName" 0 {
|
||||
Push 1777
|
||||
Return
|
||||
}
|
||||
*/
|
||||
|
||||
DefineFunction "fakeName" 0 {
|
||||
Push 1777
|
||||
Return
|
||||
}
|
||||
*/
|
||||
|
||||
Map<String, Object> results = new HashMap<>();
|
||||
|
||||
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
Action action = actions.get(i);
|
||||
Action action = actions.get(i);
|
||||
if (action instanceof ActionDefineFunction) {
|
||||
ActionDefineFunction def = (ActionDefineFunction) action;
|
||||
if(def.paramNames.isEmpty()) {
|
||||
if (def.paramNames.isEmpty()) {
|
||||
ExecutionResult result = new ExecutionResult();
|
||||
List<Action> lastActions = actions.getContainerLastActions(action);
|
||||
int lastActionIdx = actions.indexOf(lastActions.get(0));
|
||||
@@ -461,11 +459,12 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
class ExecutionResult {
|
||||
|
||||
public int idx = -1;
|
||||
public int instructionsProcessed = -1;
|
||||
public ActionConstantPool constantPool;
|
||||
|
||||
@@ -56,17 +56,17 @@ import java.util.List;
|
||||
public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
|
||||
|
||||
private final int executionLimit = 30000;
|
||||
|
||||
|
||||
@Override
|
||||
public void actionListParsed(ActionList actions, SWF swf) {
|
||||
removeObfuscationIfs(actions);
|
||||
}
|
||||
|
||||
|
||||
private boolean removeObfuscationIfs(ActionList actions) {
|
||||
if (actions.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
ExecutionResult result = new ExecutionResult();
|
||||
executeActions(actions, i, actions.size() - 1, result);
|
||||
@@ -100,7 +100,7 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -124,34 +124,33 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
|
||||
}
|
||||
|
||||
/*System.out.print(action.getASMSource(actions, new ArrayList<Long>(), ScriptExportMode.PCODE));
|
||||
for (int j = 0; j < stack.size(); j++) {
|
||||
System.out.print(" '" + stack.get(j).getResult() + "'");
|
||||
}
|
||||
System.out.println();*/
|
||||
|
||||
for (int j = 0; j < stack.size(); j++) {
|
||||
System.out.print(" '" + stack.get(j).getResult() + "'");
|
||||
}
|
||||
System.out.println();*/
|
||||
action.translate(localData, stack, output, Graph.SOP_USE_STATIC, "");
|
||||
|
||||
if (!(action instanceof ActionPush ||
|
||||
action instanceof ActionPushDuplicate ||
|
||||
action instanceof ActionAdd ||
|
||||
action instanceof ActionAdd2 ||
|
||||
action instanceof ActionSubtract ||
|
||||
action instanceof ActionModulo ||
|
||||
action instanceof ActionMultiply ||
|
||||
action instanceof ActionBitXor ||
|
||||
action instanceof ActionBitAnd ||
|
||||
action instanceof ActionBitOr ||
|
||||
action instanceof ActionBitLShift ||
|
||||
action instanceof ActionBitRShift ||
|
||||
action instanceof ActionEquals ||
|
||||
action instanceof ActionNot ||
|
||||
action instanceof ActionIf)) {
|
||||
if (!(action instanceof ActionPush
|
||||
|| action instanceof ActionPushDuplicate
|
||||
|| action instanceof ActionAdd
|
||||
|| action instanceof ActionAdd2
|
||||
|| action instanceof ActionSubtract
|
||||
|| action instanceof ActionModulo
|
||||
|| action instanceof ActionMultiply
|
||||
|| action instanceof ActionBitXor
|
||||
|| action instanceof ActionBitAnd
|
||||
|| action instanceof ActionBitOr
|
||||
|| action instanceof ActionBitLShift
|
||||
|| action instanceof ActionBitRShift
|
||||
|| action instanceof ActionEquals
|
||||
|| action instanceof ActionNot
|
||||
|| action instanceof ActionIf)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (action instanceof ActionPush) {
|
||||
ActionPush push = (ActionPush) action;
|
||||
boolean ok = true;
|
||||
boolean ok = true;
|
||||
for (Object value : push.values) {
|
||||
if (value instanceof ConstantIndex || value instanceof RegisterNumber) {
|
||||
ok = false;
|
||||
@@ -187,8 +186,9 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
|
||||
} catch (EmptyStackException | TranslateException | InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ExecutionResult {
|
||||
|
||||
public int idx = -1;
|
||||
public int instructionsProcessed = -1;
|
||||
public TranslateStack stack = new TranslateStack();
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ import com.jpexs.decompiler.graph.TranslateStack;
|
||||
public class FixItemCounterTranslateStack extends TranslateStack {
|
||||
|
||||
private int fixItemCount = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
@Override
|
||||
public GraphTargetItem pop() {
|
||||
GraphTargetItem result = super.pop();
|
||||
@@ -44,11 +44,11 @@ public class FixItemCounterTranslateStack extends TranslateStack {
|
||||
}
|
||||
return super.remove(index);
|
||||
}
|
||||
|
||||
|
||||
public boolean allItemsFixed() {
|
||||
return size() <= fixItemCount;
|
||||
}
|
||||
|
||||
|
||||
public int getFixItemCount() {
|
||||
return fixItemCount;
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ public class ASMParser {
|
||||
} else {
|
||||
throw new ParseException("Unknown instruction name :" + instructionName, lexer.yyline());
|
||||
}
|
||||
|
||||
|
||||
a.updateLength(version);
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ public class ActionSourceGenerator implements SourceGenerator {
|
||||
fixLoop(forBody, forBodyLen + forFinalLen + forajmpLen, forBodyLen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private long uniqLast = 0;
|
||||
|
||||
public String uniqId() {
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.io.IOException;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionDeobfuscateJump extends ActionJump {
|
||||
|
||||
|
||||
public ActionDeobfuscateJump(int offset) {
|
||||
super(2);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ActionWaitForFrame extends Action implements ActionStore {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, version);
|
||||
try {
|
||||
sos.writeUI16(frame);
|
||||
sos.writeUI16(frame);
|
||||
sos.writeUI8(skipCount);
|
||||
sos.close();
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ActionPush extends Action {
|
||||
values = new ArrayList<>();
|
||||
DumpInfo di = sis.dumpInfo;
|
||||
sis = sis.getLimitedStream(actionLength);
|
||||
sis.dumpInfo = di;
|
||||
sis.dumpInfo = di;
|
||||
try {
|
||||
while (sis.available() > 0) {
|
||||
type = sis.readUI8("type");
|
||||
|
||||
@@ -887,7 +887,7 @@ public class Main {
|
||||
View.showMessageDialog(null, "Failed to load plugin: " + pluginPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AppStrings.setResourceClass(MainFrame.class);
|
||||
initLogging(Configuration.debugMode.get());
|
||||
initLang();
|
||||
|
||||
@@ -203,7 +203,6 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
|
||||
//miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
|
||||
//miAutoDeobfuscation.addActionListener(this);
|
||||
//miAutoDeobfuscation.setActionCommand(ACTION_AUTO_DEOBFUSCATE);
|
||||
|
||||
JMenuItem miRenameOneIdentifier = new JMenuItem(translate("menu.tools.deobfuscation.globalrename"));
|
||||
miRenameOneIdentifier.setActionCommand(ACTION_RENAME_ONE_IDENTIFIER);
|
||||
miRenameOneIdentifier.addActionListener(this);
|
||||
@@ -443,13 +442,13 @@ public class MainFrameClassicMenu implements MainFrameMenu, ActionListener {
|
||||
mainFrame.panel.searchAs();
|
||||
break;
|
||||
/*case ACTION_AUTO_DEOBFUSCATE:
|
||||
if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected());
|
||||
mainFrame.panel.autoDeobfuscateChanged();
|
||||
} else {
|
||||
miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected());
|
||||
}
|
||||
break;*/
|
||||
if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected());
|
||||
mainFrame.panel.autoDeobfuscateChanged();
|
||||
} else {
|
||||
miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected());
|
||||
}
|
||||
break;*/
|
||||
case ACTION_EXIT:
|
||||
mainFrame.panel.setVisible(false);
|
||||
if (Main.proxyFrame != null) {
|
||||
|
||||
@@ -430,7 +430,6 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
//miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
|
||||
//miAutoDeobfuscation.addActionListener(this);
|
||||
//miAutoDeobfuscation.setActionCommand(ACTION_AUTO_DEOBFUSCATE);
|
||||
|
||||
miInternalViewer = new JCheckBox(translate("menu.settings.internalflashviewer"));
|
||||
miInternalViewer.setSelected(Configuration.internalFlashViewer.get() || externalFlashPlayerUnavailable);
|
||||
if (externalFlashPlayerUnavailable) {
|
||||
@@ -718,13 +717,13 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
mainFrame.panel.timeline();
|
||||
break;
|
||||
/*case ACTION_AUTO_DEOBFUSCATE:
|
||||
if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected());
|
||||
mainFrame.panel.autoDeobfuscateChanged();
|
||||
} else {
|
||||
miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected());
|
||||
}
|
||||
break;*/
|
||||
if (View.showConfirmDialog(mainFrame.panel, translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected());
|
||||
mainFrame.panel.autoDeobfuscateChanged();
|
||||
} else {
|
||||
miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected());
|
||||
}
|
||||
break;*/
|
||||
case ACTION_CLEAR_RECENT_FILES:
|
||||
Configuration.recentFiles.set(null);
|
||||
break;
|
||||
|
||||
@@ -980,7 +980,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
allSwfs.add(swf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int j = 0; j < allSwfs.size(); j++) {
|
||||
List<ScriptPack> as3scripts = new ArrayList<>();
|
||||
List<Tag> images = new ArrayList<>();
|
||||
@@ -1000,7 +1000,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
if (!allSwfs.contains(selectedNodeSwf)) {
|
||||
allSwfs.add(selectedNodeSwf);
|
||||
}
|
||||
|
||||
|
||||
if (selectedNodeSwf != swf) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class DumpTreeModel implements TreeModel {
|
||||
|
||||
@Override
|
||||
public int getChildCount(Object o) {
|
||||
DumpInfo di = (DumpInfo) o;
|
||||
DumpInfo di = (DumpInfo) o;
|
||||
if (di.tagToResolve != null) {
|
||||
TagStub tagStub = di.tagToResolve;
|
||||
try {
|
||||
|
||||
@@ -29,5 +29,5 @@ public class EmptySWFDecompilerListener implements SWFDecompilerListener {
|
||||
public void actionListParsed(ActionList actions, SWF swf) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ import com.jpexs.decompiler.flash.action.ActionList;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface SWFDecompilerListener {
|
||||
|
||||
|
||||
void actionListParsed(ActionList actions, SWF swf);
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ import javax.tools.ToolProvider;
|
||||
public class SWFDecompilerPlugin {
|
||||
|
||||
public static SWFDecompilerListener listener;
|
||||
|
||||
|
||||
public static void loadPlugin(String path) {
|
||||
|
||||
|
||||
// Here we specify the source code of the class to be compiled
|
||||
String src = Helper.readTextFile(path);
|
||||
|
||||
|
||||
// Full name of the class that will be compiled.
|
||||
// If class should be in some package,
|
||||
// fullName should contain it too
|
||||
@@ -53,8 +53,7 @@ public class SWFDecompilerPlugin {
|
||||
// we create a file manager
|
||||
// (our custom implementation of it)
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
JavaFileManager fileManager = new
|
||||
ClassFileManager(compiler.getStandardFileManager(null, null, null));
|
||||
JavaFileManager fileManager = new ClassFileManager(compiler.getStandardFileManager(null, null, null));
|
||||
|
||||
// Dynamic compiling requires specifying
|
||||
// a list of "files" to compile. In our case
|
||||
|
||||
@@ -338,7 +338,7 @@ public class DefineTextTag extends TextTag {
|
||||
if (txt == null || (font == null && txt.isEmpty())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (font == null) {
|
||||
throw new ParseException("Font not defined", lexer.yyline());
|
||||
}
|
||||
|
||||
@@ -401,6 +401,7 @@ public final class TextLexer {
|
||||
|
||||
/**
|
||||
* Closes the input stream.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public final void yyclose() throws java.io.IOException {
|
||||
@@ -436,7 +437,8 @@ public final class TextLexer {
|
||||
|
||||
/**
|
||||
* Returns the current lexical state.
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public final int yystate() {
|
||||
return zzLexicalState;
|
||||
@@ -453,7 +455,8 @@ public final class TextLexer {
|
||||
|
||||
/**
|
||||
* Returns the text matched by the current regular expression.
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public final String yytext() {
|
||||
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
|
||||
@@ -475,7 +478,8 @@ public final class TextLexer {
|
||||
|
||||
/**
|
||||
* Returns the length of the matched text region.
|
||||
* @return
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public final int yylength() {
|
||||
return zzMarkedPos - zzStartRead;
|
||||
|
||||
@@ -1555,7 +1555,7 @@ public class Graph {
|
||||
|
||||
List<GraphPart> nps;
|
||||
/*nps = new ArrayList<>(part.nextParts);
|
||||
for(int i=0;i<nps.size();i++){
|
||||
for(int i=0;i<nps.size();i++){
|
||||
nps.set(i,getNextNoJump(nps.get(i),localData));
|
||||
}
|
||||
if(nps.get(0) == nps.get(1)){
|
||||
|
||||
Reference in New Issue
Block a user