@Override public void deOdex(DexFile parentFile, Method method, ClassPath cp) { if (!(parentFile instanceof DexBackedOdexFile)) { throw new RuntimeException("ODEX instruction in non-ODEX file"); } DexBackedOdexFile odexFile = (DexBackedOdexFile) parentFile; InlineMethodResolver inlineMethodResolver = InlineMethodResolver.createInlineMethodResolver(odexFile.getOdexVersion()); MethodAnalyzer analyzer = new MethodAnalyzer(cp, method, inlineMethodResolver, false); targetMethod = inlineMethodResolver.resolveExecuteInline(new AnalyzedInstruction(analyzer, instruction, -1, -1)); }
@Override protected BaksmaliOptions getOptions() { BaksmaliOptions options = super.getOptions(); options.deodex = true; if (dexFile instanceof DexBackedOdexFile) { if (inlineTable == null) { options.inlineResolver = InlineMethodResolver.createInlineMethodResolver( ((DexBackedOdexFile)dexFile).getOdexVersion()); } else { File inlineTableFile = new File(inlineTable); if (!inlineTableFile.exists()) { System.err.println(String.format("Could not find file: %s", inlineTable)); System.exit(-1); } try { options.inlineResolver = new CustomInlineMethodResolver(options.classPath, inlineTableFile); } catch (IOException ex) { System.err.println(String.format("Error while reading file: %s", inlineTableFile)); ex.printStackTrace(System.err); System.exit(-1); } } } return options; }
private void analyzeExecuteInlineRange(@Nonnull AnalyzedInstruction analyzedInstruction) { if (inlineResolver == null) { throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing"); } Instruction3rmi instruction = (Instruction3rmi)analyzedInstruction.instruction; Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction); Opcode deodexedOpcode; int acccessFlags = resolvedMethod.getAccessFlags(); if (AccessFlags.STATIC.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_STATIC_RANGE; } else if (AccessFlags.PRIVATE.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_DIRECT_RANGE; } else { deodexedOpcode = Opcode.INVOKE_VIRTUAL_RANGE; } Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(deodexedOpcode, instruction.getStartRegister(), instruction.getRegisterCount(), resolvedMethod); analyzedInstruction.setDeodexedInstruction(deodexedInstruction); analyzeInstruction(analyzedInstruction); }
InlineMethodResolver.createInlineMethodResolver(((DexBackedOdexFile)dexFile).getOdexVersion());
private void analyzeExecuteInline(@Nonnull AnalyzedInstruction analyzedInstruction) { if (inlineResolver == null) { throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing"); } Instruction35mi instruction = (Instruction35mi)analyzedInstruction.instruction; Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction); Opcode deodexedOpcode; int acccessFlags = resolvedMethod.getAccessFlags(); if (AccessFlags.STATIC.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_STATIC; } else if (AccessFlags.PRIVATE.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_DIRECT; } else { deodexedOpcode = Opcode.INVOKE_VIRTUAL; } Instruction35c deodexedInstruction = new ImmutableInstruction35c(deodexedOpcode, instruction.getRegisterCount(), instruction.getRegisterC(), instruction.getRegisterD(), instruction.getRegisterE(), instruction.getRegisterF(), instruction.getRegisterG(), resolvedMethod); analyzedInstruction.setDeodexedInstruction(deodexedInstruction); analyzeInstruction(analyzedInstruction); }
@Override protected BaksmaliOptions getOptions() { BaksmaliOptions options = super.getOptions(); options.deodex = true; if (dexFile instanceof DexBackedOdexFile) { if (inlineTable == null) { options.inlineResolver = InlineMethodResolver.createInlineMethodResolver( ((DexBackedOdexFile)dexFile).getOdexVersion()); } else { File inlineTableFile = new File(inlineTable); if (!inlineTableFile.exists()) { System.err.println(String.format("Could not find file: %s", inlineTable)); System.exit(-1); } try { options.inlineResolver = new CustomInlineMethodResolver(options.classPath, inlineTableFile); } catch (IOException ex) { System.err.println(String.format("Error while reading file: %s", inlineTableFile)); ex.printStackTrace(System.err); System.exit(-1); } } } return options; }
private void analyzeExecuteInlineRange(@Nonnull AnalyzedInstruction analyzedInstruction) { if (inlineResolver == null) { throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing"); } Instruction3rmi instruction = (Instruction3rmi)analyzedInstruction.instruction; Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction); Opcode deodexedOpcode; int acccessFlags = resolvedMethod.getAccessFlags(); if (AccessFlags.STATIC.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_STATIC_RANGE; } else if (AccessFlags.PRIVATE.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_DIRECT_RANGE; } else { deodexedOpcode = Opcode.INVOKE_VIRTUAL_RANGE; } Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(deodexedOpcode, instruction.getStartRegister(), instruction.getRegisterCount(), resolvedMethod); analyzedInstruction.setDeodexedInstruction(deodexedInstruction); analyzeInstruction(analyzedInstruction); }
InlineMethodResolver.createInlineMethodResolver(((DexBackedOdexFile)dexFile).getOdexVersion());
private void analyzeExecuteInlineRange(@Nonnull AnalyzedInstruction analyzedInstruction) { if (inlineResolver == null) { throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing"); } Instruction3rmi instruction = (Instruction3rmi)analyzedInstruction.instruction; Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction); Opcode deodexedOpcode; int acccessFlags = resolvedMethod.getAccessFlags(); if (AccessFlags.STATIC.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_STATIC_RANGE; } else if (AccessFlags.PRIVATE.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_DIRECT_RANGE; } else { deodexedOpcode = Opcode.INVOKE_VIRTUAL_RANGE; } Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(deodexedOpcode, instruction.getStartRegister(), instruction.getRegisterCount(), resolvedMethod); analyzedInstruction.setDeodexedInstruction(deodexedInstruction); analyzeInstruction(analyzedInstruction); }
private void analyzeExecuteInline(@Nonnull AnalyzedInstruction analyzedInstruction) { if (inlineResolver == null) { throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing"); } Instruction35mi instruction = (Instruction35mi)analyzedInstruction.instruction; Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction); Opcode deodexedOpcode; int acccessFlags = resolvedMethod.getAccessFlags(); if (AccessFlags.STATIC.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_STATIC; } else if (AccessFlags.PRIVATE.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_DIRECT; } else { deodexedOpcode = Opcode.INVOKE_VIRTUAL; } Instruction35c deodexedInstruction = new ImmutableInstruction35c(deodexedOpcode, instruction.getRegisterCount(), instruction.getRegisterC(), instruction.getRegisterD(), instruction.getRegisterE(), instruction.getRegisterF(), instruction.getRegisterG(), resolvedMethod); analyzedInstruction.setDeodexedInstruction(deodexedInstruction); analyzeInstruction(analyzedInstruction); }
private void analyzeExecuteInline(@Nonnull AnalyzedInstruction analyzedInstruction) { if (inlineResolver == null) { throw new AnalysisException("Cannot analyze an odexed instruction unless we are deodexing"); } Instruction35mi instruction = (Instruction35mi)analyzedInstruction.instruction; Method resolvedMethod = inlineResolver.resolveExecuteInline(analyzedInstruction); Opcode deodexedOpcode; int acccessFlags = resolvedMethod.getAccessFlags(); if (AccessFlags.STATIC.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_STATIC; } else if (AccessFlags.PRIVATE.isSet(acccessFlags)) { deodexedOpcode = Opcode.INVOKE_DIRECT; } else { deodexedOpcode = Opcode.INVOKE_VIRTUAL; } Instruction35c deodexedInstruction = new ImmutableInstruction35c(deodexedOpcode, instruction.getRegisterCount(), instruction.getRegisterC(), instruction.getRegisterD(), instruction.getRegisterE(), instruction.getRegisterF(), instruction.getRegisterG(), resolvedMethod); analyzedInstruction.setDeodexedInstruction(deodexedInstruction); analyzeInstruction(analyzedInstruction); }