From 0a9f584e181ff782e51470ee5db79aa6f8dfc7fa Mon Sep 17 00:00:00 2001 From: yonggamer <24843208+yonggamer@users.noreply.github.com> Date: Mon, 12 May 2025 22:35:14 +0200 Subject: [PATCH] Update README.md documentation --- README.md | 278 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 278 insertions(+) diff --git a/README.md b/README.md index a22db76c..be7b8c34 100755 --- a/README.md +++ b/README.md @@ -41,7 +41,81 @@ Output: test_json 00.129 I: [DECOMPILE] Decompiling to json ... 30.093 I: [DECOMPILE] Done ``` +
more info +```ShellSession +Decodes android resources binary to readable json/xml/raw. +Usage: + d [Options, flags] +Options: + -framework Path of framework file (can be multiple). + -framework-version Preferred framework version number + -i Input path. + -load-dex Number of dex files to load at a time. + If the apk dex files count greater than this value, + then the decoder loads one dex at a time. + *Applies only when -dex-lib set to internal. + *Default = 3 + *See below. + -o Output path. Optional, if not provided then a new file + will be generated on same directory as input + -res-dir Sets resource files root dir name. e.g. for obfuscation + to move files from 'res/*' to 'r/*' or vice versa. + -sig Signatures directory path. + -t Decode types: + [xml, json, raw, sig] + -dex-lib Dex library to use: + 1) internal : Use internal library, supports dex + versions up to 042. + 2) jf : Use library by JesusFreke/smali, supports dex + versions 035 and below. + *Default = jf + **WARN: The default value will be replaced by + "internal" on coming versions. + *See below. + [internal, jf] +Flags: + -dex Copy raw dex files / skip smali. + -dex-markers Dumps dex markers (applies only when smali mode). + -f Force delete output path. + -h | -help | --help Displays this help and exit. + -keep-res-path Keeps original res/* file paths: + *Applies only when decoding to xml + *All res/* files will be placed on dir + *The relative paths will be linked to values/*xml + -no-dex-debug Drops all debug info from smali/dex. + -split-json Splits resources.arsc into multiple parts as per type + entries (use this for large files) + -vrd Validate resources dir name + (eg. if a drawable resource file path is 'res/abc.png' + then it will be moved to 'res/drawable/abc.png)' +Examples: + 1) [Basic] + java -jar APKEditor.jar d -i path/input.apk + 2) [Specify output] + java -jar APKEditor.jar d -i path/input.apk -o path/output.apk + 3) [Specify decode type] + java -jar APKEditor.jar d -t xml -i path/input.apk + 4) [Specify framework file(s)] + java -jar APKEditor.jar d -i path/input.apk -framework framework-res.apk + -framework platforms/android-32/android.jar + 5) [Decode apk signature block] + java -jar APKEditor.jar d -t sig -i path/input.apk -sig path/signatures_dir +Notes: + 1) [internal] Dex builder: + * Fully supports dex files up to 042. + * Highest dex file compression. + * Builds with similar dex-section order as r8/dx. + * Convenient dex markers editing, see file smali/classes/dex-file.json + * Additional helpful smali comments: e.g class/method hierarchy. + * Supports whitespaces on class simple name as introduced on dex 041+ + 2) [-load-dex] To print correct class/method hierarchy, it is necessary to + load all dex files at once. This may result high memory consumption and + could fail with "OutOfMemoryError" thus you are required to limit the + number of dex files to load at a time. You can overcome this problem with + -Xmx memory arg e.g java -Xmx8g -jar APKEditor.jar ... +``` +
#### 2- Build @@ -62,6 +136,63 @@ Output: test_edited.apk 27.101 I: [BUILD] Saved to: test_edited.apk 30.217 I: [BUILD] Done ``` +
more info + +```ShellSession +Builds android binary from json/xml/raw. +Options: + -framework Path of framework file (can be multiple). + -framework-version Preferred framework version number + -i Input path. + -o Output path. Optional, if not provided then a new file + will be generated on same directory as input + -res-dir Sets resource files root dir name. e.g. for obfuscation + to move files from 'res/*' to 'r/*' or vice versa. + -sig Signatures directory path. + -t Build types, By default build types determined by quick + scanning of input directory files. Values are: + [xml, json, raw, sig] + -extractNativeLibs Sets extractNativeLibs attribute on manifest and + applies compression of library files (*.so). + *Default = manifest + 1) manifest: read and apply from manifest. + 2) none: remove attribute from manifest and store + libraries compressed. + 3) true: set manifest attribute 'true' and store + libraries compressed. + 4) false: set manifest attribute 'false' and store + libraries un-compressed with 4096 alignment. + [manifest, none, false, true] + -dex-lib Dex library to use: + 1) internal : Use internal library, supports dex + versions up to 042. + 2) jf : Use library by JesusFreke/smali, supports dex + versions 035 and below. + *Default = jf + **WARN: The default value will be replaced by + "internal" on coming versions. + *See below. + [internal, jf] +Flags: + -f Force delete output path. + -h | -help | --help Displays this help and exit. + -no-cache Ignore built cached .dex files and re-build smali files. + -vrd Validate resources dir name + (eg. if a drawable resource file path is 'res/abc.png' + then it will be moved to 'res/drawable/abc.png)' +Examples: + 1) [Basic] + java -jar APKEditor.jar b -i path/input_directory + 2) [Specify output] + java -jar APKEditor.jar b -i path/input_directory -o path/output.apk + 3) [Restore signatures] + java -jar APKEditor.jar b -t sig -i path/input.apk -sig + path/signatures_dir + 4) [Specify framework] + java -jar APKEditor.jar b -i path/input_directory -framework + framework-res.apk -framework platforms/android-32/android.jar +``` +
#### 3- Merge @@ -99,6 +230,42 @@ $ java -jar APKEditor.jar m -i apk_files ``` ![apkmerger](/.github/apkmerger.png) +
more info + +```ShellSession +Merges split apk files from directory or compressed apk files like XAPK, +APKM, APKS ... +Options: + -i Input path. + -o Output path. Optional, if not provided then a new file + will be generated on same directory as input + -res-dir Sets resource files root dir name. e.g. for obfuscation + to move files from 'res/*' to 'r/*' or vice versa. + -extractNativeLibs Sets extractNativeLibs attribute on manifest and + applies compression of library files (*.so). + *Default = manifest + 1) manifest: read and apply from manifest. + 2) none: remove attribute from manifest and store + libraries compressed. + 3) true: set manifest attribute 'true' and store + libraries compressed. + 4) false: set manifest attribute 'false' and store + libraries un-compressed with 4096 alignment. + [manifest, none, false, true] +Flags: + -clean-meta Cleans META-INF directory along with signature block. + -f Force delete output path. + -h | -help | --help Displays this help and exit. + -validate-modules Validates for same versionNumber of base.apk with split + apk files. + -vrd Validate resources dir name + (eg. if a drawable resource file path is 'res/abc.png' + then it will be moved to 'res/drawable/abc.png)' +Examples: + 1) [Basic] + java -jar APKEditor.jar m -i path/input -o path/output.apk +``` +
#### 4- Refactor @@ -120,7 +287,27 @@ $ java -jar APKEditor.jar x -i input.apk 03.504 I: [REFACTOR] Done ``` +
more info +```ShellSession +Refactors obfuscated resource names +Options: + -i Input path. + -o Output path. Optional, if not provided then a new file + will be generated on same directory as input + -public-xml Path of resource ids xml file (public.xml) + Loads names and applies to resources from 'public.xml' + file +Flags: + -clean-meta Cleans META-INF directory along with signature block. + -f Force delete output path. + -fix-types Corrects resource type names based on usages and values + -h | -help | --help Displays this help and exit. +Examples: + 1) [Basic] + java -jar APKEditor.jar x -i path/input.apk -o path/output.apk +``` +
#### 5- Protect @@ -142,7 +329,34 @@ Protects apk resources against almost all known decompile/modify tools. 02.451 I: [PROTECT] Done ``` +
more info +```ShellSession +Protects/Obfuscates apk resource files. Using unique obfuscation techniques. +Options: + -i Input path. + -keep-type Keep specific resource type names (e.g drawable), By + default keeps only resource type. + *Can be multiple + -o Output path. Optional, if not provided then a new file + will be generated on same directory as input +Flags: + -confuse-zip Confuse zip structure. When this turned on: + * Apps might crash if accessing apk files directly e.g + Class.getResourceAsStream(). + * Some apk scanners might flag it as "Malformed zip" + -dic-dir-names Path to a text file containing a list of directory + names separated by new line. + -dic-file-names Path to a text file containing a list of file names + separated by new line. + -f Force delete output path. + -h | -help | --help Displays this help and exit. + -skip-manifest Do not protect manifest. +Examples: + 1) [Basic] + java -jar APKEditor.jar p -i path/input.apk -o path/output.apk +``` +
#### 6- Info (⭐NEW⭐) @@ -164,7 +378,71 @@ Package name=com.mypackage id=0x7f () #006400 ``` +
more info +```ShellSession +Prints information of apk. +Options: + -filter-type Prints only the specified resource type names + *This applies only when flag '-resources' used. + *Can be multiple. + -framework Path of framework file (can be multiple). + -framework-version Preferred framework version number + -i Input path. + -o Output path. Optional, if not provided then a new file + will be generated on same directory as input + -res Prints resource entries specified by either of: + 1) Hex or decimal resource id. + 2) Full resource name e.g @string/app_name. + *Can be multiple. + -xmlstrings Print the strings of the given compiled xml assets. + *Can be multiple + -xmltree Prints the compiled xmls in the given assets. + *Can be multiple + -t Print types/formats: + [text, json, xml] +Flags: + -activities Prints main activity class name. If verbose mode, + prints all declared activities including + . + -app-class Application class name. + -app-icon App icon path/value. If verbose mode, prints all + configurations. + -app-name App name. If verbose mode, prints all configurations. + -app-round-icon App round icon path/value. If verbose mode, prints all + configurations. + -configurations Print the configurations in the APK. + -dex Prints dex information. + -f Force delete output path. + -h | -help | --help Displays this help and exit. + -languages Print the languages in the APK. + -list-files List files inside apk. + -list-xml-files List compiled xml files inside apk. + -locales Print the locales in the APK. + -min-sdk-version Minimum SDK version. + -package Package name(application id) from manifest and if + verbose mode, prints resource table packages. + -permissions Permissions. + -resources Prints all resources + -signatures Prints signature information. + -signatures-base64 Prints signature information with base64 certificates. + -strings Print the contents of the resource table string pool in + the APK. + -target-sdk-version Target SDK version. + -v Verbose mode. + -version-code App version code. + -version-name App version name. +Examples: + 1) [Basic] + java -jar APKEditor.jar info -i file.apk + 2) [Specify output and type] + java -jar APKEditor.jar info -i path/input.apk -t json -v -o + info_file.json + 3) [Print only specific type] + java -jar APKEditor.jar info -i path/input.apk -resources -filter-type + drawable +``` +