Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Frida snippet used to hook hashing methods
Java.perform(function() {
const target = Java.use('nl.avro.demol.base.extensions.StringKt');
target.calculateHmac.implementation = function() {
const args = JSON.stringify(arguments, null, 2);
const retVal = target.calculateHmac.apply(this, arguments);
console.log('[!] calculateHmac called!');
console.log('Arguments:', args);
return retVal;
}
target.hmac.implementation = function() {
const args = JSON.stringify(arguments, null, 2);
const retVal = target.hmac.apply(this, arguments);
console.log('[!] hmac called!');
console.log('Arguments:', args);
var buffer = Java.array('byte', retVal);
var result = "";
for (var i = 0; i < buffer.length; ++i) {
result+= (String.fromCharCode(buffer[i]));
}
console.log('Return value: ', result);
return retVal;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment