Help FindHookMethod - Xposed General

to the point How to findAndHookMethod this method:
Code:
public static ujiCoba(String[] string) {
}
i've tried with code bellow, but didnt work
Code:
findAndHookMethod(findClass, classLoader, String.class, hook);

You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.

GermainZ said:
You're not passing the method's name to findAndHookMethod. Also, the argument's class should be String[].class.
Click to expand...
Click to collapse
i'm typo.
its work

hi @GermainZ. last qustion..
Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?

riskey95 said:
hi @GermainZ. last qustion..
Code:
private static void getDetail(Context context, long l1, Info info, int i, long l2) {
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), Uri.parser(Prefs.PARSER), new String[] {"status","sent","date"}, "group_id=", l1, null, null);
}
method like that make me confuse. i want change sent to received, how can i do this?
Click to expand...
Click to collapse
You can replace the method and replicate these two lines, doing whatever modifications you want.
See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.

GermainZ said:
You can replace the method and replicate these two lines, doing whatever modifications you want.
See:
XC_MethodReplacement to replace the method,
findClass to get the SqliteWrapper class,
callStaticMethod to call SqliteWrapper.query.
The rest should be covered in the development tutorial/wiki.
Click to expand...
Click to collapse
that method very long and i dont have full of source code. so i can't replace method.

riskey95 said:
that method very long and i dont have full of source code. so i can't replace method.
Click to expand...
Click to collapse
Next best thing I can think of:
in beforeHookedMethod for getDetail, hook SqliteWrapper.query.
In that hook, check if the third argument is equal to the string array you want. If so, change it.
In afterHookedMethod for getDetail, unhook SqliteWrapper.query.

Related

[Q] who to moderate back key press in WP8.1

Hi every one
In WP8 we could use
Protected Override Void OnbackKeyPress(....e)
{
}
Now I didn't find such thing in windows Phone 8.1 ! Can anyone help me with this ?
and my other Q is : where is the messagebox.show ? and also Isolated Storage ?!
Now I think get an absolutely Noooob again
ngame said:
Hi every one
In WP8 we could use
Protected Override Void OnbackKeyPress(....e)
{
}
Now I didn't find such thing in windows Phone 8.1 ! Can anyone help me with this ?
and my other Q is : where is the messagebox.show ? and also Isolated Storage ?!
Now I think get an absolutely Noooob again
Click to expand...
Click to collapse
Hi,
instead of overriding OnbackKeyPress you have to register the event
...
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
...
void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
// your code
e.Handled = true; // if you wanna prevent that the "standard"-eventhandler is called and your app getting closed
}
Best,
ElStoney said:
Hi,
instead of overriding OnbackKeyPress you have to register the event
...
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
...
void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
// your code
e.Handled = true; // if you wanna prevent that the "standard"-eventhandler is called and your app getting closed
}
Best,
Click to expand...
Click to collapse
Thanks.
And what about isolated storage?
I can't use them any more and power tools ran out
Look for StorageFile and StorageFolder:
http://msdn.microsoft.com/de-de/library/windows/apps/windows.storage.aspx
And here is a Storage Helper class from Jerry Nixon that is useful: http://codepaste.net/gtu5mq

findAndHookMethod help!

