use of com.google.classyshark.silverghost.contentreader.ContentReader in project android-classyshark by google.
the class SilverGhost method readContents.
// 1. READ CONTENTS
public void readContents() {
contentReader = new ContentReader(getBinaryArchive());
long start = System.currentTimeMillis();
contentReader.load();
reducer = new Reducer(contentReader.getAllClassNames());
System.out.println("Archive Reading " + (System.currentTimeMillis() - start) + " ms ");
if (binaryArchive.getName().endsWith(".apk")) {
Translator translator = TranslatorFactory.createTranslator("AndroidManifest.xml", binaryArchive);
translator.apply();
manifestStr = translator.toString();
}
fullArchiveReader.readAsyncArchive(binaryArchive);
}
use of com.google.classyshark.silverghost.contentreader.ContentReader in project android-classyshark by google.
the class SilverGhostFacade method isMultiDex.
/**
* returns true if the apk is multidex
*
* @param archiveFile
* @return
*/
public static boolean isMultiDex(File archiveFile) {
ContentReader contentReader = new ContentReader(archiveFile);
contentReader.load();
List<String> allClassNames = contentReader.getAllClassNames();
int numDexes = 0;
for (String classEntry : allClassNames) {
if (classEntry.endsWith(".dex")) {
numDexes++;
// 2 dexes or more + optimization
if (numDexes == 2) {
return true;
}
}
}
return false;
}
use of com.google.classyshark.silverghost.contentreader.ContentReader in project android-classyshark by google.
the class SilverGhostFacade method isCustomMultiDex.
/**
* returns true if the apk is custom dex loading multidex
*
* @param archiveFile
* @return
*/
public static boolean isCustomMultiDex(File archiveFile) {
if (!isMultiDex(archiveFile)) {
return false;
}
ContentReader contentReader = new ContentReader(archiveFile);
contentReader.load();
List<String> allClassNames = contentReader.getAllClassNames();
List<String> allDexNames = new LinkedList<>();
for (String classEntry : allClassNames) {
if (classEntry.endsWith(".dex")) {
allDexNames.add(classEntry);
}
}
if (allClassNames.contains("classes1.dex")) {
return true;
}
for (String classEntry : allDexNames) {
if (!classEntry.startsWith("classes")) {
return true;
}
}
return false;
}
use of com.google.classyshark.silverghost.contentreader.ContentReader in project android-classyshark by google.
the class Exporter method main.
public static void main(String[] args) throws Exception {
String allAndroid = System.getProperty("user.home") + "/Desktop/Scenarios/2 Samples/android.jar";
ContentReader loader = new ContentReader(new File(allAndroid));
loader.load();
writeClassNames(loader.getAllClassNames());
}
use of com.google.classyshark.silverghost.contentreader.ContentReader in project android-classyshark by google.
the class SilverGhostFacade method getAllClassNames.
public static List<String> getAllClassNames(File archiveFile) {
ContentReader loader = new ContentReader(archiveFile);
loader.load();
return loader.getAllClassNames();
}
Aggregations