Commit Graph

1010 Commits

Author SHA1 Message Date
Connor Tumbleson
772646f95b
fix: end parsing if EOF is hit (#3223) 2023-07-26 07:27:15 -04:00
Connor Tumbleson
ab7998439e
"--no-compile-sdk-metadata" tests. (#3220)
* refactor: move loadDocument() to base

* test: confirm manifest properties are removed/left-alone

* chore: remove unused imports
2023-07-25 07:29:53 -04:00
Connor Tumbleson
7f0d94ede9
feat: Introduce --no-compile-sdk-metadata (#3208)
* feat: ignore sdk metadata during aapt2

* test: adjust test suite for aapt2 change
2023-07-25 06:43:15 -04:00
sv99
7a4a20ba34
Support explicit operation for when to load full resource table (#3217) 2023-07-25 06:18:13 -04:00
sv99
c2ddeac3ab
Explicit ResFileDecoder initiazation and add constructors AXmlResourceParser(ResTable resTable) and AndroidManifestResourceParser(ResTable resTable) (#3211) 2023-07-24 06:43:56 -04:00
Connor Tumbleson
490b6f8aee
fix: handle larger axml namespace headers than known (#3210) 2023-07-24 06:23:25 -04:00
Connor Tumbleson
03c198c1e4
fix: support skipping entries with NO_ENTRY (-1) flag (#3209) 2023-07-24 06:06:45 -04:00
Connor Tumbleson
79f57b070c
fix: support skipping unread header sizes of ResChunk (#3180)
* fix: support skipping unread header sizes of ResChunk

* refactor: note that header skip happens too late on some

* refactor: check for chunk header end at each of each header

* chore: skip reading header on string pools

* fix: move header check prior to reading entries on tables
2023-07-23 18:14:53 -04:00
Connor Tumbleson
c7bb163834
chore: fix typo on resource message, drop shorthand if logic 2023-07-23 17:39:47 -04:00
sv99
3ba9838d08
Sreamline decoding AndroidManifest.xml (#3171) 2023-07-23 17:37:55 -04:00
Connor Tumbleson
d1a0c941ab
Fix LocaleNumberSystem + ConfigFlag reading (#3205)
* fix: prevent over-reading config flags

* fix: properly read localeNumberingSystem

* test: adjust test for bcp47 aapt2 test

* fix: properly add 8 to 'read' on parser

* test: add test for aapt2 bcp47 tag

* test: add additional bcp47 test

* fix: handle numbering system parsing

* fix: add comment about localeNumber usage
2023-07-23 17:25:25 -04:00
Connor Tumbleson
54836509ed
fix: correct detection of sparse/not-sparse applications (#3201)
* test: add failing/passing sparse/not-sparse test

* fix: replace sparse/not applications w/ official sample

 -ref: c8f71aa67e

* fix: properly detect sparse applications during disassembly

* refactor: remove check on bool set for sparse resources
2023-07-23 11:20:12 -04:00
Igor Eisberg
24b0c3249d
fix: crash when decompiling framework-res.apk with a tag (regression) (#3193) 2023-07-22 09:21:19 -04:00
Igor Eisberg
79b2173b85
style: normalize command descs and redundancy (#3188) 2023-07-21 06:08:30 -04:00
Connor Tumbleson
d4ec44de41
Prevent loading from resource pool if type is not a resolveable resource (#3187)
* perf: prefer the shifted resId vs expensive package calls

* fix: only lookup values if reference/value
2023-07-20 21:32:19 -04:00
Igor Eisberg
261003316e
fix: add missing hasResources check (#3182) 2023-07-20 11:40:16 -04:00
sv99
e3e2a7e1d6
Allows run app from gradle for debugging purposes (#3179)
Co-authored-by: Connor Tumbleson <iBotPeaches@users.noreply.github.com>
2023-07-20 06:03:47 -04:00
Connor Tumbleson
ca07a0a56c
Fix regressions towards apktool.yml generation (#3172)
* fix: prevent blowing out minSdkVersion

* fix: correct naming regression with apk name and sdk info

* chore: comment for why we double up minSdkVersion

* fix: deprecate compressionType

* test: assert apktool format isn't regressed
2023-07-20 05:37:46 -04:00
Connor Tumbleson
1493d9d357
fix: opt out of stricter java rules for zip64 and dot entries (#3178)
* fix: opt out of stricter java rules for zip64 and dot entries

* test: assert specific system properties for test suite
2023-07-20 05:01:21 -04:00
Connor Tumbleson
ba2f1283ed
fix: update links for apktool/baksmali/smali on usage 2023-07-17 06:55:08 -04:00
Connor Tumbleson
6a28621fcc
fix: skip parsing if chunk end is reached (#3134) 2023-07-13 07:27:11 -04:00
Connor Tumbleson
c46a6a13f9
fix: properly parse localeNumberingSystem (#3133) 2023-07-13 06:50:15 -04:00
Connor Tumbleson
bdbe1384bf
ARSC/AXML Parser Rework (#3131)
* Supports ASRC with null renamed package.
* Rework ASRC Chunk parser to a loop to break assumption of order of chunks
* Break out unknown skips for alignment to ResourceTypes.h
* Add verbose information for file skips
* Add test for protected apk sample
* Rework chunk parsing for StringBlock
* Refactor AXML Parser to support proper header reading
* Fix parsing if attribute size reported does not align to actual size
2023-07-12 05:33:28 -04:00
Connor Tumbleson
86340503ac
Patch aapt for ignoring duplicate bag items. (#3130)
* build: update aapt (win/linux) binaries

 - bc4ca278f3

* build: update aapt2 (win/linux) binaries

* build: update aapt/aapt2 (mac) binaries
2023-07-09 21:23:07 -04:00
Connor Tumbleson
2b81215846
test: add assertions for unknown files / assets (#3074) 2023-07-04 12:47:26 -04:00
Connor Tumbleson
0e3e165d4e
refactor: extract nextChunk() out of readLibraryType (#3126) 2023-07-04 12:28:49 -04:00
Connor Tumbleson
79cfdd179c
Correct Attribute Resolution (#3123)
* refactor: rename package_ to pkgId

* refactor: ResAttrDecoder takes ResTable

* fix: fallback on attr decoding to proper prefix

* fix: reverse order of processing to trust string pool 2nd

Android prefers the resource map value over what the String block has.
This can be seen quite often in obfuscated apps where values such as:
 <item android:state_enabled="true" app:state_collapsed="false" app:state_collapsible="true">
Are improperly decoded when trusting the String block.
Leveraging the resource map allows us to get the proper value.
 <item android:state_enabled="true" app:d2="false" app:d3="true">

* refactor: set default value if no string/res value
2023-07-04 12:06:53 -04:00
Connor Tumbleson
f42ce82f0d
style: cleanup formatting from ApkInvoker introduction 2023-07-03 18:46:47 -04:00
sv99
a7e2e3e5e1
Extract into ApkInvoker and split into data classes. (#3124)
* extract AaptInvoker and rename MetaFile to ApkInfo, all decode methods from AndrolibResources moved to the ApkDecoder

* extract ARSCData and FlagsOffset from ARSCDecoder and remove unused imports

* rebase to master

* move decodeManifest and decodeResources to the ResourceDecoder

* remove commented old code
2023-07-03 18:38:52 -04:00
Connor Tumbleson
ab6f1b416e
refactor: split child classes to own file for decoders (#3116) 2023-07-02 19:44:20 -04:00
Connor Tumbleson
e85472fee8
refactor: sparse log should be a notice (debug only) 2023-07-02 06:04:19 -04:00
Connor Tumbleson
5a7e7b152d
feat: update internal framework to API 34 (Vanilla Ice Cream) (#3115) 2023-07-02 05:43:04 -04:00
Connor Tumbleson
70d941d18d
feat: support upside-down-cake/vanilla-ice-cream sdk shorthand (#3113) 2023-07-02 05:35:45 -04:00
sv99
5cd94d6aa0
refactor Apkecoder - streamline decode procedure (#3109) 2023-06-28 21:02:46 +00:00
Connor Tumbleson
1e400aa995
fix: handle invalid string id during namespace resolution (#3107) 2023-06-28 11:24:50 -04:00
Connor Tumbleson
6ed458a428
refactor: add missing license header 2023-06-28 06:16:10 -04:00
sv99
85a710f77a
refactor class ApkDecoder (#3106) 2023-06-28 06:13:22 -04:00
sv99
40d427e5bd
Extract class Framework from AndrolibResources (#3105) 2023-06-27 10:51:26 -04:00
sv99
9c495cae29
Move build functions from Androlib to the ApkBuilder (#3103) 2023-06-27 08:25:27 -04:00
Connor Tumbleson
10495cbe96
Refactor into common config object. (#3100)
* extract Config

* extract Config

* style: linting

---------

Co-authored-by: Slava Volkov <sv99@inbox.ru>
2023-06-25 15:07:23 -04:00
sv99
168aa1abc0
move AndrolidExceptions to the package brut.androlib.exceptions (renamed from brut.androlib.err) (#3088) 2023-06-10 13:16:31 -04:00
Marc Miltenberger
636b1a128e
Deprecated SnakeYAML methods (#3079)
I replaced the deprecated methods in SnakeYAML 1.33 with the respective non-deprecated constructor calls.
These are equivalent:
The deprecated non-arg constructor of Constructor https://bitbucket.org/snakeyaml/snakeyaml/src/snakeyaml-1.33/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java
calls 7f5106920d/src/main/java/org/yaml/snakeyaml/constructor/SafeConstructor.java (lines-52), which uses a new empty LoaderOptions()

Similarly, SafeRepresenter 7f5106920d/src/main/java/org/yaml/snakeyaml/representer/SafeRepresenter.java (lines-54) uses a new empty DumperOptions.
2023-05-27 13:20:57 -04:00
Connor Tumbleson
deb9dcf089
fix: support 0_resource_name_obfuscated (#3067)
* fix: support `0_resource_name_obfuscated`

* refactor: drop jdk9 for jdk8 logic
2023-05-20 15:06:36 -04:00
sv99
80dcdd1d34
add application plugin to the apktool-cli (#3070) 2023-05-20 13:53:29 -04:00
Connor Tumbleson
fb4889f432
feat: update internal framework to API 34 (Upside Down Cake Preview) (#3063)
* feat: update internal framework to API 34 (Upside Down Cake Preview)

* test: add assertion for API34 property
2023-05-13 06:43:31 -04:00
sv99
48b71b34b1
refactor: Replace to nio & apply CS inspection skips (#3055) 2023-05-13 06:12:22 -04:00
Connor Tumbleson
a079fe74fc
Move to official Google smali fork (#3051)
* refactor: swap to google smali 3.0.3

* docs: update docs for smali change
2023-04-28 19:30:06 -04:00
Connor Tumbleson
d3c5813442
fix: properly read 'XML_TYPE_OVERLAY_POLICY' (#3035) 2023-03-25 07:14:38 -04:00
Connor Tumbleson
9153a272d3
fix: support 10mb apktool.yml parsing (#3015) 2023-03-04 14:51:21 -05:00
Igor Eisberg
120611879c
fix: accept empty resources.arsc (#2998)
* fix: accept empty resources.arsc

* fix: accept empty resources.arsc (fix isFrameworkApk=true)
2023-02-19 06:57:03 -05:00
Connor Tumbleson
0a3c7595eb
feat: support config flags as low as 8 bytes (#2982) 2023-01-21 13:30:13 -05:00
Connor Tumbleson
67a936f1c7
build: include bleeding edge smali from source via jitpack (#2941)
* build: include smali from source

* refactor: adjust build.gradle for repositories
2022-11-24 06:15:41 -05:00
Connor Tumbleson
35ce8fc061
Issue 2943 - Support raw disassembly w/ AndResGuard (#2944)
* fix: allow copying r/R if in raw mode

* test: assert raw files disassembled from AndResGuard
2022-11-20 08:08:45 -05:00
Danealau
8749e2a6c4
fix: support (name removed) res items. (#2940)
* fix:  res/layout/(name removed).xml: Invalid file name: must contain only [a-zA-Z0-9$_.] error

* refactored fix
2022-11-16 19:52:55 -05:00
Connor Tumbleson
22f2e6fb23
fix: support properly mapping r/R/res resources during disassemble (#2936) 2022-11-13 18:06:25 -05:00
Connor Tumbleson
07d15e8200
Squashed commit of the following:
commit 66a7167079caafd2e805dcd9e3dd1a883b92493b
Author: Connor Tumbleson <connor.tumbleson@gmail.com>
Date:   Wed Nov 9 06:02:23 2022 -0500

    refactor: add message when pairing --only-main-classes w/ --no-src

commit 565a4dbe33e69e0da775ad8678a29fd7e117fe3c
Author: surendrajat <surendrajat@protonmail.com>
Date:   Wed Nov 9 12:12:28 2022 +0530

    fix: --no-src should take precedence over --only-main-classes
2022-11-09 06:03:44 -05:00
Connor Tumbleson
ef83dc2f04
fix: don't assume a referent exists on ReferenceValue (#2926) 2022-11-08 06:56:05 -05:00
Connor Tumbleson
273842279a
Merge branch 'stored_obfuscated_files' 2022-11-08 06:24:49 -05:00
Connor Tumbleson
b32be8ca2a
refactor: rename attributes for storing obfuscated filepath 2022-11-08 06:24:41 -05:00
Miepee
6a70be6c26
make default framework detection on linux xdg-compliant (#2924)
On Linux, check first if $XDG_DATA_HOME is set, if not use path as it was before (~/.local/share/apktool)
2022-11-08 05:54:36 -05:00
Kirlif
c4e8f88499
Fix « doNotCompress » in case of obfuscated resources. 2022-11-07 14:08:49 +01:00
Dominic Lemire
f8df056a2c
fix: overlay spec parsing (#2805) (#2917) 2022-11-02 06:56:49 -04:00
Sven Marquardt
9db742618b
Fixes #2900 (#2901)
Fastst way to fix empty key value splitting for styled strings.

Signed-off-by: Sven Marquardt <dev@mail.smarquardt.space>

Signed-off-by: Sven Marquardt <dev@mail.smarquardt.space>
2022-10-12 06:55:29 -04:00
Connor Tumbleson
fc1e21e9ed
fix: correct npe if null is returned from attribute value (#2889) 2022-09-20 07:19:28 -04:00
Connor Tumbleson
dc3667dbd0
Support Spare Flags (#2887)
* support sparse flag

* style: cs changes

Co-authored-by: R0S <41138521+iamr0s@users.noreply.github.com>
2022-09-19 17:18:35 -04:00
Connor Tumbleson
3fff2f128e
Support malformed resource names/namespaces by falling back to resId (#2886)
* Correct falsely-referenced attribute into an entity which is an obfuscated name

* style: correct syntax for custom attributes

* fix: remove unused import

Co-authored-by: MyAnoneNeko <MyAnoneNeko@users.noreply.github.com>
2022-09-19 16:27:43 -04:00
Tvildo
5d6c6c04d2
Fixes Facebook apk deconstruction (#2884) 2022-09-19 12:34:14 -04:00
Connor Tumbleson
7a2c0c8bb8
fix: correct case when application has no ResPackages
- refs: #2701
2022-07-10 07:42:29 -04:00
Connor Tumbleson
f94cdc5cf3
refactor: mark skips as "fine" to not clog output 2022-07-10 07:38:05 -04:00
Connor Tumbleson
287d4a5922
style: fix missing throws statements on javadoc 2022-07-10 07:34:45 -04:00
Connor Tumbleson
dceff41a57
feat: lodge helpful information of built apk location
fixes: #2843
2022-07-10 07:32:40 -04:00
Connor Tumbleson
c3ce154b72
Binaries: aapt/aapt2 updates (July 5, 2022) (#2846)
* feat: new aapt/aapt2 binaries (win/linux)

* feat: new aapt/aapt2 binaries (mac)

* docs: optimization techniques for aosp clone
2022-07-10 07:21:24 -04:00
Connor Tumbleson
057b35fcec
feat: update internal framework to API 33 (Tiramisu Privacy Preview) (#2845) 2022-07-03 13:00:39 -04:00
Connor Tumbleson
b7c56c8928
Tests / Style for #2815 (#2817)
* style: reorg getAttributes (StyledString)

* test: assertion for aapt2 string (#2815)
2022-05-23 07:09:27 -04:00
Igor Eisberg
c1f6dc792a
fix: redesign StyledString decoding (#2816)
* fix: redesign StyledString decoding

* optimize: avoid calling span.getName() twice

* fix: order spans due to aapt1/2 discrepancy
* fixes: #2815
2022-05-23 06:40:48 -04:00
erev0s
8fab4bfb3d
added option to include generic/permissive network security config file durin… (#2791)
* added option to include permissive network security config file during build

* added tests for app with existing network config and for app without

* minor fixes for pull 2791

* refactor: slim down test app for network config

* style: remove extra newlines

* refactor: moved network tests to aapt2

* refactor: remove unused exceptions

* test (aapt2): ensure aapt2 is used for net-sec-conf

* fix (cli): block use of net-sec-conf on aapt1

* fix conflict

Co-authored-by: Connor Tumbleson <connor@sourcetoad.com>
Co-authored-by: Connor Tumbleson <connor.tumbleson@gmail.com>
2022-05-07 06:52:07 -04:00
Connor Tumbleson
d38eceedae
test (aapt/aapt2): ensure ampersand is escaped on android:label (#2802)
* test (aapt/aapt2): ensure ampersand is escaped on android:label

* build (workflow): ensure test changes force ci rebuild
2022-04-24 17:33:11 -04:00
Connor Tumbleson
420406b553
test (aapt2): add assertion for "usesPermissionFlags" (#2790) 2022-03-28 07:07:20 -04:00
Connor Tumbleson
b910df79dd
New aapt/aapt2 binaries (#2787)
* feat: new aapt1/aap2 binaries for mac (static)

* feat: new aapt1/aapt2 binaries for unix/mac (static)

* feat (aapt2): allow reserved pkgIds
2022-03-28 06:53:42 -04:00
Connor Tumbleson
fc28ac56ef
Merge pull request #2785 from iBotPeaches/revert-2650-fix-private-reference
Revert "fix: decoding references to private resources"
2022-03-21 07:44:22 -04:00
Connor Tumbleson
49071d0fb0
feat: update internal framework to API 31 (12 Release) (#2743)
* feat: update internal framework to API 31 (12 Release)

* refactor: rename enums for new overlays/stagedAliases

* fix: introduce basic staged alias support

* feat: update internal framework to API 32 (12L Release)

* fix: add support for overlay spec skipping
2022-03-21 07:20:04 -04:00
Connor Tumbleson
c300184780
fix: add support for overlay spec skipping 2022-03-21 07:03:14 -04:00
Connor Tumbleson
26f39ee736
feat: update internal framework to API 32 (12L Release) 2022-03-21 07:02:54 -04:00
auermich93
e105768592
fixes issue #2473 (#2783) 2022-03-21 06:51:15 -04:00
Connor Tumbleson
df3b9f7c56
fix: introduce basic staged alias support 2022-03-13 08:34:45 -04:00
Connor Tumbleson
e9a3993da8
refactor: rename enums for new overlays/stagedAliases 2022-03-13 08:34:31 -04:00
Connor Tumbleson
951d063cbd
feat: update internal framework to API 31 (12 Release) 2022-03-13 07:55:51 -04:00
Connor Tumbleson
31af56a430
feat: introduce SDK_S_V2 (#2780) 2022-03-13 07:39:54 -04:00
Connor Tumbleson
4065717b45
Preventing instantiation of untrusted classes. (#2760 - CVE-2022-0476)
* fix: enforce allowable classes during yaml parsing

* fix: rename class to reference escaping nature of strings

* test: assertion for parsing malicious yaml
2022-02-19 09:12:04 -05:00
Connor Tumbleson
a269a8e0d5
refactor: drop unused exceptions (#2746) 2022-01-18 08:18:33 -05:00
Connor Tumbleson
797fc3e332
fix: prevent file hold on tmpDir during build (#2745) 2022-01-18 07:32:41 -05:00
Connor Tumbleson
ddc4bb360a
Cleanup trailing temp files/folders (#2742)
* test: add missing afterClass to cleanup BRUT* directory

* fix: properly cleanup apkFile temp after buildManifest
2022-01-17 07:19:22 -05:00
Al Sutton
95874be448
Replace use of deprecated methods with their recommended replacements (#2713)
* Replace use of deprecated methods with their recommended replacements

* Add scripting jmod to proguard inputs
2021-12-13 06:27:19 -05:00
Connor Tumbleson
6cfe2987e5
fix: support for signature scheme v4 (#2705) 2021-11-27 07:41:15 -05:00
Yaroslav
d29411117e
fix: decoding references to private resources (#2650)
* fix: decoding references to private resources

* style: fix naming in constructor parameter

* test: add test to check build/decode private references
2021-10-17 12:01:54 -04:00
Connor Tumbleson
9bdf385538 style: cleanup build vs Build 2021-09-06 06:59:30 -04:00
Connor Tumbleson
0f690e4654 refactor: remove redundant suppression 2021-09-06 06:59:30 -04:00
Connor Tumbleson
3118b54632 refactor: extract common element from if statement 2021-09-06 06:59:30 -04:00
Connor Tumbleson
d48b407f5b fix: remove unused exceptions in CLI 2021-09-06 06:59:30 -04:00
Connor Tumbleson
3b179f8750 refactor: rename ApkOptions -> Options/BuildOptions 2021-09-06 06:59:30 -04:00