Giter VIP home page Giter VIP logo

iteedee.apkreader's People

Contributors

dependabot[bot] avatar esugmbh avatar grecorom1 avatar hylander0 avatar kkguo avatar mennan avatar vassav avatar yunheli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iteedee.apkreader's Issues

Error with hexadecimal

The '.' character, hexadecimal value 0x00, cannot be included in a name. Line 1, position 6.

some apks throw an exeption while reading resources

Hi!, i dont know if this issue have something to do with this Fix, but, i'm still getting this erros with some .apk files(like facebook app, SU, etc) while reading their resources, its in the while loop fixed but, still getting an error:

could you please tell me if i did something wrong. thz

(Sorry for my english.)

Message
The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' >fallback 'System.Text.DecoderReplacementFallback'. Parameter name: chars
ParamName
chars
StackTrace
at Iteedee.ApkReader.ApkReader.extractInfo(XmlDocument manifestXml, Byte[] resources_arsx) in d:\Work\apk parser\Iteedee.ApkReader-master\Iteedee.ApkReader\ApkReader.cs:line 243 at Iteedee.ApkReader.ApkReader.extractInfo(Byte[] manifest_xml, Byte[] resources_arsx) in d:\Work\apk parser\Iteedee.ApkReader-master\Iteedee.ApkReader\ApkReader.cs:line 108 at Windows_Phone_App_Store.Models.ApkStoreDiscover.discover() in d:\Documentos\Visual Studio 2013\Projects\Windows Phone App Store\Windows Phone App Store\Models\apkParser.cs:line 132

HelpLink
Source
Iteedee.ApkReader
HResult
-2147024809

Increase performance/speed

Working perfectly but taking 1:30 to 2:00 mints for Apk extraction/response .How to improve the performance/speed?
MyCode

        Stream stream = System.IO.File.OpenRead(filePath);
        using (ICSharpCode.SharpZipLib.Zip.ZipInputStream zip = new ICSharpCode.SharpZipLib.Zip.ZipInputStream(stream))
        {
            using (var filestream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                ICSharpCode.SharpZipLib.Zip.ZipFile zipfile = new ICSharpCode.SharpZipLib.Zip.ZipFile(filestream);
                ICSharpCode.SharpZipLib.Zip.ZipEntry item;

                foreach (ICSharpCode.SharpZipLib.Zip.ZipEntry entry in zipfile)
                {
                    if (entry.Name.ToLower() == "androidmanifest.xml")
                    {
                        Stream stream1 = zipfile.GetInputStream(entry);
                        manifestData = new byte[50 * 1024];
                        stream1.Read(manifestData, 0, manifestData.Length);
                    }
                    if (entry.Name.ToLower() == "resources.arsc")
                    {
                        Stream stream2 = zipfile.GetInputStream(entry);
                        BinaryReader binaryReader = new BinaryReader(stream2);
                        resourcesData = binaryReader.ReadBytes((int)entry.Size);
                    }
                }
            }

            ApkReader apkReader = new ApkReader();
            ApkInfo info = apkReader.extractInfo(manifestData, resourcesData);
            model.packageName = string.Format("Package Name: {0}", info.packageName);
            model.VersionName = string.Format("Version Name: {0}",info.versionName);
            model.VersionCode = string.Format("Version Code: {0}",info.versionCode);

        }

UTF8 Chars, Manifests with text nodes and nested namespaces

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.

"non-compliant" AndroidManifest causes failure

It seems that if there are other characters defined between/inside XML tags, parsing breaks, on the account of "unrecognised tag code".

For example, for

Just wondering what's your comment on this.

Index was outside the bounds of the array

hi,
I have this problem on large files!
I tested this with: instagram last version ( 38MB )
This problem does not exist in small files. Only big files like that

Error Message:

