Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow fingerprint matching based on instance of #176

Open
3 tasks done
LisoUseInAIKyrios opened this issue May 14, 2023 · 4 comments
Open
3 tasks done

feat: allow fingerprint matching based on instance of #176

LisoUseInAIKyrios opened this issue May 14, 2023 · 4 comments
Labels
Feature request Requesting a new feature that's not implemented yet

Comments

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented May 14, 2023

Type

Functionality

Issue

Currently, method fingerprints match using exact class match (or more specifically, 'starts with' matching of a class name).
It does not allow polymorphic matching, such as comparing what the class is an instance of.

For example. A target method takes a two obfuscated parameters:
private void a(Lfoo;Lbar;)

Currently it is only possible to match this method by specifying a signature with 2 parameters of any kind of objects:

MethodFingerprint(
parameters = listOf("L", "L")

But looking a these classes we see that:

Lfoo; extends Ljava/lang/Enum;
Lbar; implements Ljava/util/map;

So the method signature should allow specifying an 'instance of' like comparison. Perhaps this can be done by specifying a prefix to the class name:
parameters = listOf("instanceof:Ljava/lang/Enum;", "instanceof:Ljava/util/map;")

This same logic could be used for the return type as well:
returnType = "instanceof:Ljava/util/list;"

Feature

add polymorphic matching to method signatures.

Motivation

Allow better signature matching

Additional context

No response

Acknowledgements

  • I have searched the existing issues and this is a new and no duplicate or related to another open issue.
  • I have written a short but informative title.
  • I filled out all of the requested information in this issue properly.
@LisoUseInAIKyrios LisoUseInAIKyrios added the Feature request Requesting a new feature that's not implemented yet label May 14, 2023
@oSumAtrIX
Copy link
Member

This is a limitation of the underlying library. At first, the class would have to be found, and then super classes would have to be checked for; this can significantly increase resolution times.

@oSumAtrIX
Copy link
Member

In most cases, such specific matching capabilities are not required, customFingerprint is usually enough.

@LisoUseInAIKyrios
Copy link
Contributor Author

The class implementation lookup would be done once when the patcher starts, so any performance cost would be paid just once and is not affected by how many patches are used.

I suppose that since opcodes are usually needed to be matched, having this much fine grained control may not matter.

@oSumAtrIX
Copy link
Member

I believe fine grained control is much better done in customFingerprint. Currently you have access to the current class and method that is being tried to resolve the fingerprint on. This can be adjusted in any shape so that for example access to all classes is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Requesting a new feature that's not implemented yet
Projects
None yet
Development

No branches or pull requests

2 participants