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.dexClassIndex()
), 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 StmtVisitor |
buildStmtVisitor(SootMethod belongingMethod,
DexArrayInitDetector arrayInitDetector)
Creates a statement visitor to build code for each statement.
|
protected MultiDexBuilder |
createDexBuilder()
Creates the
MultiDexBuilder that shall be used for creating potentially multiple dex files. |
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 static org.jf.dexlib2.iface.reference.MethodReference |
toMethodReference(SootMethodRef m) |
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.MultiDexBuilder
protected 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 void writeMemberClasses(SootClass c, Set<String> skipList, Set<org.jf.dexlib2.iface.Annotation> annotations)
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 tagspublic void add(SootClass c)
public void print()
Copyright © 2020 Sable. All rights reserved.