LSPosed/LSPlant — 1.4k★ on GitHub (C++). A hook framework for Android Runtime (ART)
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Initialize LSPlant for the proceeding hook. It mainly prefetch needed symbols and hook some functions.
env is the Java environment.
info is the information for initialized.
Basically, the info provides the inline hooker and unhooker together with a symbol resolver of libart.so to hook and extract needed native functions of ART.
bool Init(JNIEnv *env,
const InitInfo &info);
Returns whether initialization succeed. Behavior is undefined if calling other LSPlant interfaces before initialization or after a fail initialization.
2. Hook
Hook a Java method by providing the target_method together with the context object hooker_object and its callback callback_method.
env is the Java environment.
target_method is an Method object to the method you want to hook.
hooker_object is an object to store the context of the hook.
The most likely usage is to store the backup method into it so that when callback_method is invoked, it can call the original method. Another scenario is that, for example, in Xposed framework, multiple modules can hook the same Java method and the hooker_object can be used to store all the callbacks to allow multiple modules work simultaneously without conflict.
callback_method is an Method object, the callback method to the hooker_object used to replace the target_method.
Whenever the target_method is invoked, the callback_method will be invoked instead of the original target_method. The signature of the callback_method must be: public Object callback_method(Object []args).
That is, the return type must be Object and the parameter type must be Object[]. Behavior is undefined if the signature does not match the requirement. Extra info can be provided by defining member variables of hooker_object. This method must be a method to hooker_object.
Returns the backup method. You can invoke it by reflection to invoke the original method. null if fails.
This function will automatically generate a stub class for hook. To help debug, you can set the generated class name, its field name, its source name and its method name by setting generated_* in InitInfo.
This function thread safe (you can call it simultaneously from multiple thread) but it's not atomic to the same target_method. That means UnHook or IsUnhook does not guarantee to work properly on the same target_method before it returns. Also, simultaneously call on this function with the same target_method does not guarantee only one will success. If you call this with different hooker_object on the same target_method simultaneously, the behavior is undefined.
3. Check
Check if a Java function is hooked by LSPlant or not.
bool IsHooked(JNIEnv *env,
jobject method);
Returns whether the method is hooked.
4. Unhook
Unhook a Java function that is previously hooked.
env is the Java environment.
target_method is an Method object to the method you want to hook.
bool UnHook(JNIEnv *env,
jobject target_method);
Returns whether the unhook succeed.
Calling backup (the return method of Hook()) after unhooking is undefined behavior. Please read Hook()'s note for more details.
5. Deoptimize
Deoptimize a method to avoid hooked callee not being called because of inline.
env is the Java environment.
method is an Method object to the method to deoptimize.
By deoptimizing the method, the method will back all callee without inlining. For example, if you hooked a short method B that is invoked by method A, and you find that your callback to B is not invoked after hooking, then it may mean A has inlined B inside its method body. To force A to call your hooked B, you can deoptimize A and then your hook can take effect. Generally, you need to find all the callers of your hooked callee and that can be hardly achieve. Use this function if you are sure the deoptimized callers are all you need. Otherwise, it would be better to change the hook point or to deoptimize the whole app manually (by simple reinstall the app without uninstalled).
bool Deoptimize(JNIEnv *env,
jobject method);
Returns whether the deoptimizing succeed or not.
It is safe to call deoptimizing on a hooked method because the deoptimization will perform on the backup method instead.
The most recent commit recorded on LSPosed/LSPlant was 18 days ago, based on the GitHub push timestamp. The repository has 344 forks — one of the better signals of community interest.
How many stars does LSPosed/LSPlant have?
LSPosed/LSPlant has 1.4k GitHub stars — refresh the page for the live number, or check github.com/LSPosed/LSPlant. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is LSPosed/LSPlant written in?
LSPosed/LSPlant is written primarily in C++. GitHub's language field is based on the largest share of bytes in the default branch.
What license does LSPosed/LSPlant use?
LSPosed/LSPlant is released under the LGPL-3.0 license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
What topics is LSPosed/LSPlant associated with?
GitHub's repository topics for LSPosed/LSPlant: "android", "hook". TopGit's editorial category is Mobile.
Where can I see LSPosed/LSPlant in action?
The project maintains a homepage at https://lsposed.org/LSPlant/. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about LSPosed/LSPlant?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/LSPosed/LSPlant is the definitive source.
Read full README in the tab above.
Still deciding about LSPlant?
One click hands the question to an AI along with this page — see what it says about LSPlant.