2.0.1
11/7/2014 - Fixed the search function. 11/7/2014 - Removed an unused package containing some unused classes.
This commit is contained in:
parent
132d8e678f
commit
28a187a7cd
BIN
BytecodeViewer 2.0.1.jar
Normal file
BIN
BytecodeViewer 2.0.1.jar
Normal file
Binary file not shown.
|
@ -148,3 +148,6 @@ Changelog:
|
|||
11/5/2014 - Kinda added middle mouse button closes tab (only if you click the exit button).
|
||||
11/5/2014 - Improved the Malicious Code Scanner, also made it instant.
|
||||
11/5/2014 - Added icons to the program (cheers Fluke).
|
||||
--- 2.0.1 ---:
|
||||
11/7/2014 - Fixed the search function.
|
||||
11/7/2014 - Removed an unused package containing some unused classes.
|
|
@ -176,6 +176,9 @@ import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
|
|||
* 11/5/2014 - Kinda added middle mouse button closes tab (only if you click the exit button).
|
||||
* 11/5/2014 - Improved the Malicious Code Scanner, also made it instant.
|
||||
* 11/5/2014 - Added icons to the program (cheers Fluke).
|
||||
* ----2.0.1-----:
|
||||
* 11/7/2014 - Fixed the search function.
|
||||
* 11/7/2014 - Removed an unused package containing some unused classes.
|
||||
*
|
||||
* @author Konloch
|
||||
*
|
||||
|
@ -196,7 +199,7 @@ public class BytecodeViewer {
|
|||
private static ArrayList<String> recentFiles = DiskReader.loadArrayList(filesName, false);
|
||||
private static ArrayList<String> recentPlugins = DiskReader.loadArrayList(pluginsName, false);
|
||||
|
||||
public static String version = "2.0";
|
||||
public static String version = "2.0.1";
|
||||
|
||||
public static void main(String[] args) {
|
||||
iconList = new ArrayList<BufferedImage>();
|
||||
|
|
|
@ -154,6 +154,13 @@ public class ClassViewer extends JPanel {
|
|||
|
||||
if(next) {
|
||||
for(String s : test) {
|
||||
if(pane == 0 && !byteCheck.isSelected() ||
|
||||
pane == 1 && !decompCheck.isSelected())
|
||||
{
|
||||
s = s.toLowerCase();
|
||||
search = search.toLowerCase();
|
||||
}
|
||||
|
||||
if(currentLine == startLine) {
|
||||
canSearch = true;
|
||||
} else if(s.contains(search)) {
|
||||
|
|
|
@ -1,489 +0,0 @@
|
|||
package the.bytecode.club.bytecodeviewer.searching.commons;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class containing bytecode search conditions and couple of helper methods to make them
|
||||
*
|
||||
* @author Waterwolf
|
||||
*
|
||||
**/
|
||||
public class AnalyzerFactory implements Opcodes {
|
||||
public static InsnAnalyzer makeOpcodeCond(final int opcode) {
|
||||
return new InsnAnalyzer() {
|
||||
@Override
|
||||
public boolean accept(final AbstractInsnNode node) {
|
||||
return node.getOpcode() == opcode;
|
||||
}
|
||||
};
|
||||
}
|
||||
public static InsnAnalyzer makeFieldCond(final int opcode,
|
||||
final String type) {
|
||||
return new InsnAnalyzer() {
|
||||
@Override
|
||||
public boolean accept(final AbstractInsnNode node) {
|
||||
if (node instanceof FieldInsnNode)
|
||||
return node.getOpcode() == opcode && ((FieldInsnNode) node).desc.equals(type);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
public static InsnAnalyzer makeFieldOwnerCond(final int opcode,
|
||||
final String owner) {
|
||||
return new InsnAnalyzer() {
|
||||
@Override
|
||||
public boolean accept(final AbstractInsnNode node) {
|
||||
if (node instanceof FieldInsnNode)
|
||||
return node.getOpcode() == opcode && ((FieldInsnNode) node).owner.equals(owner);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
public static InsnAnalyzer makeFieldRegexCond(final int opcode,
|
||||
final String regex) {
|
||||
return new InsnAnalyzer() {
|
||||
@Override
|
||||
public boolean accept(final AbstractInsnNode node) {
|
||||
if (node instanceof FieldInsnNode)
|
||||
return node.getOpcode() == opcode && ((FieldInsnNode) node).desc.matches(regex);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static InsnAnalyzer makeIntCond(final int opcode,
|
||||
final int value) {
|
||||
return new InsnAnalyzer() {
|
||||
@Override
|
||||
public boolean accept(final AbstractInsnNode node) {
|
||||
if (node instanceof IntInsnNode)
|
||||
return node.getOpcode() == opcode && ((IntInsnNode) node).operand == value;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature Z.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_Z =
|
||||
makeFieldCond(GETFIELD, "Z");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature Z.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_Z =
|
||||
makeFieldCond(PUTFIELD, "Z");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature Z.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_Z =
|
||||
makeFieldCond(GETSTATIC, "Z");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature Z.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_Z =
|
||||
makeFieldCond(PUTSTATIC, "Z");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [Z.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_ZA =
|
||||
makeFieldCond(GETFIELD, "[Z");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [Z.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_ZA =
|
||||
makeFieldCond(PUTFIELD, "[Z");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [Z.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_ZA =
|
||||
makeFieldCond(GETSTATIC, "[Z");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [Z.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_ZA =
|
||||
makeFieldCond(PUTSTATIC, "[Z");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [[Z.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_ZAA =
|
||||
makeFieldCond(GETFIELD, "[[Z");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [[Z.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_ZAA =
|
||||
makeFieldCond(PUTFIELD, "[[Z");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [[Z.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_ZAA =
|
||||
makeFieldCond(GETSTATIC, "[[Z");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [[Z.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_ZAA =
|
||||
makeFieldCond(PUTSTATIC, "[[Z");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature B.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_B =
|
||||
makeFieldCond(GETFIELD, "B");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature B.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_B =
|
||||
makeFieldCond(PUTFIELD, "B");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature B.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_B =
|
||||
makeFieldCond(GETSTATIC, "B");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature B.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_B =
|
||||
makeFieldCond(PUTSTATIC, "B");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [B.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_BA =
|
||||
makeFieldCond(GETFIELD, "[B");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [B.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_BA =
|
||||
makeFieldCond(PUTFIELD, "[B");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [B.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_BA =
|
||||
makeFieldCond(GETSTATIC, "[B");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [B.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_BA =
|
||||
makeFieldCond(PUTSTATIC, "[B");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [[B.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_BAA =
|
||||
makeFieldCond(GETFIELD, "[[B");
|
||||
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [[B.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_BAA =
|
||||
makeFieldCond(PUTFIELD, "[[B");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [[B.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_BAA =
|
||||
makeFieldCond(GETSTATIC, "[[B");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [[B.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_BAA =
|
||||
makeFieldCond(PUTSTATIC, "[[B");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature C.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_C =
|
||||
makeFieldCond(GETFIELD, "C");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature C.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_C =
|
||||
makeFieldCond(PUTFIELD, "C");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature C.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_C =
|
||||
makeFieldCond(GETSTATIC, "C");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature C.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_C =
|
||||
makeFieldCond(PUTSTATIC, "C");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [C.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_CA =
|
||||
makeFieldCond(GETFIELD, "[C");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [C.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_CA =
|
||||
makeFieldCond(PUTFIELD, "[C");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [C.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_CA =
|
||||
makeFieldCond(GETSTATIC, "[C");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [C.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_CA =
|
||||
makeFieldCond(PUTSTATIC, "[C");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [[C.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_CAA =
|
||||
makeFieldCond(GETFIELD, "[[C");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [[C.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_CAA =
|
||||
makeFieldCond(PUTFIELD, "[[C");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [[C.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_CAA =
|
||||
makeFieldCond(GETSTATIC, "[[C");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [[C.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_CAA =
|
||||
makeFieldCond(PUTSTATIC, "[[C");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature S.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_S =
|
||||
makeFieldCond(GETFIELD, "S");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature S.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_S =
|
||||
makeFieldCond(PUTFIELD, "S");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature S.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_S =
|
||||
makeFieldCond(GETSTATIC, "S");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature S.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_S =
|
||||
makeFieldCond(PUTSTATIC, "S");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [S.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_SA =
|
||||
makeFieldCond(GETFIELD, "[S");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [S.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_SA =
|
||||
makeFieldCond(PUTFIELD, "[S");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [S.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_SA =
|
||||
makeFieldCond(GETSTATIC, "[S");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [S.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_SA =
|
||||
makeFieldCond(PUTSTATIC, "[S");
|
||||
|
||||
/**
|
||||
* An instruction condition for a GETFIELD instruction with signature [[S.
|
||||
*/
|
||||
public final static InsnAnalyzer GETFIELD_SAA =
|
||||
makeFieldCond(GETFIELD, "[[S");
|
||||
/**
|
||||
* An instruction condition for a PUTFIELD instruction with signature [[S.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTFIELD_SAA =
|
||||
makeFieldCond(PUTFIELD, "[[S");
|
||||
/**
|
||||
* An instruction condition for a GETSTATIC instruction with signature [[S.
|
||||
*/
|
||||
public final static InsnAnalyzer GETSTATIC_SAA =
|
||||
makeFieldCond(GETSTATIC, "[[S");
|
||||
/**
|
||||
* An instruction condition for a PUTSTATIC instruction with signature [[S.
|
||||
*/
|
||||
public final static InsnAnalyzer PUTSTATIC_SAA =
|
||||
makeFieldCond(PUTSTATIC, "[[S");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_I =
|
||||
makeFieldCond(GETFIELD, "I");
|
||||
public final static InsnAnalyzer PUTFIELD_I =
|
||||
makeFieldCond(PUTFIELD, "I");
|
||||
public final static InsnAnalyzer GETSTATIC_I =
|
||||
makeFieldCond(GETSTATIC, "I");
|
||||
public final static InsnAnalyzer PUTSTATIC_I =
|
||||
makeFieldCond(PUTSTATIC, "I");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_IA =
|
||||
makeFieldCond(GETFIELD, "[I");
|
||||
public final static InsnAnalyzer PUTFIELD_IA =
|
||||
makeFieldCond(PUTFIELD, "[I");
|
||||
public final static InsnAnalyzer GETSTATIC_IA =
|
||||
makeFieldCond(GETSTATIC, "[I");
|
||||
public final static InsnAnalyzer PUTSTATIC_IA =
|
||||
makeFieldCond(PUTSTATIC, "[I");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_IAA =
|
||||
makeFieldCond(GETFIELD, "[[I");
|
||||
public final static InsnAnalyzer PUTFIELD_IAA =
|
||||
makeFieldCond(PUTFIELD, "[[I");
|
||||
public final static InsnAnalyzer GETSTATIC_IAA =
|
||||
makeFieldCond(GETSTATIC, "[[I");
|
||||
public final static InsnAnalyzer PUTSTATIC_IAA =
|
||||
makeFieldCond(PUTSTATIC, "[[I");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_J =
|
||||
makeFieldCond(GETFIELD, "J");
|
||||
public final static InsnAnalyzer PUTFIELD_J =
|
||||
makeFieldCond(PUTFIELD, "J");
|
||||
public final static InsnAnalyzer GETSTATIC_J =
|
||||
makeFieldCond(GETSTATIC, "J");
|
||||
public final static InsnAnalyzer PUTSTATIC_J =
|
||||
makeFieldCond(PUTSTATIC, "J");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_JA =
|
||||
makeFieldCond(GETFIELD, "[J");
|
||||
public final static InsnAnalyzer PUTFIELD_JA =
|
||||
makeFieldCond(PUTFIELD, "[J");
|
||||
public final static InsnAnalyzer GETSTATIC_JA =
|
||||
makeFieldCond(GETSTATIC, "[J");
|
||||
public final static InsnAnalyzer PUTSTATIC_JA =
|
||||
makeFieldCond(PUTSTATIC, "[J");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_JAA =
|
||||
makeFieldCond(GETFIELD, "[[J");
|
||||
public final static InsnAnalyzer PUTFIELD_JAA =
|
||||
makeFieldCond(PUTFIELD, "[[J");
|
||||
public final static InsnAnalyzer GETSTATIC_JAA =
|
||||
makeFieldCond(GETSTATIC, "[[J");
|
||||
public final static InsnAnalyzer PUTSTATIC_JAA =
|
||||
makeFieldCond(PUTSTATIC, "[[J");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_F =
|
||||
makeFieldCond(GETFIELD, "F");
|
||||
public final static InsnAnalyzer PUTFIELD_F =
|
||||
makeFieldCond(PUTFIELD, "F");
|
||||
public final static InsnAnalyzer GETSTATIC_F =
|
||||
makeFieldCond(GETSTATIC, "F");
|
||||
public final static InsnAnalyzer PUTSTATIC_F =
|
||||
makeFieldCond(PUTSTATIC, "F");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_FA =
|
||||
makeFieldCond(GETFIELD, "[F");
|
||||
public final static InsnAnalyzer PUTFIELD_FA =
|
||||
makeFieldCond(PUTFIELD, "[F");
|
||||
public final static InsnAnalyzer GETSTATIC_FA =
|
||||
makeFieldCond(GETSTATIC, "[F");
|
||||
public final static InsnAnalyzer PUTSTATIC_FA =
|
||||
makeFieldCond(PUTSTATIC, "[F");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_FAA =
|
||||
makeFieldCond(GETFIELD, "[[F");
|
||||
public final static InsnAnalyzer PUTFIELD_FAA =
|
||||
makeFieldCond(PUTFIELD, "[[F");
|
||||
public final static InsnAnalyzer GETSTATIC_FAA =
|
||||
makeFieldCond(GETSTATIC, "[[F");
|
||||
public final static InsnAnalyzer PUTSTATIC_FAA =
|
||||
makeFieldCond(PUTSTATIC, "[[F");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_D =
|
||||
makeFieldCond(GETFIELD, "D");
|
||||
public final static InsnAnalyzer PUTFIELD_D =
|
||||
makeFieldCond(PUTFIELD, "D");
|
||||
public final static InsnAnalyzer GETSTATIC_D =
|
||||
makeFieldCond(GETSTATIC, "D");
|
||||
public final static InsnAnalyzer PUTSTATIC_D =
|
||||
makeFieldCond(PUTSTATIC, "D");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_DA =
|
||||
makeFieldCond(GETFIELD, "[D");
|
||||
public final static InsnAnalyzer PUTFIELD_DA =
|
||||
makeFieldCond(PUTFIELD, "[D");
|
||||
public final static InsnAnalyzer GETSTATIC_DA =
|
||||
makeFieldCond(GETSTATIC, "[D");
|
||||
public final static InsnAnalyzer PUTSTATIC_DA =
|
||||
makeFieldCond(PUTSTATIC, "[D");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_DAA =
|
||||
makeFieldCond(GETFIELD, "[[D");
|
||||
public final static InsnAnalyzer PUTFIELD_DAA =
|
||||
makeFieldCond(PUTFIELD, "[[D");
|
||||
public final static InsnAnalyzer GETSTATIC_DAA =
|
||||
makeFieldCond(GETSTATIC, "[[D");
|
||||
public final static InsnAnalyzer PUTSTATIC_DAA =
|
||||
makeFieldCond(PUTSTATIC, "[[D");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_L =
|
||||
makeFieldRegexCond(GETFIELD, "L.*;");
|
||||
public final static InsnAnalyzer PUTFIELD_L =
|
||||
makeFieldRegexCond(PUTFIELD, "L.*;");
|
||||
public final static InsnAnalyzer GETSTATIC_L =
|
||||
makeFieldRegexCond(GETSTATIC, "L.*;");
|
||||
public final static InsnAnalyzer PUTSTATIC_L =
|
||||
makeFieldRegexCond(PUTSTATIC, "L.*;");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_LA =
|
||||
makeFieldRegexCond(GETFIELD, "\\[L.*;");
|
||||
public final static InsnAnalyzer PUTFIELD_LA =
|
||||
makeFieldRegexCond(PUTFIELD, "\\[L.*;");
|
||||
public final static InsnAnalyzer GETSTATIC_LA =
|
||||
makeFieldRegexCond(GETSTATIC, "\\[L.*;");
|
||||
public final static InsnAnalyzer PUTSTATIC_LA =
|
||||
makeFieldRegexCond(PUTSTATIC, "\\[L.*;");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_LAA =
|
||||
makeFieldRegexCond(GETFIELD, "\\[\\[L.*;");
|
||||
public final static InsnAnalyzer PUTFIELD_LAA =
|
||||
makeFieldRegexCond(PUTFIELD, "\\[\\[L.*;");
|
||||
public final static InsnAnalyzer GETSTATIC_LAA =
|
||||
makeFieldRegexCond(GETSTATIC, "\\[\\[L.*;");
|
||||
public final static InsnAnalyzer PUTSTATIC_LAA =
|
||||
makeFieldRegexCond(PUTSTATIC, "\\[\\[L.*;");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_String =
|
||||
makeFieldCond(GETFIELD, "Ljava/lang/String;");
|
||||
public final static InsnAnalyzer PUTFIELD_String =
|
||||
makeFieldCond(PUTFIELD, "Ljava/lang/String;");
|
||||
public final static InsnAnalyzer GETSTATIC_String =
|
||||
makeFieldCond(GETSTATIC, "Ljava/lang/String;");
|
||||
public final static InsnAnalyzer PUTSTATIC_String =
|
||||
makeFieldCond(PUTSTATIC, "Ljava/lang/String;");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_StringA =
|
||||
makeFieldCond(GETFIELD, "[Ljava/lang/String;");
|
||||
public final static InsnAnalyzer PUTFIELD_StringA =
|
||||
makeFieldCond(PUTFIELD, "[Ljava/lang/String;");
|
||||
public final static InsnAnalyzer GETSTATIC_StringA =
|
||||
makeFieldCond(GETSTATIC, "[Ljava/lang/String;");
|
||||
public final static InsnAnalyzer PUTSTATIC_StringA =
|
||||
makeFieldCond(PUTSTATIC, "[Ljava/lang/String;");
|
||||
|
||||
public final static InsnAnalyzer GETFIELD_StringAA =
|
||||
makeFieldCond(GETFIELD, "[[Ljava/lang/String;");
|
||||
public final static InsnAnalyzer PUTFIELD_StringAA =
|
||||
makeFieldCond(PUTFIELD, "[[Ljava/lang/String;");
|
||||
public final static InsnAnalyzer GETSTATIC_StringAA =
|
||||
makeFieldCond(GETSTATIC, "[[Ljava/lang/String;");
|
||||
public final static InsnAnalyzer PUTSTATIC_StringAA =
|
||||
makeFieldCond(PUTSTATIC, "[[Ljava/lang/String;");
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package the.bytecode.club.bytecodeviewer.searching.commons;
|
||||
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* Bytecode instruction search baseclass
|
||||
*
|
||||
* @author Waterwolf
|
||||
*
|
||||
*/
|
||||
public interface InsnAnalyzer {
|
||||
public boolean accept(AbstractInsnNode node);
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
package the.bytecode.club.bytecodeviewer.searching.commons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
/**
|
||||
* Class that searches bytecode instructions using given search conditions.
|
||||
*
|
||||
* @author WaterWolf
|
||||
* @author Matthew Bovard
|
||||
*
|
||||
*/
|
||||
public class InstructionSearcher {
|
||||
private final InsnList list;
|
||||
private AbstractInsnNode current;
|
||||
|
||||
public InstructionSearcher(final MethodNode m) {
|
||||
this.list = m.instructions;
|
||||
this.current = list.getFirst();
|
||||
}
|
||||
|
||||
public AbstractInsnNode getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(final AbstractInsnNode in) {
|
||||
current = in;
|
||||
}
|
||||
|
||||
public AbstractInsnNode getNext(final int opcode) {
|
||||
return getNext(AnalyzerFactory.makeOpcodeCond(opcode));
|
||||
}
|
||||
|
||||
public AbstractInsnNode getNext(final InsnAnalyzer analyzer) {
|
||||
while (current != null) {
|
||||
if (analyzer.accept(current)) {
|
||||
final AbstractInsnNode old = current;
|
||||
current = current.getNext();
|
||||
return old;
|
||||
}
|
||||
current = current.getNext();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public AbstractInsnNode getNext() {
|
||||
if (current == null)
|
||||
return null;
|
||||
current = current.getNext();
|
||||
while (current != null && current.getOpcode() == -1) {
|
||||
current = current.getNext();
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
public AbstractInsnNode getPrevious(final InsnAnalyzer analyzer) {
|
||||
while (current != null) {
|
||||
if (analyzer.accept(current)) {
|
||||
final AbstractInsnNode old = current;
|
||||
current = current.getPrevious();
|
||||
return old;
|
||||
}
|
||||
current = current.getPrevious();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public AbstractInsnNode getPrevious(final int opcode) {
|
||||
return getPrevious(AnalyzerFactory.makeOpcodeCond(opcode));
|
||||
}
|
||||
|
||||
public AbstractInsnNode getPrevious() {
|
||||
current = current.getPrevious();
|
||||
while (current.getOpcode() == -1) {
|
||||
current = current.getPrevious();
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
public LdcInsnNode getNextLDC(final Object cst) {
|
||||
AbstractInsnNode in;
|
||||
while ((in = getNext(Opcodes.LDC)) != null) {
|
||||
final LdcInsnNode ln = (LdcInsnNode) in;
|
||||
if (ln.cst.equals(cst)) return ln;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public LdcInsnNode getPreviousLDC(final Object cst) {
|
||||
AbstractInsnNode in;
|
||||
while ((in = getPrevious(Opcodes.LDC)) != null) {
|
||||
final LdcInsnNode ln = (LdcInsnNode) in;
|
||||
if (ln.cst.equals(cst))
|
||||
return ln;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IntInsnNode getNextInt(final int opcode, final int i) {
|
||||
return (IntInsnNode) this.getNext(AnalyzerFactory.makeIntCond(opcode, i));
|
||||
}
|
||||
|
||||
public IntInsnNode getPreviousInt(final int opcode, final int i) {
|
||||
return (IntInsnNode) this.getPrevious(AnalyzerFactory.makeIntCond(opcode, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param opcode One of Opcodes.BIPUSH/Opcodes.SIPUSH
|
||||
* @param value Value to look for
|
||||
* @return
|
||||
*/
|
||||
public IntInsnNode getNextPush(final int opcode, final int value) {
|
||||
AbstractInsnNode in;
|
||||
while ((in = getNext(opcode)) != null) {
|
||||
final IntInsnNode iin = (IntInsnNode) in;
|
||||
if (iin.operand == value) return iin;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<AbstractInsnNode> analyze(final int opcode) {
|
||||
reset();
|
||||
final List<AbstractInsnNode> list = new ArrayList<AbstractInsnNode>();
|
||||
AbstractInsnNode in;
|
||||
while ((in = getNext(opcode)) != null) {
|
||||
list.add(in);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return list.indexOf(current);
|
||||
}
|
||||
|
||||
public void setIndex(final int index) {
|
||||
current = list.get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets us back to the first instruction
|
||||
*/
|
||||
public void reset() {
|
||||
current = list.getFirst();
|
||||
}
|
||||
|
||||
public void resetToEnd() {
|
||||
current = list.getLast();
|
||||
}
|
||||
|
||||
public void insert(final AbstractInsnNode location, final AbstractInsnNode insn) {
|
||||
this.list.insert(location, insn);
|
||||
}
|
||||
|
||||
public int computePosition(final AbstractInsnNode node) {
|
||||
AbstractInsnNode poller = list.getFirst();
|
||||
int index = 0;
|
||||
while ((poller = poller.getNext()) != null) {
|
||||
if (poller.equals(node))
|
||||
return index;
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user