firda Hook类的所有方法,遇到的重载问题
在练习用frida hook java类所有方法时,遇到如下问题,请高手指点,怎么改?Error: setName(): argument types do not match any of:
.overload('java.lang.String')
at ge (frida/node_modules/frida-java-bridge/lib/class-factory.js:584)
at frida/node_modules/frida-java-bridge/lib/class-factory.js:996
at je (frida/node_modules/frida-java-bridge/lib/class-factory.js:633)
at frida/node_modules/frida-java-bridge/lib/class-factory.js:616
hook代码如下:
//获取所有方法,并Hook
function HookAllMethod() {
var student=Java.use('com.example.encrptiondemo.Person');
var methods=student.class.getDeclaredMethods();
for (var i=0;i<methods.length;i++){
var methodName=methods.getName();
console.log(methodName);
//多个重载
for(var k=0;k<student.overloads.length;k++){
student.overloads.implementation=function() {
console.log("arguments:",JSON.stringify(arguments));
//多个参数
for (var j=0;j<arguments.length;j++){
console.log(arguments);
}
return this.apply(this,arguments);
}
}
}
}
android源码如下:package com.example.encrptiondemo;
public class Person {
private String name;
private int age;
public Person() {
}
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public Person(Student student){
this.name=student.getName();
this.age=student.getAge();
}
public void print(){
System.out.println(serialize());
}
public String serialize(){
return this.name+","+this.age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
函数名.overload("数据类型")
页:
[1]