js-confuser
js-confuser copied to clipboard
Better way of counter measures
In your current implementation, you're using an infinite loop, such as while (true) or for(;;)0, to halt script execution. While this approach works, it quickly reveals the source of the blockage when using standard debugging tools or breakpoints and for an experienced developer it will be pretty easy to prevent or cancel this.
However, I've discovered a more advanced and less detectable method by leveraging an immediately invoked asynchronous function, like this:
(async function f() { f(), f() });
What's remarkable is that, when using this method, it becomes extremely difficult to trace where the execution is getting stuck, as debugging tools—at least in Chromium and Firefox—fail to provide any clear indication. Additionally, by embedding a redirect inside this function, such as: window.location.href = "https://example.com/script-is-blocked"; the behavior becomes even harder to track or bypass.
It's important to note that the function must be asynchronous for this technique to work effectively.