Hem
Hem

Reputation: 715

Call Intent(this, SomeClass.class) in Frida

How would I go about calling the equivalent of this in Frida?

Intent newIntent = new Intent(this, SomeClass.class);

Which was called from a Java function.

I have tried doing something such as:

var intent = Java.use('android.content.Intent');
var randClass = Java.use("RandClass");
var someClass = Java.use("SomeClass");

randClass.func.implementation = function() {
   var result = intent(randClass, someClass);
}

Which did not work.

Upvotes: 3

Views: 3288

Answers (1)

James W.
James W.

Reputation: 3055

Use $new to create new instance and .class or cast to java.lang.Class

randClass.func.implementation = function() {
   var result = intent.$new(/*currentActivity*/, someClass.class);
}

You need save the current activity, hooking onCreate might do the job.

Upvotes: 3

Related Questions