-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support hook whole class & fix getClassLoader of HookFunction & add fst
- Loading branch information
Showing
3 changed files
with
112 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/src/main/java/io/github/a13e300/tools/objects/FindStackTraceFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.github.a13e300.tools.objects; | ||
|
||
import android.app.Activity; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.view.Window; | ||
|
||
import com.facebook.stetho.rhino.JsConsole; | ||
|
||
import org.mozilla.javascript.BaseFunction; | ||
import org.mozilla.javascript.Context; | ||
import org.mozilla.javascript.Scriptable; | ||
import org.mozilla.javascript.Wrapper; | ||
|
||
import de.robv.android.xposed.XposedHelpers; | ||
|
||
public class FindStackTraceFunction extends BaseFunction { | ||
@Override | ||
public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { | ||
if (args.length == 1) { | ||
var obj = args[0]; | ||
Throwable t; | ||
if (obj instanceof Wrapper) { | ||
obj = ((Wrapper) obj).unwrap(); | ||
} | ||
if (obj instanceof Throwable) { | ||
t = (Throwable) obj; | ||
} else { | ||
if (obj instanceof Activity) { | ||
obj = ((Activity) obj).getWindow(); | ||
} | ||
if (obj instanceof Window) { | ||
obj = ((Window) obj).getDecorView(); | ||
} | ||
if (obj instanceof View) { | ||
t = (Throwable) XposedHelpers.getObjectField( | ||
XposedHelpers.callMethod(obj, "getViewRootImpl"), | ||
"mLocation" | ||
); | ||
} else { | ||
throw new IllegalArgumentException("required a view or throwable!"); | ||
} | ||
} | ||
JsConsole.fromScope(scope).log(Log.getStackTraceString(t)); | ||
return null; | ||
} | ||
throw new IllegalArgumentException("must be 1 view or throwable arg !"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters