Search in sources :

Example 6 with DexNode

use of jadx.core.dex.nodes.DexNode in project jadx by skylot.

the class Deobfuscator method process.

private void process() {
    preProcess();
    if (DEBUG) {
        dumpAlias();
    }
    for (DexNode dexNode : dexNodes) {
        for (ClassNode cls : dexNode.getClasses()) {
            processClass(dexNode, cls);
        }
    }
    postProcess();
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) DexNode(jadx.core.dex.nodes.DexNode)

Example 7 with DexNode

use of jadx.core.dex.nodes.DexNode in project jadx by skylot.

the class FinishTypeInference method visit.

@Override
public void visit(MethodNode mth) {
    if (mth.isNoCode()) {
        return;
    }
    boolean change;
    int i = 0;
    do {
        change = false;
        for (BlockNode block : mth.getBasicBlocks()) {
            for (InsnNode insn : block.getInstructions()) {
                if (PostTypeInference.process(mth, insn)) {
                    change = true;
                }
            }
        }
        i++;
        if (i > 1000) {
            break;
        }
    } while (change);
    // last chance to set correct value (just use first type from 'possible' list)
    DexNode dex = mth.dex();
    for (BlockNode block : mth.getBasicBlocks()) {
        for (InsnNode insn : block.getInstructions()) {
            SelectTypeVisitor.visit(dex, insn);
        }
    }
    // check
    for (BlockNode block : mth.getBasicBlocks()) {
        for (InsnNode insn : block.getInstructions()) {
            CheckTypeVisitor.visit(mth, insn);
        }
    }
}
Also used : BlockNode(jadx.core.dex.nodes.BlockNode) InsnNode(jadx.core.dex.nodes.InsnNode) DexNode(jadx.core.dex.nodes.DexNode)

Example 8 with DexNode

use of jadx.core.dex.nodes.DexNode in project jadx by skylot.

the class TypeInference method visit.

@Override
public void visit(MethodNode mth) throws JadxException {
    if (mth.isNoCode()) {
        return;
    }
    DexNode dex = mth.dex();
    for (SSAVar var : mth.getSVars()) {
        // inference variable type
        ArgType type = processType(dex, var);
        if (type == null) {
            type = ArgType.UNKNOWN;
        }
        var.setType(type);
        // search variable name
        String name = processVarName(var);
        var.setName(name);
    }
    // fix type for vars used only in Phi nodes
    for (SSAVar sVar : mth.getSVars()) {
        PhiInsn phi = sVar.getUsedInPhi();
        if (phi != null) {
            processPhiNode(phi);
        }
    }
}
Also used : ArgType(jadx.core.dex.instructions.args.ArgType) SSAVar(jadx.core.dex.instructions.args.SSAVar) PhiInsn(jadx.core.dex.instructions.PhiInsn) DexNode(jadx.core.dex.nodes.DexNode)

Example 9 with DexNode

use of jadx.core.dex.nodes.DexNode in project jadx by skylot.

the class ExportGradleProject method skipGeneratedClasses.

private void skipGeneratedClasses() {
    for (DexNode dexNode : root.getDexNodes()) {
        List<ClassNode> classes = dexNode.getClasses();
        for (ClassNode cls : classes) {
            String shortName = cls.getClassInfo().getShortName();
            if (IGNORE_CLS_NAMES.contains(shortName)) {
                cls.add(AFlag.DONT_GENERATE);
                LOG.debug("Skip class: {}", cls);
            }
        }
    }
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) DexNode(jadx.core.dex.nodes.DexNode)

Aggregations

DexNode (jadx.core.dex.nodes.DexNode)9 ClassNode (jadx.core.dex.nodes.ClassNode)5 ArgType (jadx.core.dex.instructions.args.ArgType)3 IndexInsnNode (jadx.core.dex.instructions.IndexInsnNode)2 InvokeNode (jadx.core.dex.instructions.InvokeNode)2 InsnArg (jadx.core.dex.instructions.args.InsnArg)2 ClassInfo (jadx.core.dex.info.ClassInfo)1 MethodInfo (jadx.core.dex.info.MethodInfo)1 PhiInsn (jadx.core.dex.instructions.PhiInsn)1 LiteralArg (jadx.core.dex.instructions.args.LiteralArg)1 RegisterArg (jadx.core.dex.instructions.args.RegisterArg)1 SSAVar (jadx.core.dex.instructions.args.SSAVar)1 BlockNode (jadx.core.dex.nodes.BlockNode)1 FieldNode (jadx.core.dex.nodes.FieldNode)1 InsnNode (jadx.core.dex.nodes.InsnNode)1 MethodNode (jadx.core.dex.nodes.MethodNode)1 ResRefField (jadx.core.dex.nodes.ResRefField)1 List (java.util.List)1 Nullable (org.jetbrains.annotations.Nullable)1