use of com.google.classyshark.silverghost.translator.Translator 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.translator.Translator in project android-classyshark by google.
the class SilverGhostFacade method inspectApk.
public static void inspectApk(List<String> args) {
if (!new File(args.get(1)).getName().endsWith(".apk")) {
System.err.println("Not an apk file ==> " + "java -jar ClassyShark.jar " + "-inspect APK_FILE");
return;
}
Translator translator = new ApkTranslator(new File(args.get(1)));
translator.apply();
System.out.print(translator);
}
use of com.google.classyshark.silverghost.translator.Translator in project android-classyshark by google.
the class SilverGhostFacade method exportClassFromApk.
public static void exportClassFromApk(List<String> args) {
File apk = new File(args.get(1));
String className = args.get(2);
Translator translator = TranslatorFactory.createTranslator(className, apk, getAllClassNames(apk));
try {
translator.apply();
} catch (NullPointerException npe) {
System.err.println("Class doesn't exist in the writeArchive");
return;
}
try {
Exporter.writeCurrentClass(translator.getClassName(), translator.toString());
} catch (Exception e) {
System.err.println("Internal error - couldn't write file");
}
}
use of com.google.classyshark.silverghost.translator.Translator in project android-classyshark by google.
the class Exporter method writeManifest.
public static void writeManifest(File apk) throws IOException {
if (apk.getName().endsWith(".apk")) {
Translator translator = TranslatorFactory.createTranslator("AndroidManifest.xml", apk);
translator.apply();
writeString(translator.getClassName() + "_dump", translator.toString());
}
}
use of com.google.classyshark.silverghost.translator.Translator in project android-classyshark by google.
the class JavaTranslator method testInnerClass.
public static void testInnerClass() {
final File testFile = new File(System.getProperty("user.home") + "/Desktop/Scenarios/2 Class/Reducer$1.class");
String textClass = "com.google.classyshark.gui.panel.reducer.Reducer$1.class";
Translator translator = TranslatorFactory.createTranslator(textClass, testFile);
translator.apply();
System.out.println(translator.toString());
}
Aggregations