Skip to content

Instantly share code, notes, and snippets.

@Intyre

Intyre/bytes.js Secret

Created June 16, 2016 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Intyre/60c9256b0fe0fc2ab9d0fadbe37d3a53 to your computer and use it in GitHub Desktop.
Save Intyre/60c9256b0fe0fc2ab9d0fadbe37d3a53 to your computer and use it in GitHub Desktop.
{
onEnter: function (log, args, state) {
log(%(log_str)s);
this.b = args[1];
},
onLeave: function (log, retval, state) {
rlen = Memory.readShort(this.b)/8;
uint8arr = new Uint8Array(Memory.readByteArray(this.b.add(0x11), rlen));
var hexStr = '';
for (var i = 0; i < uint8arr.length; i++) {
var hex = (uint8arr[i] & 0xff).toString(16);
hex = (hex.length === 1) ? '0' + hex : hex;
hexStr += hex;
}
log(hexStr);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment