Commit Graph

207 Commits

Author SHA1 Message Date
Connor Tumbleson
679c133d21
feat: make aapt2 default (#3370) 2023-10-04 20:52:28 -04:00
Connor Tumbleson
a117132e39
Feat: Introduce "res-mode" options. (#3318)
* Revert "Remove Apktool Dummys. (#3258)"

This reverts commit 0e226928ce.

* feat: properly add dummys

* refactor: shorten ResTypeSpec

* style: remove extra space

* refactor: extract FlagItem into own class

* refactor: notate which type is null

* fix: only add dummys if enabled

* feat: skip unknown (if enabled)

* feat: introduce "res-mode"

* feat: expose config on res table

* feat: add method to base attr for res skips

* fix: ensure autobuild doesn't choke

* refactor: remove java17 enhanced switch

* refactor: rename methods

* refactor: cleanup res-mode param

* test: introduction of test/sample apk

* refactor: make ResXmlPatcher public for loading XML

* test: assertions for dummy|leave|retain

* fix: prevent using `@null` as a name

* refactor: shorten long param for 'resm'

* refactor: leave for preserve
2023-09-09 07:29:39 -04:00
Connor Tumbleson
81a7e1e434
fix: only mark as sparse if intended application (#3299) 2023-08-27 15:06:58 -04:00
Connor Tumbleson
225c9089d9
refactor: remove deprecations from test suite (#3269) 2023-08-13 14:25:32 -04:00
sv99
9d7d58016e
ApkDecoder use apkFile and unknownFiles from ApkInfo (#3242) 2023-08-01 06:57:22 -04:00
Connor Tumbleson
445da0e658
Move to XMLUnit Legacy (#3235)
* build: migrate to xmlunit 2.9.1

* feat: opt into xxe protection for test suite
2023-07-30 13:48:26 -04:00
Connor Tumbleson
e19c44b1b1
refactor: drop unused method 2023-07-30 13:16:34 -04:00
Igor Eisberg
33ca2929c9
refactor: clean up style and redundancy (#3232)
* refactor: clean up redundancy

* refactor: no need for both setApkFile and setApkFileName
2023-07-29 18:56:27 -04:00
Connor Tumbleson
486fb20084
Support empty resource table. (#3230)
* test: assertions for empty arsc table

* fix: don't crash if no pkgs found
2023-07-29 06:49:13 -04:00
Connor Tumbleson
fe93fd21d1
refactor: manual YAML Cleanup (#3229)
* refactor: add missing license headers

* fix: remove unused exceptions

* refactor: remove unused single quote / slash param
2023-07-29 06:14:40 -04:00
sv99
62b9eedb9e
Remove SnakeYAML for manual YAML Parser (#3191)
* Simple straitforward yaml serialization with minimal needed functionality

* Consolidate ApkInfo tests in the package brut.androlib.apk, unify interface YamlReader and add ApkInfoSerializationTest read -> write -> read test

* remove dependencies from snakeyaml

* remove unused methods

* correct indent test value

* correct style with curly braces

* add test item with hieroglyph
2023-07-29 05:59: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
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
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
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
2b81215846
test: add assertions for unknown files / assets (#3074) 2023-07-04 12:47:26 -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
70d941d18d
feat: support upside-down-cake/vanilla-ice-cream sdk shorthand (#3113) 2023-07-02 05:35:45 -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
sv99
48b71b34b1
refactor: Replace to nio & apply CS inspection skips (#3055) 2023-05-13 06:12:22 -04: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
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
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
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
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
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
3b179f8750 refactor: rename ApkOptions -> Options/BuildOptions 2021-09-06 06:59:30 -04:00
Goooler
5c6d091f39 Merge branch 'master' into refine 2021-08-30 18:48:04 +08:00
Connor Tumbleson
caee50b35b test: adjust test for SDK S/T 2021-08-29 07:22:05 -04:00
Goooler
94ed86db28 Code cleanups 2021-08-27 01:16:46 +08:00
Goooler
e25c3636ff Update docs & licenses to use https 2021-08-26 07:40:32 -04:00
Connor Tumbleson
66b1c30fa0
style: use new form of junit assertions 2021-05-31 06:43:40 -04:00
Comnir
491d18058a test: fix incorrect 3-byte encoding. 2021-04-03 13:47:13 +03:00
Comnir
f10060fe8f fix: when decoding with UTF-8 fails, create a new buffer for the retry with CESU-8.
If the decoding fails and there are UTF-8 decodable bytes before the bytes that couldn't be decoded, then the read index of the original buffer is incremented and those bytes will be missing from the decode result.
Now we create a new buffer and the decoding will start at the original start offset.

issue #2546
2021-04-03 13:28:22 +03:00
Connor Tumbleson
468ead8f10
test: add testcase for static field values 2021-03-28 07:44:16 -04:00
Connor Tumbleson
447ba50332
refactor: drop author tags and support javadocs 2021-03-07 15:06:45 -05:00
Connor Tumbleson
b17832f0e1
style: add missing license headers 2020-12-11 07:07:54 -05:00
Comnir
961f1f94f6 Rename variables in tests. 2020-12-10 14:44:01 +02:00
Comnir
201b5976bb Add tests for StringBlock#decodeString with failing tests for code points above 0x10FFFF (issue 2299). 2020-12-10 12:29:34 +02:00
Connor Tumbleson
6bd1ab603b test: add triple dex test to aapt1 2020-11-27 10:51:54 -05:00
Connor Tumbleson
5658c959b4 test: add triple dex test on aapt2 2020-11-27 10:51:54 -05:00
Connor Tumbleson
231ce72483 test: add more tests for #2386 2020-11-27 09:22:41 -05:00
Connor Tumbleson
3101a05ef6
fix: add development next version (S) - API 31 2020-09-13 08:52:15 -04:00
Comnir
306959a6fb fix the usage of debug flag (-d) when using aapt2
- when using aapt and debug flag, we remove the 'debuggable' attribute from AndroidManifest and aapt adds it back. (see issue 1621)
- when using aapt2 and debug flag, we add and set the value of 'debuggable' attribute ourselves.
2020-06-09 07:08:22 -04:00