Giter VIP home page Giter VIP logo

apk-parser's Introduction

A pure java apk parser, to read encoded xml file and get apk infos, with no need for appt/dexdump binarys.

Fuctions

For now, the following is (partially) supported:

  • resource table by ResourceTableParser
  • binary xml file by BinaryXmlParser
  • dex file by DexParser
  • certificate by CetificateParser

Dev

If maven is used, you can add dependency:

        <dependency>
            <groupId>net.dongliu.apk-parser</groupId>
            <artifactId>apk-parser</artifactId>
            <version>1.3.0</version>
        </dependency>

to your pom file.

The easiest way is to use the ApkParser class, which contains convenient mehods to get AndroidManifest.xml, apk meta infos, etc.

ApkParser apkParser = new ApkParser(new File(filePath));
if (locale != null) {
    // set a locale to translate resource tag into specific strings in language the locale specified
    apkParser.setPreferredLocale(locale);
}

String xml = apkParser.getManifestXml();
System.out.println(xml);
ApkMeta apkMeta = apkParser.getApkMeta();
System.out.println(apkMeta);
Set<Locale> locales = apkParser.getLocales();
for (Locale l : locales) {
    System.out.println(l);
}
apkParser.close();

The apk-parser set locale to null and do not translate resource tag in default. If you want a specific resource string, for example, you want apk title 'WeChat' instead of '@string/app_name', just set the preferred Locale:

apkParser.setPreferredLocale(Locale.ENGLISH);

This paramerter work for getApkMeta, getManifestXml, and other binary xmls.Apk may contains multi languages, apk parser will find best match languages with locale you specified.

Command-line use

Run

mvn assembly:assembly

to get all-in-one excuteable jar.

Usages:

java -jar apk-parser-all.jar -l en_US -t manifest [apkfile]     # get apk manifest file as text xml
java -jar apk-parser-all.jar -l en_US -t info [apkfile]         # get apk basic infos

Use java -jar apk-parser-all.jar -h to see more options.

apk-parser's People

Contributors

broqdev avatar hsiafan avatar

Watchers

 avatar  avatar

Forkers

bincker

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.