Java
Hooking de función.
Copiar Java .perform ( function () {
var classRef = Java .use ( "<package-name>.<class-name>" );
classRef. <function - name >. implementation = function () {
return this . <function - name >();
}
});
Cambiar el valor de retorno de una función.
Copiar Java .perform ( function () {
var classRef = Java .use ( "<package-name>.<class-name>" );
classRef. <function - name >. implementation = function () {
var ret_val = this . <function - name >();
console .log ( "[*] Original return value" , ret_val);
var new_ret_val = < new-value >;
console.log("[*] New return value", new_ret_val);
return new_ret_val;
}
});
Cambiar el valor booleano de retorno de una función a false
.
Copiar Java .perform ( function () {
var classRef = Java .use ( "<package-name>.<class-name>" );
classRef. <function - name >. implementation = function () {
var ret_val = this . <function - name >();
console .log ( "[*] Original return value " + ret_val);
// Alternative 1
var new_ret_val = false ;
// Alternative 2
var new_ret_val = Java .use ( "java.lang.Boolean" ) .$new ( false );
console .log ( "[*] New return value " + new_ret_val);
return new_ret_val;
}
});
Ejecutar método estático (static method).
Copiar Java .perform ( function () {
var classRef = Java .use ( "<package-name>.<class-name>" );
classRef. < method - name > ();
});
Cambiar el valor de una variable.
Copiar Java .perform ( function (){
var classRef = Java .use ( "<package-name>.<class-name>" );
classRef. < variable - name > .value = < new-value >;
});
Ejecutar método de una clase no estática.
Copiar Java .perform ( function () {
var classRef = Java .use ( "<package-name>.<class-name>" );
var classInstance = classRef .$new ();
classInstance. < method - name > ();
});
Hooking de constructor.
Copiar Java .perform ( function () {
var classRef = Java .use ( "<package-name>.<class-name>" );
classRef . $init . implementation = function () {
this .$init ();
}
});
Ejecutar método en una instancia existente.
Copiar Java .performNow ( function () {
Java .choose ( "<package-name>.<class-name>" , {
onMatch : function (instance) {
instance. < method - name > ();
} ,
onComplete : function () {}
});
});
Proporcionar un objeto como argumento a un método y ejecutarlo en una instancia existente.
Copiar Java .performNow ( function () {
Java .choose ( "<package-name>.<class-name>" , {
onMatch : function (instance) {
var classRef = Java .use ( "<package-name>.<class-name>" );
var obj = classRef .$new ();
obj. < variable - name > .value = < value >;
instance.< method-name >(obj);
},
onComplete: function() {}
});
});
Native libraries
Última actualización hace 1 mes