fix switch and array alignement

This commit is contained in:
Jean-Marie 'Histausse' Mineau 2024-02-16 11:58:34 +01:00
parent cd6c638080
commit a0ecb1a18d
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
5 changed files with 165 additions and 51 deletions

56
test.py
View file

@ -59,24 +59,24 @@ print(f"[+] New code of {method_id} ")
for i in code.insns:
print(f" {i}")
# Strip class for debugging
classes = list(
filter(
lambda x: x
not in [
# IdType("Lcom/example/testapplication/ui/home/HomeViewModel;"),
# IdType("Landroidx/navigation/NavDeepLink$Builder;"),
# IdType("Landroidx/constraintlayout/core/widgets/ConstraintWidget$1;"),
# IdType("Landroidx/appcompat/app/ActionBar;"),
# IdType("Landroidx/constraintlayout/core/state/WidgetFrame;"),
IdType("Landroidx/appcompat/app/AppCompatViewInflater;"),
],
apk.classes.keys(),
)
)
for cls in classes:
apk.remove_class(cls)
# # Strip class for debugging
# classes = list(
# filter(
# lambda x: x
# not in [
# IdType("Lcom/example/testapplication/ui/home/HomeViewModel;"),
# IdType("Landroidx/navigation/NavDeepLink$Builder;"),
# IdType("Landroidx/constraintlayout/core/widgets/ConstraintWidget$1;"),
# IdType("Landroidx/appcompat/app/ActionBar;"),
# IdType("Landroidx/constraintlayout/core/state/WidgetFrame;"),
# IdType("Landroidx/appcompat/app/AppCompatViewInflater;"),
# ],
# apk.classes.keys(),
# )
# )
# for cls in classes:
# apk.remove_class(cls)
#
print("[+] Recompile")
dex_raw = apk.gen_raw_dex()
@ -86,16 +86,16 @@ for dex in dex_raw:
new_apk.add_dex_file(dex)
# print("[+] Repackage")
#
# utils.replace_dex(
# APK_NAME,
# APK_NAME.parent / (APK_NAME.name.removesuffix(".apk") + "-instrumented.apk"),
# dex_raw,
# Path().parent / "my-release-key.jks",
# zipalign=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "zipalign",
# apksigner=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "apksigner",
# )
print("[+] Repackage")
utils.replace_dex(
APK_NAME,
APK_NAME.parent / (APK_NAME.name.removesuffix(".apk") + "-instrumented.apk"),
dex_raw,
Path().parent / "my-release-key.jks",
zipalign=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "zipalign",
apksigner=Path.home() / "Android" / "Sdk" / "build-tools" / "34.0.0" / "apksigner",
)
last_id = None