pre*_*bot 4 javascript java android frida
当我用 Frida 连接 Android 应用程序时,我一直在尝试打印列表的内容,但没有任何运气。
我想在Java中挂钩的对象看起来像这样
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.List;
public final class Hello extends HelloParent{
@JsonIgnore
public final List sampleList;
}
Run Code Online (Sandbox Code Playgroud)
这个公共对象没有任何吸气剂,所以我必须求助于使用另一个对象(我们称该对象为“Bye”)的方法(byeMethodB)来监视这个值。
这就是我的 frida 脚本的样子:
setTimeout(function() {
Java.perform(function(){
Java.use("Bye").byeMethodA.implementation = function(){
try{
//Returns a Hello object
var helloObject = Java.cast(this.byeMethodB(),Java.use("Hello"))
printListContent(Java.cast(helloObject.sampleList,Java.use("java.util.List"))))
}catch(err){
console.log(err)
}
}
})
},1000)
function printListContent(list){
var listIter = list.iterator()
while(listIter.hasNext()){
console.log(listIter.next())
}
}
Run Code Online (Sandbox Code Playgroud)
如果不将“helloObject.sampleList”对象转换为列表,输出将如下所示:
[object Object]
Run Code Online (Sandbox Code Playgroud)
所以我确信它不为空
如果我使用 进行投射Java.cast(helloObject.sampleList,Java.use("java.util.List")),
我收到以下错误:
我也尝试过:
Java.cast(helloObject.sampleList,Java.use("java.util.List<>"))
(我很确定它是一个字符串)
Java.cast(helloObject.sampleList,Java.use("java.util.List<String>"))
Java.cast(helloObject.sampleList,Java.use("java.util.List<java.lang.String>"))
Java.cast(helloObject.sampleList,Java.use("[String"))
Java.cast(helloObject.sampleList,Java.use("[Ljava.lang.String"))
进展一点也不顺利。希望得到一些帮助
Frida 中的字段访问与 Java 中的字段访问不同。如果您helloObject.sampleList在 Frida 中执行,您将获得描述该字段的 JavaScript 对象,而不是字段值本身。
如果您想要字段值,则必须执行helloObject.sampleList.value.
因此以下代码应该有效:
Java.cast(helloObject.sampleList.value, Java.use("java.util.List"));
Run Code Online (Sandbox Code Playgroud)
泛型仅存在于编译时,但 frida 在运行时工作。因此java.util.List<>,其他带尖括号的类名将永远不起作用。
| 归档时间: |
|
| 查看次数: |
8920 次 |
| 最近记录: |