Suggestions to improve Lucky Patcher custom patches

Active 2 Replies 2.8K Views 2022-09-13 00:31:57 General
Hi, I have suggestions to improve Lucky Patcher custom patches. (Based on my failed attempts at creating a decent patch)

- Support using saved W0,W1.. variables in searches like:

{"search":"?? ?? ?? R0 R1"}
{"search":"W0 W1 ?? R2 R3"}

- Support using R0,R1.. in "original" patterns. This could simplify patches and make grouping easier. (can "search" currently be grouped/ignored when determining the patch result?)

- Support using W0,W1.. in "original" patterns. It seems buggy if it is actually supported.

- Partial search/match/replace like 0? 9? ?1 ?B instead of ??, this could be useful.

- Skip a replacement if any of the W* variables used in "original" or "replaced" patterns are empty. Currently the patterns are being replaced with a bad code if the search has failed.

- If a search was not successful or a PATCH ALL FILES pattern was not found I get the red screen with "Not all patterns are replaced". A failed search by itself shouldn't cause this warning if all the replacement patterns or groups were successful. PATCH ALL FILES patterns I assume cannot currently be grouped with the CLASSES patterns. I would like the ability to group or ignore any failed searches or patterns which do not necessarily change the patch results and shouldn't be reported as a failure.

- Support finding and matching per-file hex values of string/field/method ids with variables to be used in CLASSES search/original/replaced patterns (to be only used within the same file). This would be useful when it isn't possible to modify a code without increasing the file size or using risky patterns. It would help with creating shorter and more accurate patches.

Examples:

{"string":"true"}
{"string_id":"X0 X1"}

{"string":"false"}
{"string_id":"X2 X3"}

{"original":"1A ?? X2 X3"}
{"replaced":"?? ?? X0 X1"}

{"field":"Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;"}
{"field_id":"V0 V1"}

{"field":"Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;"}
{"field_id":"V2 V3"}

{"method":"Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;"}
{"method_id":"M0 M1"}

{"original":"62 ?? V2 V3"}
{"replaced":"?? ?? V0 V1"}

{"search":"71 ?? M0 M1 ?? ?? 0C R0"}

{"group":"1"}
{"original":"71 ?? M0 M1 ?? ?? 0C ??"}
{"replaced":"62 W0 V0 V1 00 00 00 00"}

{"group":"1"}
{"original":"71 ?? M0 M1 ?? ?? 0C ??"}
{"replaced":"1A W0 X0 X1 00 00 00 00"}

If it's hard to support all of that, providing per-file field_id variables for just these two would be good enough (like V0 V1 for true, and V2 V3 for false in CLASSES patterns):

Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;
Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;

Sharing is caring, show love and share the thread with your friends.


Marisa replied
1 Year

Hello developer, I wanted to ask if you can bring a deep function to remove Ads ads completely 100% from any APKs, as today Apks are different with Ads, Lucky Patcher can't boot 100% of ads completely, please bring a function that can remove 100% of ads from all apks

chelpus replied
1 Year

There are a lot of wishes here. All this is very difficult to do and threatens with an abundant number of bugs. For example, pattern matching with variables that are already being looked up is not possible. The search takes place in one pass, and this leads to the fact that you cannot search for variables that have not yet been found. The engine for custom patches created from small to large, and therefore the code there is very complex and bad to modify it so globally. And don't forget that lucky patcher is a patcher, not a smali editor. It was not originally intended to operate with variables there. And it's hard to implement. For example, I can add for search string id - two or four bytes, depending on the bit depth of the strings. It's relatively easy. But adding a field id search is already much more difficult, at the moment it’s not very realistic. Construction 0? ?5 etc. implies the offset of each byte in the file, this will lead to catastrophic speed degradation and the patch process may not be completed due to the actions of the system to complete the hung process :smile: Sorry for my bad English, my native Russian. For your purposes, of course, patches for MT manager or other similar smali patchers would be more suitable.


And I have very little free time for such a global work. I can fix something on the little things or add :smile:

And it's better to write such things directly to my mail [email protected]. Here on the forum I can skip it, as I avoid communicating in English. And the main message traffic here is a request to hack something that I will not do :smile:

loading...