hylander0/Iteedee.ApkReader

UTF8 Chars, Manifests with text nodes and nested namespaces

Closed this issue · 6 comments

Hello,

i used this library to parse a lot of APKs. There are two major problem.

First UTF 8 characters in the ressources. The Binary Reader ReadChar() Method is not appropriate for a bunch of APKs. To fix this i used The ReadBytes and System.Encoding Package to parse the Ressources.

Second. The Manifest Parsing fail for Manifests with Text nodes and nested "namespaces".

    public static int endDocTag = 0x00100101;
    public static int startTag = 0x00100102;
    public static int endTag = 0x00100103;

These Tags are not enough. There is a Textnode Tag 0x00100104. And The endDoc Tag may occure multible times. Each endDocTag has a startTag 0x00100100. My workaround is:

else if(tag0 == startDocTag)
{
counter++;
off += 4;
}
else if(tag 0 == endDocTag)
{
if(counter == 0) { break; }
counter --;
off += 4;
}

Now i am able to parse all apks.

@werjo Thank you for finding this issue and providing a solution for it. If you have a commit available please send me a pull request and I will merge the changes in. Be sure to update the Contributors with your information if you would like.

Thanks,

Justin

@werjo can you show what the code would look like or submit a pull request ? It would be greatly appreciated.

kkguo commented

those changes are in my pull request, except the multiple startTag - endTags

kkguo commented

looks like it's not hard to add.. committed

Per @kkguo comment I am closing this issue

I got an error while reading apk files below.. please help me to get rid out this issue.

Wrong Local header signature: 0x383