Search in sources :

Example 6 with Translator

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);
}
Also used : Translator(com.google.classyshark.silverghost.translator.Translator) ContentReader(com.google.classyshark.silverghost.contentreader.ContentReader) Reducer(com.google.classyshark.gui.panel.reducer.Reducer)

Example 7 with Translator

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);
}
Also used : ApkTranslator(com.google.classyshark.silverghost.translator.apk.ApkTranslator) Translator(com.google.classyshark.silverghost.translator.Translator) ApkTranslator(com.google.classyshark.silverghost.translator.apk.ApkTranslator) File(java.io.File)

Example 8 with 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");
    }
}
Also used : Translator(com.google.classyshark.silverghost.translator.Translator) ApkTranslator(com.google.classyshark.silverghost.translator.apk.ApkTranslator) File(java.io.File)

Example 9 with Translator

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());
    }
}
Also used : Translator(com.google.classyshark.silverghost.translator.Translator)

Example 10 with Translator

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());
}
Also used : Translator(com.google.classyshark.silverghost.translator.Translator) File(java.io.File)

Aggregations

Translator (com.google.classyshark.silverghost.translator.Translator)14 File (java.io.File)8 ApkTranslator (com.google.classyshark.silverghost.translator.apk.ApkTranslator)4 DexFile (org.jf.dexlib2.iface.DexFile)2 Reducer (com.google.classyshark.gui.panel.reducer.Reducer)1 ContentReader (com.google.classyshark.silverghost.contentreader.ContentReader)1 JavaTranslator (com.google.classyshark.silverghost.translator.java.JavaTranslator)1 JFrame (javax.swing.JFrame)1 ClassDef (org.jf.dexlib2.iface.ClassDef)1