Search in sources :

Example 1 with InputFile

use of jadx.core.utils.files.InputFile in project jadx by skylot.

the class RenameVisitor method init.

@Override
public void init(RootNode root) {
    IJadxArgs args = root.getArgs();
    InputFile firstInputFile = root.getDexNodes().get(0).getDexFile().getInputFile();
    final String firstInputFileName = firstInputFile.getFile().getAbsolutePath();
    final String inputPath = FilenameUtils.getFullPathNoEndSeparator(firstInputFileName);
    final String inputName = FilenameUtils.getBaseName(firstInputFileName);
    File deobfMapFile = new File(inputPath, inputName + ".jobf");
    deobfuscator = new Deobfuscator(args, root.getDexNodes(), deobfMapFile);
    boolean deobfuscationOn = args.isDeobfuscationOn();
    if (deobfuscationOn) {
        deobfuscator.execute();
    }
    checkClasses(root);
}
Also used : IJadxArgs(jadx.api.IJadxArgs) InputFile(jadx.core.utils.files.InputFile) File(java.io.File) Deobfuscator(jadx.core.deobf.Deobfuscator) InputFile(jadx.core.utils.files.InputFile)

Example 2 with InputFile

use of jadx.core.utils.files.InputFile in project jadx by skylot.

the class ConvertToClsSet method main.

public static void main(String[] args) throws IOException, DecodeException {
    if (args.length < 2) {
        usage();
        System.exit(1);
    }
    File output = new File(args[0]);
    List<InputFile> inputFiles = new ArrayList<InputFile>(args.length - 1);
    for (int i = 1; i < args.length; i++) {
        File f = new File(args[i]);
        if (f.isDirectory()) {
            addFilesFromDirectory(f, inputFiles);
        } else {
            InputFile.addFilesFrom(f, inputFiles);
        }
    }
    for (InputFile inputFile : inputFiles) {
        LOG.info("Loaded: {}", inputFile.getFile());
    }
    RootNode root = new RootNode(new JadxArgs());
    root.load(inputFiles);
    ClsSet set = new ClsSet();
    set.load(root);
    set.save(output);
    LOG.info("Output: {}", output);
    LOG.info("done");
}
Also used : RootNode(jadx.core.dex.nodes.RootNode) ArrayList(java.util.ArrayList) JadxArgs(jadx.api.JadxArgs) InputFile(jadx.core.utils.files.InputFile) File(java.io.File) InputFile(jadx.core.utils.files.InputFile)

Example 3 with InputFile

use of jadx.core.utils.files.InputFile in project jadx by skylot.

the class RootNode method load.

public void load(List<InputFile> inputFiles) throws DecodeException {
    dexNodes = new ArrayList<DexNode>();
    for (InputFile input : inputFiles) {
        for (DexFile dexFile : input.getDexFiles()) {
            try {
                LOG.debug("Load: {}", dexFile);
                DexNode dexNode = new DexNode(this, dexFile);
                dexNodes.add(dexNode);
            } catch (Exception e) {
                throw new DecodeException("Error decode file: " + dexFile, e);
            }
        }
    }
    for (DexNode dexNode : dexNodes) {
        dexNode.loadClasses();
    }
    initInnerClasses();
}
Also used : DecodeException(jadx.core.utils.exceptions.DecodeException) DexFile(jadx.core.utils.files.DexFile) JadxException(jadx.core.utils.exceptions.JadxException) IOException(java.io.IOException) DecodeException(jadx.core.utils.exceptions.DecodeException) InputFile(jadx.core.utils.files.InputFile)

Aggregations

InputFile (jadx.core.utils.files.InputFile)3 File (java.io.File)2 IJadxArgs (jadx.api.IJadxArgs)1 JadxArgs (jadx.api.JadxArgs)1 Deobfuscator (jadx.core.deobf.Deobfuscator)1 RootNode (jadx.core.dex.nodes.RootNode)1 DecodeException (jadx.core.utils.exceptions.DecodeException)1 JadxException (jadx.core.utils.exceptions.JadxException)1 DexFile (jadx.core.utils.files.DexFile)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1