public class DexPrinter extends Object
Creates apk or jar file with compiled dex classes. Main entry point for the "dex" output format.
Use add(SootClass) to add classes that should be printed as dex output and print() to finally print the
classes.
If the printer has found the original APK of an added class (via
SourceLocator#classContainerFileClassIndex()), the files in the APK are copied to a new one, replacing
it's classes.dex and excluding the signature files. Note that you have to sign and align the APK yourself, with
jarsigner and zipalign, respectively.
If Options.output_jar flag is set, the printer produces JAR file.
If there is no original APK and Options.output_jar flag is not set the printer just emits a
classes.dex.
| Modifier and Type | Field and Description |
|---|---|
protected MultiDexBuilder |
dexBuilder |
protected File |
originalApk |
static Pattern |
SIGNATURE_FILE_PATTERN |
| Constructor and Description |
|---|
DexPrinter() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(SootClass c) |
protected void |
addClassDefinition(org.jf.dexlib2.iface.ClassDef classDef) |
protected Set<org.jf.dexlib2.iface.Annotation> |
buildClassAnnotations(SootClass c) |
protected StmtVisitor |
buildStmtVisitor(SootMethod belongingMethod,
DexArrayInitDetector arrayInitDetector)
Creates a statement visitor to build code for each statement.
|
protected List<org.jf.dexlib2.immutable.ImmutableAnnotation> |
buildVisibilityAnnotationTag(VisibilityAnnotationTag t,
Set<String> skipList) |
protected MultiDexBuilder |
createDexBuilder()
Creates the
MultiDexBuilder that shall be used for creating potentially multiple dex files. |
protected boolean |
isIgnored(SootField sf)
Checks whether the given field shall be ignored, i.e., not written out to dex
|
protected boolean |
isIgnored(SootMethod sm)
Checks whether the given method shall be ignored, i.e., not written out to dex
|
protected org.jf.dexlib2.iface.value.EncodedValue |
makeConstantItem(SootField sf,
Tag t) |
void |
print() |
protected static org.jf.dexlib2.iface.reference.FieldReference |
toFieldReference(SootField f) |
protected static org.jf.dexlib2.iface.reference.FieldReference |
toFieldReference(SootFieldRef ref) |
protected void |
toInstructions(Collection<Unit> units,
StmtVisitor stmtV,
Set<Unit> trapReferences) |
protected org.jf.dexlib2.iface.MethodImplementation |
toMethodImplementation(SootMethod m) |
protected static org.jf.dexlib2.iface.reference.MethodReference |
toMethodReference(SootMethodRef m) |
protected Collection<org.jf.dexlib2.iface.Method> |
toMethods(SootClass clazz) |
protected void |
toTries(Collection<Trap> traps,
org.jf.dexlib2.builder.MethodImplementationBuilder builder,
LabelAssigner labelAssigner) |
static org.jf.dexlib2.iface.reference.TypeReference |
toTypeReference(Type t) |
protected void |
writeMemberClasses(SootClass c,
Set<String> skipList,
Set<org.jf.dexlib2.iface.Annotation> annotations) |
protected void |
writeTagsForStatement(org.jf.dexlib2.builder.MethodImplementationBuilder builder,
Stmt stmt)
Writes out the information stored in the tags associated with the given statement
|
public static final Pattern SIGNATURE_FILE_PATTERN
protected MultiDexBuilder dexBuilder
protected File originalApk
protected MultiDexBuilder createDexBuilder()
MultiDexBuilder that shall be used for creating potentially multiple dex files. This method makes
sure that users of Soot can overwrite the MultiDexBuilder with custom strategies.MultiDexBuilderprotected static org.jf.dexlib2.iface.reference.FieldReference toFieldReference(SootField f)
protected static org.jf.dexlib2.iface.reference.FieldReference toFieldReference(SootFieldRef ref)
protected static org.jf.dexlib2.iface.reference.MethodReference toMethodReference(SootMethodRef m)
public static org.jf.dexlib2.iface.reference.TypeReference toTypeReference(Type t)
protected org.jf.dexlib2.iface.value.EncodedValue makeConstantItem(SootField sf, Tag t)
protected void addClassDefinition(org.jf.dexlib2.iface.ClassDef classDef)
protected Set<org.jf.dexlib2.iface.Annotation> buildClassAnnotations(SootClass c)
protected void writeMemberClasses(SootClass c, Set<String> skipList, Set<org.jf.dexlib2.iface.Annotation> annotations)
protected List<org.jf.dexlib2.immutable.ImmutableAnnotation> buildVisibilityAnnotationTag(VisibilityAnnotationTag t, Set<String> skipList)
protected Collection<org.jf.dexlib2.iface.Method> toMethods(SootClass clazz)
protected boolean isIgnored(SootMethod sm)
sm - The method to checkprotected boolean isIgnored(SootField sf)
sf - The field to checkprotected org.jf.dexlib2.iface.MethodImplementation toMethodImplementation(SootMethod m)
protected StmtVisitor buildStmtVisitor(SootMethod belongingMethod, DexArrayInitDetector arrayInitDetector)
belongingMethod - the methodarrayInitDetector - auxilliary class for detecting array initializationsprotected void writeTagsForStatement(org.jf.dexlib2.builder.MethodImplementationBuilder builder,
Stmt stmt)
builder - The builder used to generate the Dalvik method implementationstmt - The statement for which to write out the tagsprotected void toInstructions(Collection<Unit> units, StmtVisitor stmtV, Set<Unit> trapReferences)
protected void toTries(Collection<Trap> traps, org.jf.dexlib2.builder.MethodImplementationBuilder builder, LabelAssigner labelAssigner)
public void add(SootClass c)
public void print()
Copyright © 2024 Soot OSS. All rights reserved.