DebugProtectionFunctionTemplate.ts 801 B

12345678910111213141516171819202122232425
  1. import { Utils } from "../../../../Utils";
  2. /**
  3. * @param debugProtectionFunctionName
  4. * @returns {string}
  5. */
  6. export function DebugProtectionFunctionTemplate (debugProtectionFunctionName: string): string {
  7. return `
  8. var ${debugProtectionFunctionName} = function () {
  9. function debuggerProtection (counter) {
  10. if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {
  11. (function () {}.constructor('debugger')());
  12. } else {
  13. [].filter.constructor(${Utils.stringToJSFuck('debugger')})();
  14. }
  15. debuggerProtection(++counter);
  16. }
  17. try {
  18. debuggerProtection(0);
  19. } catch (y) {}
  20. };
  21. `;
  22. }