diff --git a/tests/test.py b/tests/test.py index eb6a6f5..e7ec567 100644 --- a/tests/test.py +++ b/tests/test.py @@ -156,7 +156,7 @@ args = [ # new_code = Code(code.registers_size, code.ins_size, code.outs_size, new_insns) # dyn_load_apk.set_method_code(method_id, code) -NB_APK = 8666 +NB_APK = 8665 list_cls = list(dyn_load_apk.classes.keys()) list_cls.sort() @@ -179,7 +179,7 @@ print("[+] Repackage") # ) -MAX_REQ = 3 +MAX_REQ = 8 def cmp(a, b, req=0): @@ -207,8 +207,8 @@ def cmp_other(a, b, req=0): len(f) < 2 or f[:2] != "__" ): eq = getattr(a, f) == getattr(b, f) - print(f"{f'{ident}{f}: ':<150}{nice_bool(eq)}") if not eq: + print(f"{f'{ident}{f}: ':<150}{nice_bool(eq)}") if "descriptor" in dir(a): global last_id last_id = a.descriptor @@ -243,8 +243,9 @@ def cmp_list(a, b, req=0): print(f"{ident}len(a) != len(b)") for i in range(min(la, lb)): eq = a[i] == b[i] - print(f"{f'{ident}{str(i)}: ':<150}{nice_bool(eq)}") if not eq: + print(f"{f'{ident}{str(i)}: ':<150}{nice_bool(eq)}") + print(f"{ident}: {str(a[i])} != {str(b[i])}") cmp(a[i], b[i], req + 1) @@ -252,5 +253,80 @@ instrumented_apk = Apk() instrumented_apk.add_dex_file(dex_raw[0]) cmp(instrumented_apk, dyn_load_apk) -for i in range(NB_APK - 5, NB_APK + 5): - print(f"{i}: {str(list_cls[i])}") + +MAX_REQ = 5 + +tys = [ + IdType("Landroidx/compose/foundation/MutatePriority;"), + IdType( + "Landroidx/compose/ui/input/pointer/PointerInteropFilter$DispatchToViewState;" + ), + IdType("Landroidx/compose/ui/autofill/AutofillType;"), + IdType("Landroidx/compose/material3/TextFieldType;"), + IdType("Landroidx/compose/material3/SnackbarResult;"), + IdType("Landroidx/compose/ui/layout/MeasuringIntrinsics$IntrinsicMinMax;"), + IdType("Landroidx/compose/foundation/text/Handle;"), + IdType("Landroidx/compose/foundation/text/selection/SelectionMode;"), + IdType("Landroidx/compose/material3/SliderComponents;"), + IdType("Landroidx/lifecycle/Lifecycle$Event;"), + IdType("Landroidx/compose/ui/focus/FocusStateImpl;"), + IdType("Landroidx/fragment/app/strictmode/FragmentStrictMode$Flag;"), + IdType("Landroidx/compose/ui/text/style/ResolvedTextDirection;"), + IdType("Landroidx/compose/foundation/text/KeyCommand;"), + IdType("Landroidx/compose/ui/text/AnnotationType;"), + IdType("Landroidx/compose/foundation/layout/SizeMode;"), + IdType("Landroidx/compose/ui/semantics/NodeLocationHolder$ComparisonStrategy;"), + IdType("Landroidx/compose/material3/DrawerValue;"), + IdType("Landroidx/compose/ui/input/pointer/PointerEventPass;"), + IdType("Landroidx/compose/foundation/layout/Direction;"), + IdType("Landroidx/compose/ui/node/LayoutNode$UsageByParent;"), + IdType("Landroidx/compose/material3/tokens/TypographyKeyTokens;"), + IdType("Landroidx/compose/animation/core/RepeatMode;"), + IdType("Landroidx/compose/ui/layout/IntrinsicMinMax;"), + IdType("Landroidx/compose/ui/text/input/TextInputServiceAndroid$TextInputCommand;"), + IdType("Landroidx/compose/ui/unit/LayoutDirection;"), + IdType("Landroidx/collection/SparseArrayCompat;"), + IdType("Landroidx/compose/material3/TabSlots;"), + IdType("Landroidx/compose/material3/tokens/ColorSchemeKeyTokens;"), + IdType("Landroidx/annotation/RestrictTo$Scope;"), + IdType("Landroidx/profileinstaller/FileSectionType;"), + IdType("Landroidx/lifecycle/Lifecycle$State;"), + IdType("Landroidx/compose/animation/EnterExitState;"), + IdType("Landroidx/compose/animation/core/MutatePriority;"), + IdType("Landroidx/compose/ui/layout/MeasuringIntrinsics$IntrinsicWidthHeight;"), + IdType("Landroidx/loader/content/ModernAsyncTask$Status;"), + IdType("Landroidx/annotation/InspectableProperty$ValueType;"), + IdType("Landroidx/compose/foundation/layout/LayoutOrientation;"), + IdType("Landroidx/compose/ui/node/NodeMeasuringIntrinsics$IntrinsicMinMax;"), + IdType("Landroidx/compose/material3/tokens/ShapeKeyTokens;"), + IdType("Landroidx/compose/ui/node/LayoutNode$LayoutState;"), + IdType("Landroidx/compose/runtime/InvalidationResult;"), + IdType("Landroidx/compose/ui/layout/IntrinsicWidthHeight;"), + IdType("Landroidx/compose/ui/node/NodeMeasuringIntrinsics$IntrinsicWidthHeight;"), + IdType("Landroidx/compose/runtime/Recomposer$State;"), + IdType("Landroidx/compose/foundation/gestures/Orientation;"), + IdType("Landroidx/compose/material3/ScaffoldLayoutContent;"), + IdType("Landroidx/compose/foundation/text/selection/HandleReferencePoint;"), + IdType("Landroidx/compose/material3/SnackbarDuration;"), + IdType("Landroidx/compose/ui/platform/TextToolbarStatus;"), + IdType("Landroidx/compose/material3/InputPhase;"), + IdType("Landroidx/compose/ui/window/SecureFlagPolicy;"), + IdType("Landroidx/collection/LongSparseArray;"), + IdType("Landroidx/compose/animation/core/AnimationEndReason;"), + IdType("Landroidx/compose/foundation/text/HandleState;"), + IdType("Landroidx/compose/ui/state/ToggleableState;"), + IdType("Landroidx/compose/ui/text/android/animation/SegmentType;"), + IdType("Landroidx/compose/ui/platform/actionmodecallback/MenuItemOption;"), + IdType("Landroidx/compose/foundation/layout/IntrinsicSize;"), + IdType("Landroidx/compose/ui/platform/actionmodecallback/MenuItemOption;"), +] +instrumented_apk_classes = instrumented_apk.classes +dyn_load_apk_classes = dyn_load_apk.classes +for ty in tys: + if instrumented_apk_classes[ty].annotations != dyn_load_apk_classes[ty].annotations: + print(f"-> {str(ty)}") + # invoke-virtual {0} Landroid/animation/Animator;->end()V != invoke-virtual {0} [Ljava/lang/Object;->clone()Ljava/lang/Object; + cmp( + instrumented_apk.classes[ty], + dyn_load_apk.classes[ty], + )