Decompiler Cleanup

This commit is contained in:
Konloch 2021-07-03 23:18:06 -07:00
parent 08304d3db1
commit 7b26b62084
13 changed files with 67 additions and 25 deletions

View File

@ -1,7 +1,7 @@
package the.bytecode.club.bytecodeviewer.decompilers;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.decompilers.bytecode.ClassNodeDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.impl.*;
import the.bytecode.club.bytecodeviewer.gui.components.DecompilerViewComponent;
import javax.swing.*;
@ -35,7 +35,7 @@ public enum Decompiler
PROCYON_DECOMPILER("Procyon Decompiler", new ProcyonDecompiler(), new DecompilerViewComponent("Procyon")),
CFR_DECOMPILER("CFR Decompiler", new CFRDecompiler(), new DecompilerViewComponent("Procyon")),
FERNFLOWER_DECOMPILER("FernFlower Decompiler", new FernFlowerDecompiler(), new DecompilerViewComponent("Procyon")),
BYTECODE_DISASSEMBLER("Bytecode Disassembler", new ClassNodeDecompiler(), new JRadioButtonMenuItem("Bytecode")),
BYTECODE_DISASSEMBLER("Bytecode Disassembler", new BytecodeDisassembler(), new JRadioButtonMenuItem("Bytecode")),
HEXCODE_VIEWER("Hexcode Viewer", null, new JRadioButtonMenuItem("Hexcode")),
SMALI_DISASSEMBLER("Smali Decompiler", new SmaliDisassembler(), new DecompilerViewComponent("Smali")),
KRAKATAU_DECOMPILER("Krakatau Decompiler", new KrakatauDecompiler(), BytecodeViewer.krakatau),

View File

@ -36,16 +36,9 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
* @author Bibl
*/
public class ClassNodeDecompiler extends InternalDecompiler
public class ClassNodeDecompiler
{
@Override
public String decompileClassNode(ClassNode cn, byte[] b) {
return decompile(new PrefixedStringBuilder(),
new ArrayList<>(), cn).toString();
}
protected static PrefixedStringBuilder decompile(
public static PrefixedStringBuilder decompile(
PrefixedStringBuilder sb, ArrayList<String> decompiledClasses,
ClassNode cn) {
ArrayList<String> unableToDecompile = new ArrayList<>();
@ -181,8 +174,4 @@ public class ClassNodeDecompiler extends InternalDecompiler
}
return sb.toString();
}
@Override
public void decompileToZip(String sourceJar, String zipName) {
}
}

View File

@ -1,10 +1,11 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.util.Textifier;
import org.objectweb.asm.util.TraceClassVisitor;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *

View File

@ -0,0 +1,43 @@
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.bytecode.ClassNodeDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.bytecode.PrefixedStringBuilder;
import java.util.ArrayList;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
/**
* @author Konloch
* @since 7/3/2021
*/
public class BytecodeDisassembler extends InternalDecompiler
{
@Override
public String decompileClassNode(ClassNode cn, byte[] b) {
return ClassNodeDecompiler.decompile(new PrefixedStringBuilder(),
new ArrayList<>(), cn).toString();
}
@Override
public void decompileToZip(String sourceJar, String zipName) {
}
}

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import java.io.Closeable;
import java.io.File;
@ -18,6 +18,7 @@ import java.util.zip.ZipOutputStream;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import static the.bytecode.club.bytecodeviewer.Constants.*;

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import java.io.File;
import java.io.FileOutputStream;
@ -10,6 +10,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import static the.bytecode.club.bytecodeviewer.Constants.*;

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import jadx.api.JadxArgs;
import jadx.api.JadxDecompiler;
@ -11,6 +11,7 @@ import java.util.Objects;
import java.util.Random;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import static the.bytecode.club.bytecodeviewer.Constants.*;

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import java.io.File;
import java.io.FileOutputStream;
@ -6,6 +6,8 @@ import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.jdgui.DirectoryLoader;
import the.bytecode.club.bytecodeviewer.decompilers.jdgui.CommonPreferences;
import the.bytecode.club.bytecodeviewer.decompilers.jdgui.PlainTextPrinter;

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import java.io.BufferedReader;
import java.io.File;
@ -13,6 +13,7 @@ import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import the.bytecode.club.bytecodeviewer.util.ZipUtils;

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import java.io.BufferedReader;
import java.io.File;
@ -11,6 +11,7 @@ import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import the.bytecode.club.bytecodeviewer.util.ZipUtils;

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import com.strobel.assembler.InputTypeLoader;
import com.strobel.assembler.metadata.Buffer;
@ -32,6 +32,7 @@ import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.decompilers;
package the.bytecode.club.bytecodeviewer.decompilers.impl;
import java.io.File;
import java.io.FileOutputStream;
@ -9,6 +9,7 @@ import java.util.Objects;
import me.konloch.kontainer.io.DiskReader;
import org.apache.commons.io.FileUtils;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.Dex2Jar;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;

View File

@ -51,7 +51,7 @@ public class ResourceViewPanel
if(viewer.cn == null)
{
panel.add(new JLabel("This file has been removed from the reload."));
panel.add(new JLabel("This resource has been removed."));
}
}