Skip to content

Instantly share code, notes, and snippets.

@ndrong
Created January 2, 2021 00:54
Show Gist options
  • Save ndrong/2dea662016704fb99edcf0e9c7961e5f to your computer and use it in GitHub Desktop.
Save ndrong/2dea662016704fb99edcf0e9c7961e5f to your computer and use it in GitHub Desktop.
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