1673725413.FILE5_44-22-g6d565d82.improve-apk-detection-fc-stegerman.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Subject: Improve APK detection (FC Stegerman)
  2. Origin: FILE5_44-22-g6d565d82 <https://github.com/file/file/commit/FILE5_44-22-g6d565d82>
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Sat Jan 14 19:43:33 2023 +0000
  5. --- a/magic/Magdir/archive
  6. +++ b/magic/Magdir/archive
  7. @@ -1559,7 +1559,7 @@
  8. !:mime application/vnd.android.package-archive
  9. !:ext apk
  10. # Starts with META-INF/MANIFEST.MF (file name length = 20)
  11. -# NB: checks for resources.arsc or drawables as well to avoid matching JAR files
  12. +# NB: checks for resources.arsc, classes.dex, etc. as well to avoid matching JAR files
  13. >26 uleshort 20
  14. >>30 string META-INF/MANIFEST.MF
  15. # Contains resources.arsc (near the end, in the central directory)
  16. @@ -1568,13 +1568,27 @@
  17. >>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  18. !:mime application/vnd.android.package-archive
  19. !:ext apk
  20. ->>>-512 default x
  21. -# Contains drawables (near the end, in the central directory)
  22. ->>>>-512 search res/drawable Android package (APK), with MANIFEST.MF and drawables
  23. +>>>-512 default x
  24. +# Contains classes.dex (near the end, in the central directory)
  25. +>>>>-512 search classes.dex Android package (APK), with MANIFEST.MF and classes.dex
  26. >>>>>-22 string PK\005\006
  27. >>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  28. !:mime application/vnd.android.package-archive
  29. !:ext apk
  30. +>>>>-512 default x
  31. +# Contains lib/armeabi (near the end, in the central directory)
  32. +>>>>>-512 search lib/armeabi Android package (APK), with MANIFEST.MF and armeabi lib
  33. +>>>>>>-22 string PK\005\006
  34. +>>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  35. +!:mime application/vnd.android.package-archive
  36. +!:ext apk
  37. +>>>>>-512 default x
  38. +# Contains drawables (near the end, in the central directory)
  39. +>>>>>>-512 search res/drawable Android package (APK), with MANIFEST.MF and drawables
  40. +>>>>>>>-22 string PK\005\006
  41. +>>>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  42. +!:mime application/vnd.android.package-archive
  43. +!:ext apk
  44. # Starts with zipflinger virtual entry (28 + 104 = 132 bytes)
  45. # See https://github.com/obfusk/apksigcopier/blob/666f5b7/apksigcopier/__init__.py#L230
  46. >4 string \x00\x00\x00\x00\x00\x00