Skip to content

Android package reader (apk), Davlik file reader (dex), Android xml file reader (xml), Android resource file reader (arsc)

Notifications You must be signed in to change notification settings

rgroenewoudt/ApkReader

 
 

Repository files navigation

Apk reader

Nuget

Android package file reader assembly. Can read apk files, android xml files (AndroidManifes.xml, *.xml), Dalvik executable format (dex), android resource files (arsc).

Usage:

using(ApkFile apk = new ApkFile(filePath))
{
    if(apk.IsValid)
    {
        If(apk.AndroidManifest!=null)
        {//AndroidManifest.xml
            Console.WriteLine("Package: {0}", apk.AndroidManifest.Package);
            Console.WriteLine("Application name: {0} ({1})", apk.AndroidManifest.Application.Label, apk.AndroidManifest.VersionName);
            //...
        }

        if(apk.Resources!=null)
        {//resources.arsc
            //...
        }

        foreach(String filePath in apk.GetHeaderFiles())
            if(Path.GetExtension(filePath).ToLowerInvariant()==".dex")
                using(DexFile dex=new DexFile(new StreamLoader(apk.GetFileStream(filePath))))
                {//Davlik executables
                    //...
                }
    }
}

Supported structures:

  • ApkFile.cs
    • XmlFile — AndroidManifest.xml
    • Resources — resources.arsc
    • AndroidManifest — Stronly typled android manifest file
  • ArscFile.cs (resources.arsc)
    • Header — Resource file header
    • ResourceMap — Resource table (id,value(s))
  • AxmlFile.cs (https://developer.android.com/guide/topics/manifest/manifest-intro)
    • Strongly typed manifest sections mapped to resources.arsc file where needed
  • DexFile.cs (https://source.android.com/devices/tech/dalvik/dex-format)
    • map_list — This is a list of the entire contents of a file, in order.
    • STRING_ID_ITEM — String identifiers list.
    • STRING_DATA_ITEM — String identifiers list.
    • CODE_ITEM — Source bytecode payload
    • TYPE_ID_ITEM — Type identifiers list.
    • TYPE_LIST — Referenced from Class definitions list and method prototype identifiers list.
    • PROTO_ID_ITEM — Method prototype identifiers list
    • FIELD_ID_ITEM — Field identifiers list
    • METHOD_ID_ITEM — Method identifiers list
    • CLASS_DATA_ITEM — Class structure list
    • encoded_field — Static and instance fields from the class_data_item
    • encoded_method — Class method definition list
    • CLASS_DEF_ITEM — Class definitions list
    • try_item — in the code exceptions are caught and how to handle them
    • encoded_catch_handler_list — Catch handler lists
    • encoded_type_addr_pair — One for each caught type, in the order that the types should be tested

About

Android package reader (apk), Davlik file reader (dex), Android xml file reader (xml), Android resource file reader (arsc)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 66.0%
  • CSS 17.4%
  • HTML 16.6%