From b18bc950e13857f119c63f70360211daea252e9b Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Fri, 27 Aug 2021 10:49:31 +0200 Subject: [PATCH] Even more applications of the Law of Demeter --- .../java/me/konloch/kontainer/io/DiskReader.java | 11 ++++++----- .../java/me/konloch/kontainer/io/HTTPRequest.java | 6 +++--- .../club/bytecodeviewer/BytecodeViewer.java | 4 ++-- .../the/bytecode/club/bytecodeviewer/api/BCV.java | 2 +- .../club/bytecodeviewer/api/ClassNodeLoader.java | 3 ++- .../bytecode/club/bytecodeviewer/api/Plugin.java | 3 ++- .../decompilers/bytecode/ClassNodeDecompiler.java | 4 ++-- .../decompilers/bytecode/InstructionPrinter.java | 4 ++-- .../club/bytecodeviewer/gui/MainViewerGUI.java | 4 ++-- .../gui/components/FileChooser.java | 3 ++- .../gui/contextmenu/ContextMenu.java | 3 ++- .../gui/plugins/MaliciousCodeScannerOptions.java | 3 ++- .../resourcelist/ResourceListIconRenderer.java | 5 +++-- .../gui/resourceviewer/Workspace.java | 3 ++- .../malwarescanner/MalwareScan.java | 10 +++++----- .../obfuscators/JavaObfuscator.java | 3 ++- .../preinstalled/AllatoriStringDecrypter.java | 6 +++--- .../preinstalled/ChangeClassFileVersions.java | 4 ++-- .../plugin/preinstalled/CodeSequenceDiagram.java | 4 ++-- .../plugin/preinstalled/EZInjection.java | 5 +++-- .../plugin/preinstalled/MaliciousCodeScanner.java | 6 +++--- .../plugin/preinstalled/ReplaceStrings.java | 4 ++-- .../plugin/preinstalled/ShowAllStrings.java | 4 ++-- .../plugin/preinstalled/ShowMainMethods.java | 4 ++-- .../plugin/preinstalled/StackFramesRemover.java | 6 +++--- .../preinstalled/ViewAPKAndroidPermissions.java | 4 ++-- .../plugin/preinstalled/ViewManifest.java | 4 ++-- .../plugin/preinstalled/ZKMStringDecrypter.java | 6 +++--- .../preinstalled/ZStringArrayDecrypter.java | 4 ++-- .../JavascriptPluginLaunchStrategy.java | 4 ++-- .../importing/impl/DirectoryResourceImporter.java | 3 ++- .../club/bytecodeviewer/translation/Language.java | 7 ++++--- .../translation/TranslatedStrings.java | 3 ++- .../club/bytecodeviewer/util/DialogUtils.java | 3 ++- .../club/bytecodeviewer/util/JarUtils.java | 15 ++++++++------- .../club/bytecodeviewer/util/MiscUtils.java | 5 +++-- 36 files changed, 94 insertions(+), 78 deletions(-) diff --git a/src/main/java/me/konloch/kontainer/io/DiskReader.java b/src/main/java/me/konloch/kontainer/io/DiskReader.java index 9f416d6e..03df2662 100644 --- a/src/main/java/me/konloch/kontainer/io/DiskReader.java +++ b/src/main/java/me/konloch/kontainer/io/DiskReader.java @@ -5,6 +5,7 @@ import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Random; import the.bytecode.club.bytecodeviewer.util.EncodeUtils; @@ -18,14 +19,14 @@ import the.bytecode.club.bytecodeviewer.util.EncodeUtils; public class DiskReader { public static Random random = new Random(); - public static Map> map = new HashMap<>(); + public static Map> map = new HashMap<>(); /** * Used to load from file, allows caching */ - public synchronized static ArrayList loadArrayList(String fileName, - boolean cache) { - ArrayList array = new ArrayList<>(); + public synchronized static List loadArrayList(String fileName, + boolean cache) { + List array = new ArrayList<>(); if (!map.containsKey(fileName)) { try { File file = new File(fileName); @@ -76,7 +77,7 @@ public class DiskReader { public static String loadString(String fileName, int lineNumber, boolean cache) throws Exception { - ArrayList array; + List array; if (!map.containsKey(fileName)) { array = new ArrayList<>(); File file = new File(fileName); diff --git a/src/main/java/me/konloch/kontainer/io/HTTPRequest.java b/src/main/java/me/konloch/kontainer/io/HTTPRequest.java index 874b67d2..c3b1798b 100644 --- a/src/main/java/me/konloch/kontainer/io/HTTPRequest.java +++ b/src/main/java/me/konloch/kontainer/io/HTTPRequest.java @@ -142,7 +142,7 @@ public class HTTPRequest { * @throws Exception */ public String[] read() throws Exception { - ArrayList st; + List st; try { setup(); @@ -172,7 +172,7 @@ public class HTTPRequest { * @throws Exception */ public String[] read(int linesToRead) throws Exception { - ArrayList st; + List st; try { setup(); @@ -273,4 +273,4 @@ public class HTTPRequest { connection = null; } -} \ No newline at end of file +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 31744385..1b84e08f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -432,9 +432,9 @@ public class BytecodeViewer * @return the loaded classes as an array list */ @Deprecated - public static ArrayList getLoadedClasses() + public static List getLoadedClasses() { - ArrayList a = new ArrayList<>(); + List a = new ArrayList<>(); for (ResourceContainer container : resourceContainers.values()) for (ClassNode c : container.resourceClasses.values()) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/BCV.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/BCV.java index 63ec4876..91fd1aee 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/BCV.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/BCV.java @@ -189,7 +189,7 @@ public class BCV * * @return the loaded classes */ - public static ArrayList getLoadedClasses() { + public static List getLoadedClasses() { return the.bytecode.club.bytecodeviewer.BytecodeViewer .getLoadedClasses(); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java index 15210148..8492a8ea 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/ClassNodeLoader.java @@ -8,6 +8,7 @@ import java.security.cert.Certificate; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.ClassNode; @@ -73,7 +74,7 @@ public final class ClassNodeLoader extends ClassLoader * @return All classes in this loader */ public Collection> getAllClasses() { - ArrayList> classes = new ArrayList<>(); + List> classes = new ArrayList<>(); for (String s : this.classes.keySet()) { try { classes.add(loadClass(s)); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java index 08dcaf55..3831ff72 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java @@ -1,6 +1,7 @@ package the.bytecode.club.bytecodeviewer.api; import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.resources.ResourceContainer; @@ -94,5 +95,5 @@ public abstract class Plugin extends Thread * * @param classNodeList all of the loaded classes for easy access. */ - public abstract void execute(ArrayList classNodeList); + public abstract void execute(List classNodeList); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java index ed7439f6..5fa1744a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java @@ -38,9 +38,9 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl; public class ClassNodeDecompiler { public static PrefixedStringBuilder decompile( - PrefixedStringBuilder sb, ArrayList decompiledClasses, + PrefixedStringBuilder sb, List decompiledClasses, ClassNode cn) { - ArrayList unableToDecompile = new ArrayList<>(); + List unableToDecompile = new ArrayList<>(); decompiledClasses.add(cn.name); sb.append(getAccessString(cn.access)); sb.append(" "); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java index c37ed849..737fdd4b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java @@ -69,7 +69,7 @@ public class InstructionPrinter { protected List matchedInsns; protected Map labels; private boolean firstLabel = false; - private final ArrayList info = new ArrayList<>(); + private final List info = new ArrayList<>(); public InstructionPrinter(MethodNode m, TypeAndName[] args) { this.args = args; @@ -99,7 +99,7 @@ public class InstructionPrinter { * * @return The print as an ArrayList */ - public ArrayList createPrint() { + public List createPrint() { firstLabel = false; info.clear(); for (AbstractInsnNode ain : mNode.instructions) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index 1fa5b948..ef437136 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -110,7 +110,7 @@ public class MainViewerGUI extends JFrame public final List waitIcons = new ArrayList<>(); //main UI components - public final ArrayList uiComponents = new ArrayList<>(); + public final List uiComponents = new ArrayList<>(); public final Workspace workPane = new Workspace(); public final ResourceListPane resourcePane = new ResourceListPane(); public final SearchBoxPane searchBoxPane = new SearchBoxPane(); @@ -915,7 +915,7 @@ public class MainViewerGUI extends JFrame if (dialog.promptChoice() == 0) { LazyNameUtil.reset(); - ArrayList reopen = new ArrayList<>(); + List reopen = new ArrayList<>(); for (ResourceContainer container : BytecodeViewer.resourceContainers.values()) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java index 4fd05766..c2e4b39b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.components; import java.io.File; import java.util.Arrays; import java.util.HashSet; +import java.util.Set; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import the.bytecode.club.bytecodeviewer.util.MiscUtils; @@ -40,7 +41,7 @@ public class FileChooser extends JFileChooser public FileChooser(boolean skipFileFilter, File file, String title, String description, String... extensions) { - HashSet extensionSet = new HashSet<>(Arrays.asList(extensions)); + Set extensionSet = new HashSet<>(Arrays.asList(extensions)); try { if(file.isDirectory()) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenu.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenu.java index 1b06425d..3f3fe6c8 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenu.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/contextmenu/ContextMenu.java @@ -1,6 +1,7 @@ package the.bytecode.club.bytecodeviewer.gui.contextmenu; import java.util.ArrayList; +import java.util.List; import javax.swing.JPopupMenu; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; @@ -39,7 +40,7 @@ import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult; public class ContextMenu { private static ContextMenu SINGLETON = new ContextMenu(); - private final ArrayList contextMenuItems = new ArrayList<>(); + private final List contextMenuItems = new ArrayList<>(); static { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java index f43d5abb..5c56f5ae 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/plugins/MaliciousCodeScannerOptions.java @@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.gui.plugins; import java.awt.Dimension; import java.util.ArrayList; +import java.util.List; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; @@ -55,7 +56,7 @@ public class MaliciousCodeScannerOptions extends JFrame setResizable(false); setTitle("Malicious Code Scanner Options"); getContentPane().setLayout(null); - ArrayList checkBoxes = new ArrayList<>(); + List checkBoxes = new ArrayList<>(); int y = 7; for(MalwareScanModule module : MalwareScanModule.values()) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListIconRenderer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListIconRenderer.java index 079a7d14..bc5a1dac 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListIconRenderer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListIconRenderer.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.resourcelist; import java.awt.Component; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.swing.ImageIcon; import javax.swing.JTree; @@ -77,8 +78,8 @@ public class ResourceListIconRenderer extends DefaultTreeCellRenderer //folders if (node.getChildCount() > 0) { - ArrayList nodes = new ArrayList<>(); - ArrayList totalNodes = new ArrayList<>(); + List nodes = new ArrayList<>(); + List totalNodes = new ArrayList<>(); nodes.add(node); totalNodes.add(node); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java index 96538200..21e9f23e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java @@ -7,6 +7,7 @@ import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.HashSet; +import java.util.Set; import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JPanel; @@ -56,7 +57,7 @@ public class Workspace extends TranslatedVisibleComponent public final JTabbedPane tabs; public final JPanel buttonPanel; public final JButton refreshClass; - public final HashSet openedTabs = new HashSet<>(); + public final Set openedTabs = new HashSet<>(); public Workspace() { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareScan.java b/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareScan.java index e3438c68..e764a04c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareScan.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareScan.java @@ -1,7 +1,7 @@ package the.bytecode.club.bytecodeviewer.malwarescanner; -import java.util.ArrayList; -import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.objectweb.asm.tree.ClassNode; /*************************************************************************** @@ -33,11 +33,11 @@ import org.objectweb.asm.tree.ClassNode; */ public class MalwareScan { - public final ArrayList classNodeList; + public final List classNodeList; public final StringBuilder sb; - public final HashSet scanOptions; + public final Set scanOptions; - public MalwareScan(ArrayList classNodeList, StringBuilder sb, HashSet scanOptions) + public MalwareScan(List classNodeList, StringBuilder sb, Set scanOptions) { this.classNodeList = classNodeList; this.sb = sb; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java index 99c51f21..31ba7c03 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/JavaObfuscator.java @@ -1,6 +1,7 @@ package the.bytecode.club.bytecodeviewer.obfuscators; import java.util.ArrayList; +import java.util.List; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.util.MiscUtils; @@ -52,7 +53,7 @@ public abstract class JavaObfuscator extends Thread { public static int MAX_STRING_LENGTH = 25; public static int MIN_STRING_LENGTH = 5; - private final ArrayList names = new ArrayList<>(); + private final List names = new ArrayList<>(); protected String generateUniqueName(int length) { boolean found = false; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java index 27906473..1dcd5b2d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java @@ -3,7 +3,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; import java.awt.Dimension; import java.io.IOException; import java.lang.reflect.Method; -import java.util.ArrayList; +import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; @@ -61,7 +61,7 @@ public class AllatoriStringDecrypter extends Plugin public AllatoriStringDecrypter(String className) {this.className = className;} @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { PluginConsole frame = new PluginConsole("Allatori String Decrypter"); @@ -284,7 +284,7 @@ public class AllatoriStringDecrypter extends Plugin public static class AllatoriStringDecrypterOptions extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { new AllatoriStringDecrypterOptionsFrame().setVisible(true); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ChangeClassFileVersions.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ChangeClassFileVersions.java index 67bb73e8..86bccc19 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ChangeClassFileVersions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ChangeClassFileVersions.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.api.Plugin; @@ -18,7 +18,7 @@ import the.bytecode.club.bytecodeviewer.api.Plugin; public class ChangeClassFileVersions extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { //prompt dialog for version number // TODO: include a little diagram of what JDK is which number diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java index 37c85b83..0f8afaf6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/CodeSequenceDiagram.java @@ -5,7 +5,7 @@ import com.mxgraph.view.mxGraph; import java.awt.Font; import java.awt.font.FontRenderContext; import java.awt.geom.AffineTransform; -import java.util.ArrayList; +import java.util.List; import javax.swing.JFrame; import javax.swing.UIManager; import org.objectweb.asm.tree.AbstractInsnNode; @@ -50,7 +50,7 @@ public class CodeSequenceDiagram extends Plugin } @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { if (!BytecodeViewer.isActiveResourceClass()) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java index cc43b883..9b8bce85 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java @@ -4,6 +4,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; @@ -49,7 +50,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl; public class EZInjection extends Plugin { - public static ArrayList hookArray = new ArrayList<>(); + public static List hookArray = new ArrayList<>(); private static final String version = "1.0"; private final boolean accessModifiers; private final boolean injectHooks; @@ -137,7 +138,7 @@ public class EZInjection extends Plugin } @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { if(console) new PluginConsole("EZ Injection v" + version); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java index f279b393..4e4b901f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java @@ -1,8 +1,8 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Set; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.PluginConsole; @@ -48,12 +48,12 @@ public class MaliciousCodeScanner extends Plugin } @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { PluginConsole frame = new PluginConsole("Malicious Code Scanner"); StringBuilder sb = new StringBuilder(); - HashSet scanOptions = new HashSet<>(); + Set scanOptions = new HashSet<>(); for(MaliciousCodeOptions option : options) if(option.getCheckBox().isSelected()) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java index d40e4175..5fce5ce8 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; @@ -51,7 +51,7 @@ public class ReplaceStrings extends Plugin } @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { frame = new PluginConsole("Replace Strings"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java index 30d0f942..49c7708e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; @@ -39,7 +39,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl; public class ShowAllStrings extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { PluginConsole frame = new PluginConsole("Show All Strings"); StringBuilder sb = new StringBuilder(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java index e8f2c327..de4a58c6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; @@ -37,7 +37,7 @@ public class ShowMainMethods extends Plugin private static final int PUBLIC_STATIC = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC; @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { PluginConsole frame = new PluginConsole("Show Main Methods"); StringBuilder sb = new StringBuilder(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java index 4fb807ef..b69d4cf2 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import java.util.ArrayList; +import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.ClassNode; @@ -12,7 +12,7 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole; public class StackFramesRemover extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { AtomicInteger counter = new AtomicInteger(); PluginConsole frame = new PluginConsole("StackFrames Remover"); @@ -34,4 +34,4 @@ public class StackFramesRemover extends Plugin frame.appendText(String.format("Removed %s stackframes.", counter)); frame.setVisible(true); } -} \ No newline at end of file +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java index 05e88d61..ed7aca4a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java @@ -1,7 +1,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.PluginConsole; @@ -13,7 +13,7 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole; public class ViewAPKAndroidPermissions extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { PluginConsole frame = new PluginConsole("Android Permissions"); frame.setVisible(true); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java index ca2f446b..cba60f8e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java @@ -1,7 +1,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.PluginConsole; @@ -13,7 +13,7 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole; public class ViewManifest extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { PluginConsole frame = new PluginConsole("View Manifest"); frame.setVisible(true); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java index 59f320ce..e218c82c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZKMStringDecrypter.java @@ -1,6 +1,6 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.api.Plugin; @@ -32,8 +32,8 @@ import the.bytecode.club.bytecodeviewer.api.Plugin; public class ZKMStringDecrypter extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { BytecodeViewer.showMessage("This is a planned feature."); } -} \ No newline at end of file +} diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java index 7b8ebad1..790aaa1b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java @@ -2,7 +2,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.ArrayList; +import java.util.List; import java.util.Objects; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; @@ -41,7 +41,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl; public class ZStringArrayDecrypter extends Plugin { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { PluginConsole gui = new PluginConsole("ZStringArray Decrypter"); StringBuilder out = new StringBuilder(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java index 4bab8e70..dbc390c5 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java @@ -3,7 +3,7 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies; import java.io.File; import java.io.FileReader; import java.io.Reader; -import java.util.ArrayList; +import java.util.List; import javax.script.Bindings; import javax.script.Invocable; import javax.script.ScriptContext; @@ -73,7 +73,7 @@ public class JavascriptPluginLaunchStrategy implements PluginLaunchStrategy return new Plugin() { @Override - public void execute(ArrayList classNodeList) + public void execute(List classNodeList) { try { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/DirectoryResourceImporter.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/DirectoryResourceImporter.java index 08ccacb3..3c2f1a90 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/DirectoryResourceImporter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/DirectoryResourceImporter.java @@ -5,6 +5,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import org.apache.commons.io.FilenameUtils; import org.objectweb.asm.tree.ClassNode; @@ -47,7 +48,7 @@ public class DirectoryResourceImporter implements Importer Map allDirectoryClasses = new LinkedHashMap<>(); boolean finished = false; - ArrayList totalFiles = new ArrayList<>(); + List totalFiles = new ArrayList<>(); totalFiles.add(file); String dir = file.getAbsolutePath(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java index a856c305..62d96a73 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/Language.java @@ -8,6 +8,7 @@ import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; +import java.util.Set; import org.apache.commons.collections4.map.LinkedMap; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Constants; @@ -96,7 +97,7 @@ public enum Language private final String resourcePath; private final String readableName; private final String htmlIdentifier; - private final LinkedHashSet languageCode; + private final Set languageCode; private Map translationMap; Language(String resourcePath, String readableName, String htmlIdentifier, String... languageCodes) @@ -175,7 +176,7 @@ public enum Language IconResources.loadResourceAsString(resourcePath), new TypeToken>(){}.getType()); - HashSet existingKeys = new HashSet<>(); + Set existingKeys = new HashSet<>(); for(TranslatedComponents t : TranslatedComponents.values()) existingKeys.add(t.name()); @@ -189,7 +190,7 @@ public enum Language return resourcePath; } - public HashSet getLanguageCode() + public Set getLanguageCode() { return languageCode; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java b/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java index a7993d4e..da7aaddd 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/translation/TranslatedStrings.java @@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.translation; import java.io.IOException; import java.util.HashSet; +import java.util.Set; import the.bytecode.club.bytecodeviewer.api.BCV; /*************************************************************************** @@ -121,7 +122,7 @@ public enum TranslatedStrings DRAG_CLASS_JAR, ; - public static final HashSet nameSet = new HashSet<>(); + public static final Set nameSet = new HashSet<>(); static { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/DialogUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/DialogUtils.java index 5b4fec6d..7292cbc7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/DialogUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/DialogUtils.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.util; import java.io.File; import java.util.Arrays; import java.util.HashSet; +import java.util.Set; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import the.bytecode.club.bytecodeviewer.BytecodeViewer; @@ -89,7 +90,7 @@ public class DialogUtils */ public static File fileChooser(String title, String description, File directory, FileFilter filter, OnOpenEvent onOpen, String... extensions) { - HashSet extensionSet = new HashSet<>(Arrays.asList(extensions)); + Set extensionSet = new HashSet<>(Arrays.asList(extensions)); final JFileChooser fc = new FileChooser(true, directory, diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java index 62565995..fb105234 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.jar.JarOutputStream; @@ -159,9 +160,9 @@ public class JarUtils BytecodeViewer.addResourceContainer(container); } - public static ArrayList loadClasses(final File jarFile) throws IOException + public static List loadClasses(final File jarFile) throws IOException { - ArrayList classes = new ArrayList<>(); + List classes = new ArrayList<>(); try (FileInputStream fis = new FileInputStream(jarFile); ZipInputStream jis = new ZipInputStream(fis)) { ZipEntry entry; @@ -249,7 +250,7 @@ public class JarUtils * @param path the exact path of the output jar file * @param manifest the manifest contents */ - public static void saveAsJar(ArrayList nodeList, String path, + public static void saveAsJar(List nodeList, String path, String manifest) { try (FileOutputStream fos = new FileOutputStream(path); JarOutputStream out = new JarOutputStream(fos)) { @@ -295,7 +296,7 @@ public class JarUtils try (FileOutputStream fos = new FileOutputStream(path); JarOutputStream out = new JarOutputStream(fos)) { - ArrayList noDupe = new ArrayList<>(); + List noDupe = new ArrayList<>(); for (ClassNode cn : nodeList) { ClassWriter cw = new ClassWriter(0); @@ -326,7 +327,7 @@ public class JarUtils * @param nodeList The loaded ClassNodes * @param dir the exact jar output path */ - public static void saveAsJarClassesOnlyToDir(ArrayList nodeList, String dir) { + public static void saveAsJarClassesOnlyToDir(List nodeList, String dir) { try { for (ClassNode cn : nodeList) { ClassWriter cw = new ClassWriter(0); @@ -349,10 +350,10 @@ public class JarUtils * @param nodeList The loaded ClassNodes * @param path the exact jar output path */ - public static void saveAsJar(ArrayList nodeList, String path) { + public static void saveAsJar(List nodeList, String path) { try (FileOutputStream fos = new FileOutputStream(path); JarOutputStream out = new JarOutputStream(fos)) { - ArrayList noDupe = new ArrayList<>(); + List noDupe = new ArrayList<>(); for (ClassNode cn : nodeList) { ClassWriter cw = new ClassWriter(0); cn.accept(cw); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java index 1e6cd5ad..3f688ea9 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Random; +import java.util.Set; import javax.imageio.ImageIO; import javax.swing.SwingUtilities; import org.apache.commons.lang3.StringUtils; @@ -57,7 +58,7 @@ public class MiscUtils private static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; private static final Random rnd = new Random(); - private static final HashSet createdRandomizedNames = new HashSet<>(); + private static final Set createdRandomizedNames = new HashSet<>(); /** * Returns a random string without numbers @@ -189,7 +190,7 @@ public class MiscUtils return path; } - public static int fileContainersHash(ArrayList resourceContainers) { + public static int fileContainersHash(List resourceContainers) { StringBuilder block = new StringBuilder(); for (ResourceContainer container : resourceContainers) { block.append(container.name);