1

I'm working with some blackbox minified/obscured javascript that runs console.log('hoyo') when it's ready for action.

I'd like to trigger an event when that value is logged to the console (I know this is bootleg). Is it possible to do so? Any advice would be helpful!

duhaime
  • 25,611
  • 17
  • 169
  • 224

1 Answers1

2

Is overriding console.log a possibility? Like here:

var og = console.log;

console.log = function(arg) {
  if (arg == 'heyo') alert('send the missles!');
  og(arg);
}

ps. not enough rep to post it as a comment...

duhaime
  • 25,611
  • 17
  • 169
  • 224
Tom
  • 244
  • 2
  • 4
  • I'm embarrassed I didn't think of that. I'll accept this as soon as SO lets me. Thanks for this simple solution! – duhaime Jun 09 '20 at 00:14