Remove ASM 7.1 and replace with ASM 9.1

Fixes issue #295
This commit is contained in:
Konloch 2021-06-21 12:39:46 -07:00
parent 47a0d1415e
commit b4d4de7d15
7 changed files with 59 additions and 51 deletions

View file

@ -8,7 +8,6 @@ Bytecode Viewer - a lightweight user friendly Java Bytecode Viewer.
* Added support to Java files compiled using JDK > 13 * Added support to Java files compiled using JDK > 13
* Migrated to Maven * Migrated to Maven
#### Links #### Links
* Website: https://bytecodeviewer.com * Website: https://bytecodeviewer.com
* Source Code: https://github.com/konloch/bytecode-viewer * Source Code: https://github.com/konloch/bytecode-viewer
@ -70,7 +69,7 @@ Open the Maven project (e.g. in IntelliJ, open the ``pom.xml`` as a project file
## Exporting as jar ## Exporting as jar
Using Intellij create a new artifact jar and build it, if the META-INF is overrwitten replace it with the one in resources. Using Intellij create a new artifact jar and build it, if the META-INF is overrwitten replace it with the one in src/main/resources.
##### Are you a Java Reverse Engineer? Do you want to learn? #### Are you a Java Reverse Engineer? Do you want to learn?
Join The Bytecode Club Today! - https://the.bytecode.club Join The Bytecode Club Today! - https://the.bytecode.club

View file

@ -3,7 +3,7 @@
<groupId>the.bytecode.club</groupId> <groupId>the.bytecode.club</groupId>
<artifactId>bytecodeviewer</artifactId> <artifactId>bytecodeviewer</artifactId>
<version>2.10.10</version> <version>2.10.11</version>
<properties> <properties>
<java.version>8</java.version> <java.version>8</java.version>
@ -132,7 +132,7 @@
<artifactId>jd-gui</artifactId> <artifactId>jd-gui</artifactId>
<version>1.6.6</version> <version>1.6.6</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/libs/jd-gui-1.6.6.jar</systemPath> <systemPath>${project.basedir}/libs/jd-gui-1.6.6-no-asm.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>eu.bibl.banalysis</groupId> <groupId>eu.bibl.banalysis</groupId>

View file

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: the.bytecode.club.bytecodeviewer.BytecodeViewer

View file

@ -630,7 +630,7 @@ public class BytecodeViewer
}); });
viewer.recentFilesSecondaryMenu.add(m); viewer.recentFilesSecondaryMenu.add(m);
} }
viewer.mnRecentPlugins.removeAll(); viewer.recentPluginsSecondaryMenu.removeAll();
for (String s : recentPlugins) for (String s : recentPlugins)
if (!s.isEmpty()) { if (!s.isEmpty()) {
JMenuItem m = new JMenuItem(s); JMenuItem m = new JMenuItem(s);
@ -638,7 +638,7 @@ public class BytecodeViewer
JMenuItem m1 = (JMenuItem) e.getSource(); JMenuItem m1 = (JMenuItem) e.getSource();
startPlugin(new File(m1.getText())); startPlugin(new File(m1.getText()));
}); });
viewer.mnRecentPlugins.add(m); viewer.recentPluginsSecondaryMenu.add(m);
} }
} }

View file

