Search in sources :

Example 1 with SearchableString

use of the.bytecode.club.bytecodeviewer.malwarescanner.util.SearchableString in project bytecode-viewer by Konloch.

the class MalwareCodeScanner method scanMethods.

@Override
public void scanMethods(MalwareScan scan, ClassNode cn, MethodNode[] methods) {
    for (MethodNode method : methods) {
        InsnList instructionList = method.instructions;
        // scan each instruction
        for (AbstractInsnNode instruction : instructionList.toArray()) {
            scanMethodInstruction(scan, cn, method, instruction);
            if (instruction instanceof LdcInsnNode) {
                if (((LdcInsnNode) instruction).cst instanceof String) {
                    final String string = (String) ((LdcInsnNode) instruction).cst;
                    scanMethodString(scan, cn, method, new SearchableString(string));
                }
            }
        }
    }
}
Also used : LdcInsnNode(org.objectweb.asm.tree.LdcInsnNode) MethodNode(org.objectweb.asm.tree.MethodNode) SearchableString(the.bytecode.club.bytecodeviewer.malwarescanner.util.SearchableString) InsnList(org.objectweb.asm.tree.InsnList) AbstractInsnNode(org.objectweb.asm.tree.AbstractInsnNode) SearchableString(the.bytecode.club.bytecodeviewer.malwarescanner.util.SearchableString)

Aggregations

AbstractInsnNode (org.objectweb.asm.tree.AbstractInsnNode)1 InsnList (org.objectweb.asm.tree.InsnList)1 LdcInsnNode (org.objectweb.asm.tree.LdcInsnNode)1 MethodNode (org.objectweb.asm.tree.MethodNode)1 SearchableString (the.bytecode.club.bytecodeviewer.malwarescanner.util.SearchableString)1