mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 09:00:35 +00:00
Introduced LATEST_CONSTANTPOOL_HACK constant for handling AS1/2 files with multiple constantpools (obfuscation)
Other small fixes
This commit is contained in:
@@ -79,6 +79,8 @@ public class Main {
|
||||
public static final boolean RESOLVE_CONSTANTS = true;
|
||||
/** Turn off decompiling if needed */
|
||||
public static final boolean DO_DECOMPILE=true;
|
||||
/** Find latest constant pool in the code */
|
||||
public static final boolean LATEST_CONSTANTPOOL_HACK=false;
|
||||
/** Dump tags to stdout */
|
||||
public static boolean dump_tags = false;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
package com.jpexs.asdec.action;
|
||||
|
||||
import com.jpexs.asdec.Main;
|
||||
import com.jpexs.asdec.SWFOutputStream;
|
||||
import com.jpexs.asdec.action.parser.FlasmLexer;
|
||||
import com.jpexs.asdec.action.parser.ParseException;
|
||||
@@ -359,11 +360,22 @@ public class Action {
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
for (Action a : list) {
|
||||
if (a instanceof ActionConstantPool) {
|
||||
if(Main.LATEST_CONSTANTPOOL_HACK){
|
||||
for (Action a : list) {
|
||||
if (a instanceof ActionConstantPool) {
|
||||
constantPool.clear();
|
||||
constantPool.addAll(((ActionConstantPool) a).constantPool);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Action a : list) {
|
||||
if(!Main.LATEST_CONSTANTPOOL_HACK)
|
||||
{
|
||||
if (a instanceof ActionConstantPool) {
|
||||
constantPool.clear();
|
||||
constantPool.addAll(((ActionConstantPool) a).constantPool);
|
||||
}
|
||||
}
|
||||
if (a instanceof ActionPush) {
|
||||
((ActionPush) a).constantPool = constantPool;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ public abstract class TreeItem {
|
||||
return (String)((DirectValueTreeItem)target).value;
|
||||
}
|
||||
}
|
||||
return target.toString();
|
||||
if(target==null){
|
||||
return "";
|
||||
}else{
|
||||
return target.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,6 +239,7 @@ public class ProxyFrame extends JFrame implements ActionListener, CatchedListene
|
||||
java.util.List<String> catchedContentTypes = new ArrayList<String>();
|
||||
catchedContentTypes.add("application/x-shockwave-flash");
|
||||
catchedContentTypes.add("application/x-javascript");
|
||||
catchedContentTypes.add("application/javascript");
|
||||
catchedContentTypes.add("text/javascript");
|
||||
catchedContentTypes.add("application/json");
|
||||
catchedContentTypes.add("text/xml");
|
||||
@@ -311,9 +312,10 @@ public class ProxyFrame extends JFrame implements ActionListener, CatchedListene
|
||||
* @param data Data stream
|
||||
*/
|
||||
public void catched(String contentType, String url, InputStream data) {
|
||||
boolean swfOnly=false;
|
||||
if (contentType.contains(";")) contentType = contentType.substring(0, contentType.indexOf(";"));
|
||||
if ((!sniffSWFCheckBox.isSelected()) && (contentType.equals("application/x-shockwave-flash"))) return;
|
||||
if ((!sniffJSCheckBox.isSelected()) && (contentType.equals("application/x-javascript") || contentType.equals("text/javascript")|| contentType.equals("application/json")))
|
||||
if ((!sniffJSCheckBox.isSelected()) && (contentType.equals("application/javascript") || contentType.equals("application/x-javascript") || contentType.equals("text/javascript")|| contentType.equals("application/json")))
|
||||
return;
|
||||
if ((!sniffXMLCheckBox.isSelected()) && (contentType.equals("application/xml") || contentType.equals("text/xml")))
|
||||
return;
|
||||
@@ -324,9 +326,10 @@ public class ProxyFrame extends JFrame implements ActionListener, CatchedListene
|
||||
byte hdr[]=new byte[3];
|
||||
data.read(hdr);
|
||||
String shdr=new String(hdr);
|
||||
if((!shdr.equals("FWS")) && (!shdr.equals("CWS"))){
|
||||
if((swfOnly) &&((!shdr.equals("FWS")) && (!shdr.equals("CWS")))){
|
||||
return; //NOT SWF
|
||||
}
|
||||
|
||||
File f = new File(Main.tempFile(url));
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
fos.write(hdr);
|
||||
|
||||
Reference in New Issue
Block a user