Hi all,
I need to set an hook to a method whose signature is
public ArrayList<Object> populateList(Map<String, Object> paramMap, boolean paramBoolean1, boolean paramBoolean2)
I do not seem able to retrieve the class for the first parameter (ie: Map<String, Object>). What sintax am I supposed to use when invoking the hook method?
findAndHookMethod(classString, lpparam.classloader, "populateList", ?????, boolean.class, boolean.class, new XC_MethodHook() {...}
Thanks in advance
Silver.
slvrbllt said:
Hi all,
I need to set an hook to a method whose signature is
public ArrayList<Object> populateList(Map<String, Object> paramMap, boolean paramBoolean1, boolean paramBoolean2)
I do not seem able to retrieve the class for the first parameter (ie: Map<String, Object>). What sintax am I supposed to use when invoking the hook method?
findAndHookMethod(classString, lpparam.classloader, "populateList", ?????, boolean.class, boolean.class, new XC_MethodHook() {...}
Thanks in advance
Silver.
Click to expand...
Click to collapse
Try "Map.class".
Off the top of my head, I think generics are not part of the method signatures with regards to uniqueness; they only serve to aid the compiler in checking types during compilation.
Tungstwenty said:
Try "Map.class".
Click to expand...
Click to collapse
Duh!! It worked...
Thanks mate!

[Q] Replacing Android internal resources

I'm trying to create a Xposed Module which will replace some internal strings, but I can't find any way to do it.
The strings I want to replace are "com.android.internal.R.string.am" and "com.android.internal.R.string.pm".
Can somebody give me any advice?
Code:
XResources.setSystemWideReplacement("android", "string", "am", "AM");
Above code doesn't have any effect
Code:
XResources.setSystemWideReplacement(com.android.internal.R.string.am, "AM");
Above code doesn't even compile
Code:
Resources.getSystem().getIdentifier("am", "string", "android")
Above code always returns 0 (zero).
Did you try "com.android.internal" (quotes included – as a string)?
GermainZ said:
Did you try "com.android.internal" (quotes included – as a string)?
Click to expand...
Click to collapse
Yes, I did
Code:
XResources.setSystemWideReplacement("com.android.internal", "string", "am", "AM");
Code:
NotFoundException: com.android.internal:string/am
"android" works for me. I'm not sure how/where you're using that code, though. Could you please paste all of it?
GermainZ said:
"android" works for me. I'm not sure how/where you're using that code, though. Could you please paste all of it?
Click to expand...
Click to collapse
Code:
public class AmPmFixer implements IXposedHookZygoteInit{
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
XResources.setSystemWideReplacement("com.android.internal", "string", "am", "AM");
XResources.setSystemWideReplacement("com.android.internal", "string", "pm", "PM");
}
}
change com.android.internal to android
pyler said:
change com.android.internal to android
Click to expand...
Click to collapse
Anyway...
Code:
NotFoundException: android:string/am

Hook method in handler

My code
Code:
XposedHelpers.findAndHookMethod("com.android.packageinstaller.InstallAppProgress$mHandler",
lpparam.classLoader, "handleMessage", Message.class, new XC_MethodHook(){
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {...
https://github.com/android/platform...roid/packageinstaller/InstallAppProgress.java
I want hook method "handleMessage". But it doesnt work. Method not found.
pyler said:
My code
Code:
XposedHelpers.findAndHookMethod("com.android.packageinstaller.InstallAppProgress$mHandler",
lpparam.classLoader, "handleMessage", Message.class, new XC_MethodHook(){
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {...
https://github.com/android/platform...roid/packageinstaller/InstallAppProgress.java
I want hook method "handleMessage". But it doesnt work. Method not found.
Click to expand...
Click to collapse
are you sure InstallAppProgress$mHandler was exist? i've try to decompile Packageinstaller.apk of my phone and InstallAppProgress$mHandler doesn't exist, method handleMessage on my phone belong to InstallAppProgress$1.class
riskey95 said:
are you sure InstallAppProgress$mHandler was exist? i've try to decompile Packageinstaller.apk of my phone and InstallAppProgress$mHandler doesn't exist, method handleMessage on my phone belong to InstallAppProgress$1.class
Click to expand...
Click to collapse
I tried to remove $mHandler but still it isnt working.
Maybe @GermainZ can help?
That's an anonymous class, it'll be called InstallAppProgress$number. "number" is a counter (starts at 1, ends at n, where n is the number if anonymous classes in the enclosing class) chosen by the compiler at compile time. It's not guaranteed to stay the same.
You can hook it as riskey95 said, but it might not be InstallAppProgress$1 everywhere (could be e.g. InstallAppProgress$2). TIAS, and maybe blindly try hooking $1 to $3 if necessary (use a try/catch statement).
$1 worked. Now I need to get access to mDoneButton. But I cant since I am in InstallAppDetails$1.
Code:
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
//prefs.reload();
test = true;
if (test) {
Button mDone = (Button) XposedHelpers.getObjectField(
param.thisObject, "mDoneButton");
// todo
}
}
You can get the outer class using, for example:
Code:
XposedHelpers.getObjectField(param.thisObject, "this$0");
(There might be an Xposed helper or an alternate method to do that, I can't remember and I can't check right now.)
GermainZ said:
You can get the outer class using, for example:
Code:
XposedHelpers.getObjectField(param.thisObject, "this$0");
(There might be an Xposed helper or an alternate method to do that, I can't remember and I can't check right now.)
Click to expand...
Click to collapse
Fanstastic. All work now. I have to put your nick in XInstaller OP
Thank you.
p.s: found. getSurroundingThis
Hi,
can you please share the final code that worked for you in this case:
XposedHelpers.findAndHookMethod("com.android.packageinstaller.InstallAppProgress$mHandler",
lpparam.classLoader, "handleMessage", Message.class, new XC_MethodHook(){
@override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {...
Thanks!

[Newbie] Correct way to start some App when Android started

I finding a correct way to start some app when started Android or restared
I have something like
Code:
public void startSomeApp() {
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("xxx.xxx.xxx");
if (launchIntent != null) {
context.startActivity(launchIntent);
}
}
But was wonder a correct way where should I put?
I try to push to
Code:
public void initZygote(StartupParam startupParam) throws Throwable {
startSomeApp();
}
But problem with context, any trick please?
1001z said:
I finding a correct way to start some app when started Android or restared
I have something like
But was wonder a correct way where should I put?
I try to push to
But problem with context, any trick please?
Click to expand...
Click to collapse
The correct way is without Xposed! Use the Android BOOT_COMPLETED broadcast.

Categories

Resources