Even more applications of the Law of Demeter
This commit is contained in:
parent
0d7b7c5de8
commit
b18bc950e1
36 changed files with 94 additions and 78 deletions
|
@ -5,6 +5,7 @@ import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
|
import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
|
||||||
|
@ -18,14 +19,14 @@ import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
|
||||||
public class DiskReader {
|
public class DiskReader {
|
||||||
|
|
||||||
public static Random random = new Random();
|
public static Random random = new Random();
|
||||||
public static Map<String, ArrayList<String>> map = new HashMap<>();
|
public static Map<String, List<String>> map = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to load from file, allows caching
|
* Used to load from file, allows caching
|
||||||
*/
|
*/
|
||||||
public synchronized static ArrayList<String> loadArrayList(String fileName,
|
public synchronized static List<String> loadArrayList(String fileName,
|
||||||
boolean cache) {
|
boolean cache) {
|
||||||
ArrayList<String> array = new ArrayList<>();
|
List<String> array = new ArrayList<>();
|
||||||
if (!map.containsKey(fileName)) {
|
if (!map.containsKey(fileName)) {
|
||||||
try {
|
try {
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
@ -76,7 +77,7 @@ public class DiskReader {
|
||||||
public static String loadString(String fileName, int lineNumber,
|
public static String loadString(String fileName, int lineNumber,
|
||||||
boolean cache) throws Exception {
|
boolean cache) throws Exception {
|
||||||
|
|
||||||
ArrayList<String> array;
|
List<String> array;
|
||||||
if (!map.containsKey(fileName)) {
|
if (!map.containsKey(fileName)) {
|
||||||
array = new ArrayList<>();
|
array = new ArrayList<>();
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class HTTPRequest {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public String[] read() throws Exception {
|
public String[] read() throws Exception {
|
||||||
ArrayList<String> st;
|
List<String> st;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setup();
|
setup();
|
||||||
|
@ -172,7 +172,7 @@ public class HTTPRequest {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public String[] read(int linesToRead) throws Exception {
|
public String[] read(int linesToRead) throws Exception {
|
||||||
ArrayList<String> st;
|
List<String> st;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setup();
|
setup();
|
||||||
|
@ -273,4 +273,4 @@ public class HTTPRequest {
|
||||||
connection = null;
|
connection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,9 +432,9 @@ public class BytecodeViewer
|
||||||
* @return the loaded classes as an array list
|
* @return the loaded classes as an array list
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static ArrayList<ClassNode> getLoadedClasses()
|
public static List<ClassNode> getLoadedClasses()
|
||||||
{
|
{
|
||||||
ArrayList<ClassNode> a = new ArrayList<>();
|
List<ClassNode> a = new ArrayList<>();
|
||||||
|
|
||||||
for (ResourceContainer container : resourceContainers.values())
|
for (ResourceContainer container : resourceContainers.values())
|
||||||
for (ClassNode c : container.resourceClasses.values())
|
for (ClassNode c : container.resourceClasses.values())
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class BCV
|
||||||
*
|
*
|
||||||
* @return the loaded classes
|
* @return the loaded classes
|
||||||
*/
|
*/
|
||||||
public static ArrayList<ClassNode> getLoadedClasses() {
|
public static List<ClassNode> getLoadedClasses() {
|
||||||
return the.bytecode.club.bytecodeviewer.BytecodeViewer
|
return the.bytecode.club.bytecodeviewer.BytecodeViewer
|
||||||
.getLoadedClasses();
|
.getLoadedClasses();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.security.cert.Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
@ -73,7 +74,7 @@ public final class ClassNodeLoader extends ClassLoader
|
||||||
* @return All classes in this loader
|
* @return All classes in this loader
|
||||||
*/
|
*/
|
||||||
public Collection<Class<?>> getAllClasses() {
|
public Collection<Class<?>> getAllClasses() {
|
||||||
ArrayList<Class<?>> classes = new ArrayList<>();
|
List<Class<?>> classes = new ArrayList<>();
|
||||||
for (String s : this.classes.keySet()) {
|
for (String s : this.classes.keySet()) {
|
||||||
try {
|
try {
|
||||||
classes.add(loadClass(s));
|
classes.add(loadClass(s));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.api;
|
package the.bytecode.club.bytecodeviewer.api;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
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.
|
* @param classNodeList all of the loaded classes for easy access.
|
||||||
*/
|
*/
|
||||||
public abstract void execute(ArrayList<ClassNode> classNodeList);
|
public abstract void execute(List<ClassNode> classNodeList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl;
|
||||||
public class ClassNodeDecompiler
|
public class ClassNodeDecompiler
|
||||||
{
|
{
|
||||||
public static PrefixedStringBuilder decompile(
|
public static PrefixedStringBuilder decompile(
|
||||||
PrefixedStringBuilder sb, ArrayList<String> decompiledClasses,
|
PrefixedStringBuilder sb, List<String> decompiledClasses,
|
||||||
ClassNode cn) {
|
ClassNode cn) {
|
||||||
ArrayList<String> unableToDecompile = new ArrayList<>();
|
List<String> unableToDecompile = new ArrayList<>();
|
||||||
decompiledClasses.add(cn.name);
|
decompiledClasses.add(cn.name);
|
||||||
sb.append(getAccessString(cn.access));
|
sb.append(getAccessString(cn.access));
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class InstructionPrinter {
|
||||||
protected List<AbstractInsnNode> matchedInsns;
|
protected List<AbstractInsnNode> matchedInsns;
|
||||||
protected Map<LabelNode, Integer> labels;
|
protected Map<LabelNode, Integer> labels;
|
||||||
private boolean firstLabel = false;
|
private boolean firstLabel = false;
|
||||||
private final ArrayList<String> info = new ArrayList<>();
|
private final List<String> info = new ArrayList<>();
|
||||||
|
|
||||||
public InstructionPrinter(MethodNode m, TypeAndName[] args) {
|
public InstructionPrinter(MethodNode m, TypeAndName[] args) {
|
||||||
this.args = args;
|
this.args = args;
|
||||||
|
@ -99,7 +99,7 @@ public class InstructionPrinter {
|
||||||
*
|
*
|
||||||
* @return The print as an ArrayList
|
* @return The print as an ArrayList
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> createPrint() {
|
public List<String> createPrint() {
|
||||||
firstLabel = false;
|
firstLabel = false;
|
||||||
info.clear();
|
info.clear();
|
||||||
for (AbstractInsnNode ain : mNode.instructions) {
|
for (AbstractInsnNode ain : mNode.instructions) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class MainViewerGUI extends JFrame
|
||||||
public final List<JMenuItem> waitIcons = new ArrayList<>();
|
public final List<JMenuItem> waitIcons = new ArrayList<>();
|
||||||
|
|
||||||
//main UI components
|
//main UI components
|
||||||
public final ArrayList<VisibleComponent> uiComponents = new ArrayList<>();
|
public final List<VisibleComponent> uiComponents = new ArrayList<>();
|
||||||
public final Workspace workPane = new Workspace();
|
public final Workspace workPane = new Workspace();
|
||||||
public final ResourceListPane resourcePane = new ResourceListPane();
|
public final ResourceListPane resourcePane = new ResourceListPane();
|
||||||
public final SearchBoxPane searchBoxPane = new SearchBoxPane();
|
public final SearchBoxPane searchBoxPane = new SearchBoxPane();
|
||||||
|
@ -915,7 +915,7 @@ public class MainViewerGUI extends JFrame
|
||||||
if (dialog.promptChoice() == 0)
|
if (dialog.promptChoice() == 0)
|
||||||
{
|
{
|
||||||
LazyNameUtil.reset();
|
LazyNameUtil.reset();
|
||||||
ArrayList<File> reopen = new ArrayList<>();
|
List<File> reopen = new ArrayList<>();
|
||||||
|
|
||||||
for (ResourceContainer container : BytecodeViewer.resourceContainers.values())
|
for (ResourceContainer container : BytecodeViewer.resourceContainers.values())
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.components;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
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)
|
public FileChooser(boolean skipFileFilter, File file, String title, String description, String... extensions)
|
||||||
{
|
{
|
||||||
HashSet<String> extensionSet = new HashSet<>(Arrays.asList(extensions));
|
Set<String> extensionSet = new HashSet<>(Arrays.asList(extensions));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(file.isDirectory())
|
if(file.isDirectory())
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.gui.contextmenu;
|
package the.bytecode.club.bytecodeviewer.gui.contextmenu;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.tree.DefaultMutableTreeNode;
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
@ -39,7 +40,7 @@ import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
||||||
public class ContextMenu
|
public class ContextMenu
|
||||||
{
|
{
|
||||||
private static ContextMenu SINGLETON = new ContextMenu();
|
private static ContextMenu SINGLETON = new ContextMenu();
|
||||||
private final ArrayList<ContextMenuItem> contextMenuItems = new ArrayList<>();
|
private final List<ContextMenuItem> contextMenuItems = new ArrayList<>();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.gui.plugins;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
@ -55,7 +56,7 @@ public class MaliciousCodeScannerOptions extends JFrame
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
setTitle("Malicious Code Scanner Options");
|
setTitle("Malicious Code Scanner Options");
|
||||||
getContentPane().setLayout(null);
|
getContentPane().setLayout(null);
|
||||||
ArrayList<MaliciousCodeOptions> checkBoxes = new ArrayList<>();
|
List<MaliciousCodeOptions> checkBoxes = new ArrayList<>();
|
||||||
|
|
||||||
int y = 7;
|
int y = 7;
|
||||||
for(MalwareScanModule module : MalwareScanModule.values())
|
for(MalwareScanModule module : MalwareScanModule.values())
|
||||||
|
|
|
@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.resourcelist;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
|
@ -77,8 +78,8 @@ public class ResourceListIconRenderer extends DefaultTreeCellRenderer
|
||||||
//folders
|
//folders
|
||||||
if (node.getChildCount() > 0)
|
if (node.getChildCount() > 0)
|
||||||
{
|
{
|
||||||
ArrayList<TreeNode> nodes = new ArrayList<>();
|
List<TreeNode> nodes = new ArrayList<>();
|
||||||
ArrayList<TreeNode> totalNodes = new ArrayList<>();
|
List<TreeNode> totalNodes = new ArrayList<>();
|
||||||
|
|
||||||
nodes.add(node);
|
nodes.add(node);
|
||||||
totalNodes.add(node);
|
totalNodes.add(node);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.awt.Rectangle;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
@ -56,7 +57,7 @@ public class Workspace extends TranslatedVisibleComponent
|
||||||
public final JTabbedPane tabs;
|
public final JTabbedPane tabs;
|
||||||
public final JPanel buttonPanel;
|
public final JPanel buttonPanel;
|
||||||
public final JButton refreshClass;
|
public final JButton refreshClass;
|
||||||
public final HashSet<String> openedTabs = new HashSet<>();
|
public final Set<String> openedTabs = new HashSet<>();
|
||||||
|
|
||||||
public Workspace()
|
public Workspace()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.malwarescanner;
|
package the.bytecode.club.bytecodeviewer.malwarescanner;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.HashSet;
|
import java.util.Set;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -33,11 +33,11 @@ import org.objectweb.asm.tree.ClassNode;
|
||||||
*/
|
*/
|
||||||
public class MalwareScan
|
public class MalwareScan
|
||||||
{
|
{
|
||||||
public final ArrayList<ClassNode> classNodeList;
|
public final List<ClassNode> classNodeList;
|
||||||
public final StringBuilder sb;
|
public final StringBuilder sb;
|
||||||
public final HashSet<String> scanOptions;
|
public final Set<String> scanOptions;
|
||||||
|
|
||||||
public MalwareScan(ArrayList<ClassNode> classNodeList, StringBuilder sb, HashSet<String> scanOptions)
|
public MalwareScan(List<ClassNode> classNodeList, StringBuilder sb, Set<String> scanOptions)
|
||||||
{
|
{
|
||||||
this.classNodeList = classNodeList;
|
this.classNodeList = classNodeList;
|
||||||
this.sb = sb;
|
this.sb = sb;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.obfuscators;
|
package the.bytecode.club.bytecodeviewer.obfuscators;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.Configuration;
|
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||||
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
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 MAX_STRING_LENGTH = 25;
|
||||||
public static int MIN_STRING_LENGTH = 5;
|
public static int MIN_STRING_LENGTH = 5;
|
||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final List<String> names = new ArrayList<>();
|
||||||
|
|
||||||
protected String generateUniqueName(int length) {
|
protected String generateUniqueName(int length) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
@ -61,7 +61,7 @@ public class AllatoriStringDecrypter extends Plugin
|
||||||
public AllatoriStringDecrypter(String className) {this.className = className;}
|
public AllatoriStringDecrypter(String className) {this.className = className;}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
PluginConsole frame = new PluginConsole("Allatori String Decrypter");
|
PluginConsole frame = new PluginConsole("Allatori String Decrypter");
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ public class AllatoriStringDecrypter extends Plugin
|
||||||
public static class AllatoriStringDecrypterOptions extends Plugin
|
public static class AllatoriStringDecrypterOptions extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
new AllatoriStringDecrypterOptionsFrame().setVisible(true);
|
new AllatoriStringDecrypterOptionsFrame().setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
|
@ -18,7 +18,7 @@ import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
public class ChangeClassFileVersions extends Plugin
|
public class ChangeClassFileVersions extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
//prompt dialog for version number
|
//prompt dialog for version number
|
||||||
// TODO: include a little diagram of what JDK is which number
|
// TODO: include a little diagram of what JDK is which number
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.mxgraph.view.mxGraph;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
|
@ -50,7 +50,7 @@ public class CodeSequenceDiagram extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
if (!BytecodeViewer.isActiveResourceClass())
|
if (!BytecodeViewer.isActiveResourceClass())
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.FieldNode;
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
@ -49,7 +50,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl;
|
||||||
|
|
||||||
public class EZInjection extends Plugin
|
public class EZInjection extends Plugin
|
||||||
{
|
{
|
||||||
public static ArrayList<BytecodeHook> hookArray = new ArrayList<>();
|
public static List<BytecodeHook> hookArray = new ArrayList<>();
|
||||||
private static final String version = "1.0";
|
private static final String version = "1.0";
|
||||||
private final boolean accessModifiers;
|
private final boolean accessModifiers;
|
||||||
private final boolean injectHooks;
|
private final boolean injectHooks;
|
||||||
|
@ -137,7 +138,7 @@ public class EZInjection extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
if(console)
|
if(console)
|
||||||
new PluginConsole("EZ Injection v" + version);
|
new PluginConsole("EZ Injection v" + version);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
|
@ -48,12 +48,12 @@ public class MaliciousCodeScanner extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
PluginConsole frame = new PluginConsole("Malicious Code Scanner");
|
PluginConsole frame = new PluginConsole("Malicious Code Scanner");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
HashSet<String> scanOptions = new HashSet<>();
|
Set<String> scanOptions = new HashSet<>();
|
||||||
|
|
||||||
for(MaliciousCodeOptions option : options)
|
for(MaliciousCodeOptions option : options)
|
||||||
if(option.getCheckBox().isSelected())
|
if(option.getCheckBox().isSelected())
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
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.AbstractInsnNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.FieldNode;
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
@ -51,7 +51,7 @@ public class ReplaceStrings extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
frame = new PluginConsole("Replace Strings");
|
frame = new PluginConsole("Replace Strings");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
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.AbstractInsnNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.FieldNode;
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
@ -39,7 +39,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl;
|
||||||
public class ShowAllStrings extends Plugin
|
public class ShowAllStrings extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
PluginConsole frame = new PluginConsole("Show All Strings");
|
PluginConsole frame = new PluginConsole("Show All Strings");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
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;
|
private static final int PUBLIC_STATIC = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
PluginConsole frame = new PluginConsole("Show Main Methods");
|
PluginConsole frame = new PluginConsole("Show Main Methods");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
@ -12,7 +12,7 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
public class StackFramesRemover extends Plugin
|
public class StackFramesRemover extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
AtomicInteger counter = new AtomicInteger();
|
AtomicInteger counter = new AtomicInteger();
|
||||||
PluginConsole frame = new PluginConsole("StackFrames Remover");
|
PluginConsole frame = new PluginConsole("StackFrames Remover");
|
||||||
|
@ -34,4 +34,4 @@ public class StackFramesRemover extends Plugin
|
||||||
frame.appendText(String.format("Removed %s stackframes.", counter));
|
frame.appendText(String.format("Removed %s stackframes.", counter));
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
|
@ -13,7 +13,7 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
public class ViewAPKAndroidPermissions extends Plugin
|
public class ViewAPKAndroidPermissions extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
PluginConsole frame = new PluginConsole("Android Permissions");
|
PluginConsole frame = new PluginConsole("Android Permissions");
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
|
@ -13,7 +13,7 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
public class ViewManifest extends Plugin
|
public class ViewManifest extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
PluginConsole frame = new PluginConsole("View Manifest");
|
PluginConsole frame = new PluginConsole("View Manifest");
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
|
@ -32,8 +32,8 @@ import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
public class ZKMStringDecrypter extends Plugin
|
public class ZKMStringDecrypter extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
BytecodeViewer.showMessage("This is a planned feature.");
|
BytecodeViewer.showMessage("This is a planned feature.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
@ -41,7 +41,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl;
|
||||||
public class ZStringArrayDecrypter extends Plugin
|
public class ZStringArrayDecrypter extends Plugin
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
PluginConsole gui = new PluginConsole("ZStringArray Decrypter");
|
PluginConsole gui = new PluginConsole("ZStringArray Decrypter");
|
||||||
StringBuilder out = new StringBuilder();
|
StringBuilder out = new StringBuilder();
|
||||||
|
|
|
@ -3,7 +3,7 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import javax.script.Bindings;
|
import javax.script.Bindings;
|
||||||
import javax.script.Invocable;
|
import javax.script.Invocable;
|
||||||
import javax.script.ScriptContext;
|
import javax.script.ScriptContext;
|
||||||
|
@ -73,7 +73,7 @@ public class JavascriptPluginLaunchStrategy implements PluginLaunchStrategy
|
||||||
return new Plugin()
|
return new Plugin()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void execute(ArrayList<ClassNode> classNodeList)
|
public void execute(List<ClassNode> classNodeList)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
@ -47,7 +48,7 @@ public class DirectoryResourceImporter implements Importer
|
||||||
Map<String, ClassNode> allDirectoryClasses = new LinkedHashMap<>();
|
Map<String, ClassNode> allDirectoryClasses = new LinkedHashMap<>();
|
||||||
|
|
||||||
boolean finished = false;
|
boolean finished = false;
|
||||||
ArrayList<File> totalFiles = new ArrayList<>();
|
List<File> totalFiles = new ArrayList<>();
|
||||||
totalFiles.add(file);
|
totalFiles.add(file);
|
||||||
String dir = file.getAbsolutePath();
|
String dir = file.getAbsolutePath();
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import org.apache.commons.collections4.map.LinkedMap;
|
import org.apache.commons.collections4.map.LinkedMap;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.Constants;
|
import the.bytecode.club.bytecodeviewer.Constants;
|
||||||
|
@ -96,7 +97,7 @@ public enum Language
|
||||||
private final String resourcePath;
|
private final String resourcePath;
|
||||||
private final String readableName;
|
private final String readableName;
|
||||||
private final String htmlIdentifier;
|
private final String htmlIdentifier;
|
||||||
private final LinkedHashSet<String> languageCode;
|
private final Set<String> languageCode;
|
||||||
private Map<String, String> translationMap;
|
private Map<String, String> translationMap;
|
||||||
|
|
||||||
Language(String resourcePath, String readableName, String htmlIdentifier, String... languageCodes)
|
Language(String resourcePath, String readableName, String htmlIdentifier, String... languageCodes)
|
||||||
|
@ -175,7 +176,7 @@ public enum Language
|
||||||
IconResources.loadResourceAsString(resourcePath),
|
IconResources.loadResourceAsString(resourcePath),
|
||||||
new TypeToken<LinkedMap<String, String>>(){}.getType());
|
new TypeToken<LinkedMap<String, String>>(){}.getType());
|
||||||
|
|
||||||
HashSet<String> existingKeys = new HashSet<>();
|
Set<String> existingKeys = new HashSet<>();
|
||||||
for(TranslatedComponents t : TranslatedComponents.values())
|
for(TranslatedComponents t : TranslatedComponents.values())
|
||||||
existingKeys.add(t.name());
|
existingKeys.add(t.name());
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ public enum Language
|
||||||
return resourcePath;
|
return resourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<String> getLanguageCode()
|
public Set<String> getLanguageCode()
|
||||||
{
|
{
|
||||||
return languageCode;
|
return languageCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.translation;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import the.bytecode.club.bytecodeviewer.api.BCV;
|
import the.bytecode.club.bytecodeviewer.api.BCV;
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -121,7 +122,7 @@ public enum TranslatedStrings
|
||||||
DRAG_CLASS_JAR,
|
DRAG_CLASS_JAR,
|
||||||
;
|
;
|
||||||
|
|
||||||
public static final HashSet<String> nameSet = new HashSet<>();
|
public static final Set<String> nameSet = new HashSet<>();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.util;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
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)
|
public static File fileChooser(String title, String description, File directory, FileFilter filter, OnOpenEvent onOpen, String... extensions)
|
||||||
{
|
{
|
||||||
HashSet<String> extensionSet = new HashSet<>(Arrays.asList(extensions));
|
Set<String> extensionSet = new HashSet<>(Arrays.asList(extensions));
|
||||||
|
|
||||||
final JFileChooser fc = new FileChooser(true,
|
final JFileChooser fc = new FileChooser(true,
|
||||||
directory,
|
directory,
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.jar.JarOutputStream;
|
import java.util.jar.JarOutputStream;
|
||||||
|
@ -159,9 +160,9 @@ public class JarUtils
|
||||||
BytecodeViewer.addResourceContainer(container);
|
BytecodeViewer.addResourceContainer(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<ClassNode> loadClasses(final File jarFile) throws IOException
|
public static List<ClassNode> loadClasses(final File jarFile) throws IOException
|
||||||
{
|
{
|
||||||
ArrayList<ClassNode> classes = new ArrayList<>();
|
List<ClassNode> classes = new ArrayList<>();
|
||||||
try (FileInputStream fis = new FileInputStream(jarFile);
|
try (FileInputStream fis = new FileInputStream(jarFile);
|
||||||
ZipInputStream jis = new ZipInputStream(fis)) {
|
ZipInputStream jis = new ZipInputStream(fis)) {
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
|
@ -249,7 +250,7 @@ public class JarUtils
|
||||||
* @param path the exact path of the output jar file
|
* @param path the exact path of the output jar file
|
||||||
* @param manifest the manifest contents
|
* @param manifest the manifest contents
|
||||||
*/
|
*/
|
||||||
public static void saveAsJar(ArrayList<ClassNode> nodeList, String path,
|
public static void saveAsJar(List<ClassNode> nodeList, String path,
|
||||||
String manifest) {
|
String manifest) {
|
||||||
try (FileOutputStream fos = new FileOutputStream(path);
|
try (FileOutputStream fos = new FileOutputStream(path);
|
||||||
JarOutputStream out = new JarOutputStream(fos)) {
|
JarOutputStream out = new JarOutputStream(fos)) {
|
||||||
|
@ -295,7 +296,7 @@ public class JarUtils
|
||||||
try (FileOutputStream fos = new FileOutputStream(path);
|
try (FileOutputStream fos = new FileOutputStream(path);
|
||||||
JarOutputStream out = new JarOutputStream(fos))
|
JarOutputStream out = new JarOutputStream(fos))
|
||||||
{
|
{
|
||||||
ArrayList<String> noDupe = new ArrayList<>();
|
List<String> noDupe = new ArrayList<>();
|
||||||
for (ClassNode cn : nodeList)
|
for (ClassNode cn : nodeList)
|
||||||
{
|
{
|
||||||
ClassWriter cw = new ClassWriter(0);
|
ClassWriter cw = new ClassWriter(0);
|
||||||
|
@ -326,7 +327,7 @@ public class JarUtils
|
||||||
* @param nodeList The loaded ClassNodes
|
* @param nodeList The loaded ClassNodes
|
||||||
* @param dir the exact jar output path
|
* @param dir the exact jar output path
|
||||||
*/
|
*/
|
||||||
public static void saveAsJarClassesOnlyToDir(ArrayList<ClassNode> nodeList, String dir) {
|
public static void saveAsJarClassesOnlyToDir(List<ClassNode> nodeList, String dir) {
|
||||||
try {
|
try {
|
||||||
for (ClassNode cn : nodeList) {
|
for (ClassNode cn : nodeList) {
|
||||||
ClassWriter cw = new ClassWriter(0);
|
ClassWriter cw = new ClassWriter(0);
|
||||||
|
@ -349,10 +350,10 @@ public class JarUtils
|
||||||
* @param nodeList The loaded ClassNodes
|
* @param nodeList The loaded ClassNodes
|
||||||
* @param path the exact jar output path
|
* @param path the exact jar output path
|
||||||
*/
|
*/
|
||||||
public static void saveAsJar(ArrayList<ClassNode> nodeList, String path) {
|
public static void saveAsJar(List<ClassNode> nodeList, String path) {
|
||||||
try (FileOutputStream fos = new FileOutputStream(path);
|
try (FileOutputStream fos = new FileOutputStream(path);
|
||||||
JarOutputStream out = new JarOutputStream(fos)) {
|
JarOutputStream out = new JarOutputStream(fos)) {
|
||||||
ArrayList<String> noDupe = new ArrayList<>();
|
List<String> noDupe = new ArrayList<>();
|
||||||
for (ClassNode cn : nodeList) {
|
for (ClassNode cn : nodeList) {
|
||||||
ClassWriter cw = new ClassWriter(0);
|
ClassWriter cw = new ClassWriter(0);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -57,7 +58,7 @@ public class MiscUtils
|
||||||
private static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
private static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
private static final Random rnd = new Random();
|
private static final Random rnd = new Random();
|
||||||
private static final HashSet<String> createdRandomizedNames = new HashSet<>();
|
private static final Set<String> createdRandomizedNames = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a random string without numbers
|
* Returns a random string without numbers
|
||||||
|
@ -189,7 +190,7 @@ public class MiscUtils
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int fileContainersHash(ArrayList<ResourceContainer> resourceContainers) {
|
public static int fileContainersHash(List<ResourceContainer> resourceContainers) {
|
||||||
StringBuilder block = new StringBuilder();
|
StringBuilder block = new StringBuilder();
|
||||||
for (ResourceContainer container : resourceContainers) {
|
for (ResourceContainer container : resourceContainers) {
|
||||||
block.append(container.name);
|
block.append(container.name);
|
||||||
|
|
Loading…
Reference in a new issue