@ -16,7 +16,7 @@ import java.util.List;
public class Constants public class Constants
{ {
/*per version*/ /*per version*/
public static final String VERSION = "2.10.10"; //could be loaded from the pom public static final String VERSION = "2.10.11"; //could be loaded from the pom
public static String krakatauVersion = "12"; public static String krakatauVersion = "12";
public static String enjarifyVersion = "4"; public static String enjarifyVersion = "4";
public static final boolean BLOCK_TAB_MENU = true; public static final boolean BLOCK_TAB_MENU = true;

View file

@ -6,7 +6,6 @@ import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.KeyEventDispatcher; import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager; import java.awt.KeyboardFocusManager;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
@ -85,7 +84,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
//all of the files main menu components //all of the files main menu components
public final JMenu fileMainMenu = new JMenu("File"); public final JMenu fileMainMenu = new JMenu("File");
public final JMenuItem newWorkSpace = new JMenuItem("New Workspace"); public final JMenuItem newWorkSpace = new JMenuItem("New Workspace");
public final JMenuItem addResource = new JMenuItem("Add.."); public final JMenuItem addResource = new JMenuItem("Add...");
public final JMenuItem reloadResources = new JMenuItem("Reload Resources"); public final JMenuItem reloadResources = new JMenuItem("Reload Resources");
public final JMenuItem runButton = new JMenuItem("Run"); public final JMenuItem runButton = new JMenuItem("Run");
public final JMenuItem compileButton = new JMenuItem("Compile"); public final JMenuItem compileButton = new JMenuItem("Compile");
@ -105,6 +104,22 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final ViewPane viewPane2 = new ViewPane(2); public final ViewPane viewPane2 = new ViewPane(2);
public final ViewPane viewPane3 = new ViewPane(3); public final ViewPane viewPane3 = new ViewPane(3);
//TODO settings main menu components
//all of the plugins main menu components
public final JMenu pluginsMainMenu = new JMenu("Plugins");
public final JMenuItem openExternalPlugin = new JMenuItem("Open Plugin...");
public final JMenu recentPluginsSecondaryMenu = new JMenu("Recent Plugins");
public final JMenuItem ZKMStringDecrypter = new JMenuItem("ZKM String Decrypter");
public final JMenuItem allatoriStringDecrypter = new JMenuItem("Allatori String Decrypter");
public final JMenuItem codeSequenceDiagram = new JMenuItem("Code Sequence Diagram");
public final JMenuItem maliciousCodeScanner = new JMenuItem("Malicious Code Scanner");
public final JMenuItem showAllStrings = new JMenuItem("Show All Strings");
public final JMenuItem showMainMethods = new JMenuItem("Show Main Methods");
public final JMenuItem replaceStrings = new JMenuItem("Replace Strings");
public final JMenuItem stackFramesRemover = new JMenuItem("StackFrames Remover");
public final JMenuItem zStringArrayDecrypter = new JMenuItem("ZStringArray Decrypter");
public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem("Debug Helpers"); public JCheckBoxMenuItem debugHelpers = new JCheckBoxMenuItem("Debug Helpers");
public JSplitPane sp1; public JSplitPane sp1;
public JSplitPane sp2; public JSplitPane sp2;
@ -127,16 +142,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public JCheckBoxMenuItem fdi = new JCheckBoxMenuItem("Deinline finally structures"); public JCheckBoxMenuItem fdi = new JCheckBoxMenuItem("Deinline finally structures");
public JCheckBoxMenuItem asc = new JCheckBoxMenuItem("Allow only ASCII characters in strings"); public JCheckBoxMenuItem asc = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
public JCheckBoxMenuItem ren = new JCheckBoxMenuItem("Rename ambiguous classes and class elements"); public JCheckBoxMenuItem ren = new JCheckBoxMenuItem("Rename ambiguous classes and class elements");
public final JMenu mnNewMenu_1 = new JMenu("Plugins");
public final JMenuItem mntmStartExternalPlugin = new JMenuItem("Open Plugin..");
public JMenu mnRecentPlugins = new JMenu("Recent Plugins");
public final JMenuItem mntmStartZkmString = new JMenuItem("ZKM String Decrypter");
public final JMenuItem mntmNewMenuItem_1 = new JMenuItem("Malicious Code Scanner");
public final JMenuItem mntmNewMenuItem_2 = new JMenuItem("Allatori String Decrypter");
public final JMenuItem mntmShowAllStrings = new JMenuItem("Show All Strings");
public final JMenuItem mntmShowMainMethods = new JMenuItem("Show Main Methods");
public final JMenuItem mntmReplaceStrings = new JMenuItem("Replace Strings");
public final JMenuItem mntmStackFramesRemover = new JMenuItem("StackFrames Remover");
public final JMenuItem[] waitIcons; public final JMenuItem[] waitIcons;
public final JMenu mnNewMenu_3 = new JMenu("CFR"); public final JMenu mnNewMenu_3 = new JMenu("CFR");
public final JMenu mnNewMenu_4 = new JMenu("Procyon"); public final JMenu mnNewMenu_4 = new JMenu("Procyon");
@ -213,14 +219,12 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final JMenu mnSettings = new JMenu("Settings"); public final JMenu mnSettings = new JMenu("Settings");
public AboutWindow aboutWindow = new AboutWindow(); public AboutWindow aboutWindow = new AboutWindow();
public final JMenuItem mntmCodeSequenceDiagram = new JMenuItem("Code Sequence Diagram");
public final JCheckBoxMenuItem compileOnSave = new JCheckBoxMenuItem("Compile On Save"); public final JCheckBoxMenuItem compileOnSave = new JCheckBoxMenuItem("Compile On Save");
public final JCheckBoxMenuItem showFileInTabTitle = new JCheckBoxMenuItem("Show File In Tab Title"); public final JCheckBoxMenuItem showFileInTabTitle = new JCheckBoxMenuItem("Show File In Tab Title");
public final JCheckBoxMenuItem forcePureAsciiAsText = new JCheckBoxMenuItem("Force Pure Ascii As Text"); public final JCheckBoxMenuItem forcePureAsciiAsText = new JCheckBoxMenuItem("Force Pure Ascii As Text");
public final JCheckBoxMenuItem autoCompileOnRefresh = new JCheckBoxMenuItem("Compile On Refresh"); public final JCheckBoxMenuItem autoCompileOnRefresh = new JCheckBoxMenuItem("Compile On Refresh");
public final JMenuItem mntmSetPythonDirectory = new JMenuItem("Set Python 2.7 Executable"); public final JMenuItem mntmSetPythonDirectory = new JMenuItem("Set Python 2.7 Executable");
public final JMenuItem mntmSetJreRt = new JMenuItem("Set JRE RT Library"); public final JMenuItem mntmSetJreRt = new JMenuItem("Set JRE RT Library");
public final JMenuItem mntmZstringarrayDecrypter = new JMenuItem("ZStringArray Decrypter");
public final JCheckBoxMenuItem decodeAPKResources = new JCheckBoxMenuItem("Decode APK Resources"); public final JCheckBoxMenuItem decodeAPKResources = new JCheckBoxMenuItem("Decode APK Resources");
public final JCheckBoxMenuItem synchronizedViewing = new JCheckBoxMenuItem("Synchronized Viewing"); public final JCheckBoxMenuItem synchronizedViewing = new JCheckBoxMenuItem("Synchronized Viewing");
public final JCheckBoxMenuItem showClassMethods = new JCheckBoxMenuItem("Show Class Methods"); public final JCheckBoxMenuItem showClassMethods = new JCheckBoxMenuItem("Show Class Methods");
@ -356,6 +360,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
buildMenuBar(); buildMenuBar();
buildFileMenuBar(); buildFileMenuBar();
buildViewMenuBar(); buildViewMenuBar();
buildPluginMenuBar();
compileOnSave.setSelected(false); compileOnSave.setSelected(false);
@ -694,24 +699,15 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
mntmNewMenuItem_10.setEnabled(false); mntmNewMenuItem_10.setEnabled(false);
mnNewMenu_5.add(mntmNewMenuItem_10); mnNewMenu_5.add(mntmNewMenuItem_10);
rootMenu.add(mnNewMenu_1);
mnNewMenu_1.add(mntmStartExternalPlugin); codeSequenceDiagram.addActionListener(arg0 -> {
mnNewMenu_1.add(new JSeparator());
mnNewMenu_1.add(mnRecentPlugins);
mnNewMenu_1.add(new JSeparator());
mntmCodeSequenceDiagram.addActionListener(arg0 -> {
if (BytecodeViewer.getLoadedClasses().isEmpty()) { if (BytecodeViewer.getLoadedClasses().isEmpty()) {
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
return; return;
} }
PluginManager.runPlugin(new CodeSequenceDiagram()); PluginManager.runPlugin(new CodeSequenceDiagram());
}); });
replaceStrings.addActionListener(arg0 -> {
mnNewMenu_1.add(mntmCodeSequenceDiagram);
mnNewMenu_1.add(mntmNewMenuItem_1);
mnNewMenu_1.add(mntmShowMainMethods);
mnNewMenu_1.add(mntmShowAllStrings);
mntmReplaceStrings.addActionListener(arg0 -> {
if (BytecodeViewer.getLoadedClasses().isEmpty()) { if (BytecodeViewer.getLoadedClasses().isEmpty()) {
BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file."); BytecodeViewer.showMessage("First open a class, jar, zip, apk or dex file.");
return; return;
@ -719,17 +715,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
new ReplaceStringsOptions().setVisible(true); new ReplaceStringsOptions().setVisible(true);
}); });
mnNewMenu_1.add(mntmReplaceStrings); zStringArrayDecrypter.addActionListener(arg0 -> PluginManager.runPlugin(new ZStringArrayDecrypter()));
stackFramesRemover.addActionListener(e -> PluginManager.runPlugin(new StackFramesRemover()));
//allatori and ZKM are disabled since they are just placeholders
//mnNewMenu_1.add(mntmNewMenuItem_2);
//mnNewMenu_1.add(mntmStartZkmString);
mntmZstringarrayDecrypter.addActionListener(arg0 -> PluginManager.runPlugin(new ZStringArrayDecrypter()));
mntmStackFramesRemover.addActionListener(e -> PluginManager.runPlugin(new StackFramesRemover()));
mnNewMenu_1.add(mntmZstringarrayDecrypter);
mnNewMenu_1.add(mntmStackFramesRemover);
waitIcons = new JMenuItem[10]; waitIcons = new JMenuItem[10];
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -739,7 +726,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
rootMenu.add(waitIcons[i]); rootMenu.add(waitIcons[i]);
} }
mntmStartExternalPlugin.addActionListener(arg0 -> { openExternalPlugin.addActionListener(arg0 -> {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setFileFilter(PluginManager.fileFilter()); fc.setFileFilter(PluginManager.fileFilter());
fc.setFileHidingEnabled(false); fc.setFileHidingEnabled(false);
@ -756,11 +743,11 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
} }
}); });
mntmStartZkmString.addActionListener(e -> PluginManager.runPlugin(new ZKMStringDecrypter())); ZKMStringDecrypter.addActionListener(e -> PluginManager.runPlugin(new ZKMStringDecrypter()));
mntmNewMenuItem_2.addActionListener(e -> PluginManager.runPlugin(new AllatoriStringDecrypter())); allatoriStringDecrypter.addActionListener(e -> PluginManager.runPlugin(new AllatoriStringDecrypter()));
mntmNewMenuItem_1.addActionListener(e -> MaliciousCodeScannerOptions.showOptionPanel()); maliciousCodeScanner.addActionListener(e -> MaliciousCodeScannerOptions.showOptionPanel());
mntmShowAllStrings.addActionListener(e -> PluginManager.runPlugin(new ShowAllStrings())); showAllStrings.addActionListener(e -> PluginManager.runPlugin(new ShowAllStrings()));
mntmShowMainMethods.addActionListener(e -> PluginManager.runPlugin(new ShowMainMethods())); showMainMethods.addActionListener(e -> PluginManager.runPlugin(new ShowMainMethods()));
setSize(new Dimension(800, 400)); setSize(new Dimension(800, 400));
if (PREVIEW_COPY) if (PREVIEW_COPY)
@ -879,6 +866,25 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
viewMainMenu.add(viewPane3.menu); viewMainMenu.add(viewPane3.menu);
} }
public void buildPluginMenuBar()
{
rootMenu.add(pluginsMainMenu);
pluginsMainMenu.add(openExternalPlugin);
pluginsMainMenu.add(new JSeparator());
pluginsMainMenu.add(recentPluginsSecondaryMenu);
pluginsMainMenu.add(new JSeparator());
pluginsMainMenu.add(codeSequenceDiagram);
pluginsMainMenu.add(maliciousCodeScanner);
pluginsMainMenu.add(showMainMethods);
pluginsMainMenu.add(showAllStrings);
pluginsMainMenu.add(replaceStrings);
pluginsMainMenu.add(stackFramesRemover);
//allatori and ZKM are disabled since they are just placeholders
//mnNewMenu_1.add(mntmNewMenuItem_2);
//mnNewMenu_1.add(mntmStartZkmString);
pluginsMainMenu.add(zStringArrayDecrypter);
}
@Override @Override
public void openClassFile(final FileContainer container, final String name, final ClassNode cn) { public void openClassFile(final FileContainer container, final String name, final ClassNode cn) {
for (final VisibleComponent vc : rfComps) { for (final VisibleComponent vc : rfComps) {