Unhandled Exception: System.Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Iteedee.ApkReader.APKManifest.LEW(Byte[] arr, Int32 off) in Iteedee.ApkReader\APKManifest.cs:line 248
at Iteedee.ApkReader.APKManifest.ReadManifestFileIntoXml(Byte[] manifestFileData) in Iteedee.ApkReader\APKManifest.cs:line 104
at Iteedee.ApkReader.ApkReader.extractInfo(Byte[] manifest_xml, Byte[] resources_arsx) in Iteedee.ApkReader\ApkReader.cs:line 99
at Iteedee.ApkReader.ApkReader.extractInfo(Byte[] manifest_xml, Byte[] resources_arsx) in Iteedee.ApkReader\ApkReader.cs:line 103
at Iteedee.ApkReader.Run.ReadApk.ReadApkFromPath(String path) in Iteedee.ApkReader.Run\ReadApk.cs:line 49
at Iteedee.ApkReader.Run.Program.Main(String[] args) in Iteedee.ApkReader.Run\Program.cs:line 16

line 248 in "APKManifest.cs":
return (int)(((uint)arr[off + 3]) << 24 & 0xff000000 | ((uint)arr[off + 2]) << 16 & 0xff0000 | ((uint)arr[off + 1]) << 8 & 0xff00 | ((uint)arr[off]) & 0xFF);
in:
public int LEW(byte[] arr, int off)

Parse AndroidManifest.xml

It would be nice to be able to parse AndroidManifest.xml only without the need to have resources.arsc. Currently, I am using APKManifest and parse the XML by myself, but having the content parsed in the ApkInfo would be more convenient.

APKManifest does nor read bytes correctly on some androidmanifest.xml's

This code works great on my previous apk's!!
but...our android developer brought me a new apk (which was created with android studio 3).
on the new extracted androidmanifest.xml, the function
ReadManifestFileIntoXml(byte[] manifestFileData)
does not work properly. I need greater understanding in reading byte array to understand the failure point accurately, but when I debugged it, I saw that the tags to read the data from no longer match to this new xml.
for example - the:
int tag6 = LEW(manifestFileData, off + 6 * 4); // Expected to be 14001400
is not as the number expected in the comment.

Sometimes the resource file cannot be extracted correctly by sharpzip

Due to bug in sharpzip, when the apk zipped as deflater mode, the zipinputstream.length is not set until you read the stream out. your example sometimes is not working.

using (Stream strm = zipfile.GetInputStream(item))
{
         using (BinaryReader s = new BinaryReader(strm))
         {
                resourcesData = s.ReadBytes((int)s.BaseStream.Length);

            }
}

solution is using entry.size instead of s.BaseStream.Length

using (Stream strm = zipfile.GetInputStream(item))
{
          using (BinaryReader s = new BinaryReader(strm))
           {
                resourcesData = s.ReadBytes((int)item.size);

           }
 }

Question: is there any port of this library to Java/Kotlin?

One that will work on Android, and that will be able to handle inputStream ?

The reason is that Google plans to ruin storage permission, which means apps won't be able to handle files using File API or file-path.
And yet, the normal Android framework for parsing APK files need a file-path:

https://developer.android.com/reference/android/content/pm/PackageManager.html#getPackageArchiveInfo(java.lang.String, int)

There is a lot of talk about it over the Internet, and many are against it, as many libraries, apps, unix commands and even Android's own framework sometimes depend only on file-path and not inputStream.

Wrong Local header signature: 0xFF8

I have just follow this page.

And while at run-time, I am getting this error. Wrong Local header signature: 0xFF8

My basic aim is to read basic information(like version, logo, name) of .apk file.

Need help ASAP

Error "Wrong Local header signature: 0x3F8" come while apk reading

I am using "Youtube" apk and when this apk reading using this code it will give exception "Wrong Local header signature: 0x3F8" at line "while((item = zip.GetNextEntry()) != null)". Some apk's are read properly but some apk's are giving these type of exceptions.

Can you please help me for this issue.

Update NuGet release

It would be nice if you could update the nuget release since the version that is currently published is 9 years old already.

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.