本帖最后由 as614001 于 2023-1-6 20:10 编辑
什么情况下会导致frida无法hook具体函数?
frida脚本可以遍历指定类下的的任意方法。但是当我具体hook函数的时候 无论是咋样或者重载都没有输出,像是hook失败一样。我百分百确定已经找到对应的正确的类。
package com.qidian.QDReader.readerengine.view.dialog;
.....省略
public final void updateView() {
String n8;
String string;
Integer[] selectInfo = getSelectInfo();
((QDUIButton) findViewById(R.id.rightBtn)).setTag(selectInfo);
int intValue = selectInfo[0].intValue();
int intValue2 = selectInfo[1].intValue();
int i10 = this.price - intValue2;
int i11 = intValue == 0 ? 1 : 0;
boolean z8 = i10 <= 0;
ChapterCard chapterCard = this.mChapterCard;
if (TextUtils.isEmpty(chapterCard == null ? null : chapterCard.getHint())) {
n8 = getContext().getString(R.string.b99);
} else {
ChapterCard chapterCard2 = this.mChapterCard;
n8 = kotlin.jvm.internal.r.n(",", chapterCard2 != null ? chapterCard2.getHint() : null);
}
kotlin.jvm.internal.r.d(n8, "if (TextUtils.isEmpty(mC…terCard?.Hint}\"\n }");
TextView textView = (TextView) findViewById(R.id.bottomDescTv);
if (i11 != 0) {
string = kotlin.jvm.internal.r.n(getContext().getString(R.string.bl6, String.valueOf(this.price)), n8);
} else if (z8) {
string = getContext().getString(R.string.bl7, String.valueOf(this.price), String.valueOf(intValue), String.valueOf(intValue2));
} else {
string = getContext().getString(R.string.bl8, String.valueOf(this.price), String.valueOf(intValue), String.valueOf(i10));
}
textView.setText(string);
((QDUIButton) findViewById(R.id.rightBtn)).setButtonState(i11);
if (i11 == 0 && !z8) {
if (i10 <= this.balance) {
((QDUIButton) findViewById(R.id.rightBtn)).setText(getContext().getString(R.string.blb, String.valueOf(i10)));
return;
} else {
((QDUIButton) findViewById(R.id.rightBtn)).setText(getContext().getString(R.string.bys));
return;
}
}
((QDUIButton) findViewById(R.id.rightBtn)).setText(getContext().getString(R.string.bla));
}
像这段就是某点打开购买页面加载对应支付页面并设置按钮text值
我的hook是 加重载也试过 但是就是不生效。但也不报错。
let QDChapterCardSheetDialog = Java.use("com.qidian.QDReader.readerengine.view.dialog.QDChapterCardSheetDialog");
QDChapterCardSheetDialog["updateView"].implementation = function () {
console.log('updateView is called');
let ret = this.updateView();
console.log('updateView ret value is ' + ret);
return ret;
};
|