Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

js-confuser

MichaelXF332.5kMIT2.0.0TypeScript support: included

JavaScript Obfuscation Tool.

obfuscator, obfuscation, uglify, code protection, javascript obfuscator, js obfuscator

readme

JS Confuser

JS-Confuser is a JavaScript obfuscation tool to make your programs impossible to read. Try the web version.

NPM GitHub Netlify

Key features

Documentation

Get started in the JS-Confuser Docs.

API Usage

Installation

$ npm install js-confuser

Usage

var JsConfuser = require("js-confuser");

JsConfuser.obfuscate(`
  function fibonacci(num){   
    var a = 0, b = 1, c = num;
    while (num-- > 1) {
      c = a + b;
      a = b;
      b = c;
    }
    return c;
  }

  for ( var i = 1; i <= 25; i++ ) {
    console.log(i, fibonacci(i))
  }
`, {
  target: "node",
  preset: "high",
  stringEncoding: false, // <- Normally enabled
}).then(result => {
  console.log(result.code)
})

/*
Function("tZzJOP","var iSDaP3,MyrZnn,PugOol,zlitc1Y,NqvmoV,w01dEg,PEGf2Ir,wQdUIp,YwPLty,BNOmOCh,CHDWybv,MsWp2Eg,q5kdT5,tDyAgBo,Nmc7b1;const WydP2H=[\"length\",0x2,0x0,0x1,\"c\",0x3e,null,0x20,\"a\",0x100,0x6,0x3,0x8,0x10,0x4,\"undefined\",\"LZString\",0x25,\"h\",0xe2,0x8d,0x34,0x5,\"f\",0xf5,0xff,0x7,0xd,0xe,0xf,0x58,0x5b,0x4f,0xf1,0x31,0xc1,0x80,void 0x0,\"d\",\"b\",0x7f,0x1f,0x3f,0xc,0xc7,0x12,0xbd,0xc9,0x9d,0x48,\"i\",\"g\",0x1fff,0x77,0x15,0x84,0x24,0x9,\"e\",0x63,0x64,0x22,0xaa,0xfa,0x65,0x66,0x67,0x68,0x69,0xcf,0x6a,0x6b,0xe9,0xf2,0xd4,0xd8,0x6c,0x6d,0x28,0xa,0x8a,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x81,0x82,0x83,0x85,0x86,0x87,0x88,0x89,0x8b,0x8c,0x8e,0x8f,0x90,0x91,\"8\",0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9e,0x9f,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xab,0xac,0xad,0xae,0xaf,0xc4,0x40,0xed,0xb0,0xe8,0xb1,0xb2,0xb3,0xb4,0xbf,0xb6,0xb5,0xb7,0xea,0xf6,0xb8,0x53,0xb9,\"t\",!0x1,0xba,0xbb,0xbc,0xbe,0xc0,0xc2,0xc3,0xc5,0xc6,0x4d,0xc8,0xca,0xcb,0xcc,0xcd,0x19];Fj4SwuY(YVrVbv(be5E4W),YVrVbv(g7PNjlU),YVrVbv(Hxpsdj_),YVrVbv(putCzy));function YVrVbv(MyrZnn,PugOol=WydP2H[0x3]){Object.defineProperty(MyrZnn,WydP2H[0x0],{value:PugOol,configurable:WydP2H[0x9f]});return MyrZnn}Fj4SwuY(iSDaP3=function(...MyrZnn){Fj4SwuY(MyrZnn[WydP2H[0x0]]=WydP2H[0x2],YVrVbv(PEGf2Ir,WydP2H[0x1]));var PugOol=String.fromCharCode,zlitc1Y=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",NqvmoV=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$\",w01dEg={};function PEGf2Ir(...MyrZnn){var PugOol,zlitc1Y;function*NqvmoV(zlitc1Y,NqvmoV,PEGf2Ir,wQdUIp,YwPLty={r78IiA:{}}){while(zlitc1Y+NqvmoV+PEGf2Ir+wQdUIp!==0x1e)with(YwPLty.Vohu0Q||YwPLty)switch(zlitc1Y+NqvmoV+PEGf2Ir+wQdUIp){case 0x5f:case 0xef:Fj4SwuY(YwPLty.r78IiA.FpCHxeU=-0x4,MyrZnn[WydP2H[0x0]]=WydP2H[zlitc1Y+0x10]);if(!w01dEg[MyrZnn[WydP2H[0x2]]]){Fj4SwuY(YwPLty.Vohu0Q=YwPLty.r78IiA,zlitc1Y+=-0xb1,NqvmoV+=0x7b,PEGf2Ir+=-0x4c,wQdUIp+=0x4a);break}else{Fj4SwuY(YwPLty.Vohu0Q=YwPLty.r78IiA,zlitc1Y+=-0x28,NqvmoV+=0x11b,PEGf2Ir+=-0x152,wQdUIp+=0x4a);break}case YwPLty.r78IiA.FpCHxeU+0x4e:return PugOol=!0x0,w01dEg[MyrZnn[WydP2H[0x2]]][MyrZnn[WydP2H[PEGf2Ir+0xda]]];case-0x93:case 0x27:case 0x2a:w01dEg[MyrZnn[WydP2H[zlitc1Y+0xc2]]]={};for(MyrZnn[WydP2H[zlitc1Y+0xc1]]=WydP2H[0x2];MyrZnn[WydP2H[0x1]]<MyrZnn[WydP2H[0x2]].length;MyrZnn[WydP2H[PEGf2Ir+-0x2e]]++)w01dEg[MyrZnn[WydP2H[zlitc1Y+0xc2]]][MyrZnn[WydP2H[PEGf2Ir+-0x2d]].charAt(MyrZnn[WydP2H[0x1]])]=MyrZnn[WydP2H[NqvmoV+-0x5b]];Fj4SwuY(YwPLty.Vohu0Q=YwPLty.r78IiA,zlitc1Y+=0x89,NqvmoV+=0xa0,PEGf2Ir+=-0x106);break;case YwPLty.r78IiA.FpCHxeU+0x14:Fj4SwuY(YwPLty.Vohu0Q=YwPLty.r78IiA,zlitc1Y+=-0xd2,NqvmoV+=0x169,PEGf2Ir+=-0x15d,wQdUIp+=0x100);break;case NqvmoV- -0xff:Fj4SwuY(YwPLty.Vohu0Q=YwPLty.IjdvHE,zlitc1Y+=-0x6e,NqvmoV+=0x1c,PEGf2Ir+=-0xeb,wQdUIp+=0xd8);break;default:Fj4SwuY(YwPLty.Vohu0Q=YwPLty.UUeBR2,zlitc1Y+=-0x1e,NqvmoV+=-0xc6,PEGf2Ir+=0xca,wQdUIp+=-0x6b);break;case YwPLty.r78IiA.FpCHxeU+0x64:Fj4SwuY(YwPLty.Vohu0Q=YwPLty.dcYkgZ6,zlitc1Y+=-0x6e,NqvmoV+=0x44,PEGf2Ir+=-0x66,wQdUIp+=0x8f);break;case YwPLty.r78IiA.FpCHxeU+0x10:Fj4SwuY(YwPLty.r78IiA.FpCHxeU=0x1c,YwPLty.Vohu0Q=YwPLty.r78IiA,zlitc1Y+=-0xbe,NqvmoV+=0x169,PEGf2Ir+=-0x15d,wQdUIp+=0xf0);break}}Fj4SwuY(PugOol=void 0x0,zlitc1Y=NqvmoV(-0xf,-0x1f,0x7b,0x12).next().value);if(PugOol){return zlitc1Y}}MyrZnn[WydP2H[0x4]]={compressToBase64:YVrVbv(function(...PugOol){var NqvmoV,w01dEg;function*PEGf2Ir(w01dEg,PEGf2Ir,wQdUIp,YwPLty={UeCEL4_:{}}){while(w01dEg+PEGf2Ir+wQdUIp!==-0x8a)with(YwPLty.GpihL4o||YwPLty)switch(w01dEg+PEGf2Ir+wQdUIp){case YwPLty.UeCEL4_.uWtqTC+-0xe6:PugOol[WydP2H[0x5]]=MyrZnn[WydP2H[0x4]]._compress(PugOol[WydP2H[w01dEg+-0x36]],WydP2H[0xa],YVrVbv(function(...w01dEg){w01dEg[WydP2H[0x0]]=WydP2H[0x3];return zlitc1Y.charAt(w01dEg[WydP2H[0x2]])}));switch(PugOol[WydP2H[0x5]].length%WydP2H[0xe]){default:case WydP2H[0x2]:return NqvmoV=!0x0,PugOol[WydP2H[0x5]];case WydP2H[0x3]:return NqvmoV=!0x0,PugOol[WydP2H[0x5]]+\"===\";case WydP2H[0x1]:return NqvmoV=!0x0,PugOol[WydP2H[w01dEg+-0x33]]+\"==\";case WydP2H[w01dEg+-0x2d]:return NqvmoV=!0x0,PugOol[WydP2H[PEGf2Ir+-0x60]]+\"=\"}Fj4SwuY(YwPLty.GpihL4o=YwPLty.g4B1IWG,PEGf2Ir+=-0xfd,wQdUIp+=0xae);break;case 0xac:case 0x37:Fj4SwuY(YwPLty.GpihL4o=YwPLty.UeCEL4_,w01dEg+=-0x3e,PEGf2Ir+=-0xeb,wQdUIp+=0xe);break;case 0x1c:case 0xf4:Fj4SwuY([YwPLty.UeCEL4_.aKWU7u,YwPLty.UeCEL4_.uWtqTC,YwPLty.UeCEL4_.nF1ngYQ]=[-0xa4,0xab,-0x5],PugOol[WydP2H[PEGf2Ir+-0x49]]=WydP2H[0x3]);if(WydP2H[PEGf2Ir+-0x43]==PugOol[WydP2H[PEGf2Ir+-0x47]])return NqvmoV=!0x0,\"\";Fj4SwuY(YwPLty.GpihL4o=YwPLty.UeCEL4_,w01dEg+=-0x45,PEGf2Ir+=0x1c,wQdUIp+=-0x2e);break;case w01dEg-0x10f:case-0x5:case-0x1e:Fj4SwuY(YwPLty.GpihL4o=YwPLty.UeCEL4_,w01dEg+=-0x68,PEGf2Ir+=0x85,wQdUIp+=0x17);break;default:Fj4SwuY([YwPLty.UeCEL4_.aKWU7u,YwPLty.UeCEL4_.uWtqTC,YwPLty.UeCEL4_.nF1ngYQ]=[-0x54,0xf5,-0x19],YwPLty.GpihL4o=YwPLty.pMZ3Cz,w01dEg+=0x84,PEGf2Ir+=0x9,wQdUIp+=-0x126);break;case w01dEg- -0x26:Fj4SwuY(YwPLty.GpihL4o=YwPLty.TbtugV,w01dEg+=0x9a,PEGf2Ir+=0x69,wQdUIp+=-0xf0);break;case 0x91:case 0x0:case YwPLty.UeCEL4_.nF1ngYQ+-0x55:Fj4SwuY(YwPLty.GpihL4o=YwPLty.oBcZJzn,w01dEg+=-0x62,PEGf2Ir+=0x1e3,wQdUIp+=-0x10b);break}}Fj4SwuY(NqvmoV=void 0x0,w01dEg=PEGf2Ir(0x7d,0x49,-0xaa).next().value);if(NqvmoV){return w01dEg}}),decompressFromBase64:YVrVbv(function(...PugOol){PugOol[WydP2H[0x0]]=WydP2H[0x3];return WydP2H[0x6]==PugOol[WydP2H[0x2]]?\"\":\"\"==PugOol[WydP2H[0x2]]?WydP2H[0x6]:MyrZnn[WydP2H[0x4]]._decompress(PugOol[WydP2H[0x2]].length,WydP2H[0x7],function(MyrZnn){return PEGf2Ir(zlitc1Y,PugOol[WydP2H[0x2]].charAt(MyrZnn))})}),compressToUTF16:function(NqvmoV){return WydP2H[0x6]==NqvmoV?\"\":MyrZnn[WydP2H[0x4]]._compress(NqvmoV,WydP2H[0x1d],YVrVbv(function(...NqvmoV){NqvmoV[WydP2H[0x0]]=WydP2H[0x3];return PugOol(NqvmoV[WydP2H[0x2]]+WydP2H[0x7])}))+\" \"},decompressFromUTF16:YVrVbv(function(...PugOol){PugOol[WydP2H[0x0]]=WydP2H[0x3];return WydP2H[0x6]==PugOol[WydP2H[0x2]]?\"\":\"\"==PugOol[WydP2H[0x2]]?WydP2H[0x6]:MyrZnn[WydP2H[0x4]]._decompress(PugOol[WydP2H[0x2]].length,0x4000,YVrVbv(function(...MyrZnn){MyrZnn[WydP2H[0x0]]=WydP2H[0x3];return PugOol[WydP2H[0x2]].charCodeAt(MyrZnn[WydP2H[0x2]])-WydP2H[0x7]}))}),compressToUint8Array:YVrVbv(function(...PugOol){PugOol[WydP2H[0x0]]=WydP2H[0x3];for(var wQdUIp=MyrZnn[WydP2H[0x4]].compress(PugOol[WydP2H[0x2]]),YwPLty=new Uint8Array(WydP2H[0x1]*wQdUIp.length),BNOmOCh=WydP2H[0x2],CHDWybv=wQdUIp.length;BNOmOCh<CHDWybv;BNOmOCh++){Fj4SwuY(PugOol[WydP2H[0x8]]=wQdUIp.charCodeAt(BNOmOCh),YwPLty[WydP2H[0x1]*BNOmOCh]=PugOol[WydP2H[0x8]]>>>WydP2H[0xc],YwPLty[WydP2H[0x1]*BNOmOCh+WydP2H[0x3]]=PugOol[WydP2H[0x8]]%WydP2H[0x9])}return YwPLty}),decompressFromUint8Array:YVrVbv(function(...zlitc1Y){zlitc1Y[WydP2H[0x0]]=WydP2H[0x3];if(WydP2H[0x6]==zlitc1Y[WydP2H[0x2]])return MyrZnn[WydP2H[0x4]].decompress(zlitc1Y[WydP2H[0x2]]);for(var wQdUIp=new Array(zlitc1Y[WydP2H[0x2]].length/WydP2H[0x1]),YwPLty=WydP2H[0x2],BNOmOCh=wQdUIp.length;YwPLty<BNOmOCh;YwPLty++)wQdUIp[YwPLty]=WydP2H[0x9]*zlitc1Y[WydP2H[0x2]][WydP2H[0x1]*YwPLty]+zlitc1Y[WydP2H[0x2]][WydP2H[0x1]*YwPLty+WydP2H[0x3]];zlitc1Y[WydP2H[0x3]]=[];return wQdUIp.forEach(YVrVbv(function(...wQdUIp){Fj4SwuY(wQdUIp[WydP2H[0x0]]=WydP2H[0x3],zlitc1Y[WydP2H[0x3]].push(PugOol(wQdUIp[WydP2H[0x2]])))})),MyrZnn[WydP2H[0x4]].decompress(zlitc1Y[WydP2H[0x3]].join(\"\"))}),compressToEncodedURIComponent:YVrVbv(function(...PugOol){PugOol[WydP2H[0x0]]=WydP2H[0x3];return WydP2H[0x6]==PugOol[WydP2H[0x2]]?\"\":MyrZnn[WydP2H[0x4]]._compress(PugOol[WydP2H[0x2]],WydP2H[0xa],YVrVbv(function(...PugOol){PugOol[WydP2H[0x0]]=WydP2H[0x3];return NqvmoV.charAt(PugOol[WydP2H[0x2]])}))}),decompressFromEncodedURIComponent:YVrVbv(function(...PugOol){PugOol[WydP2H[0x0]]=WydP2H[0x3];return WydP2H[0x6]==PugOol[WydP2H[0x2]]?\"\":\"\"==PugOol[WydP2H[0x2]]?WydP2H[0x6]:(PugOol[WydP2H[0x2]]=PugOol[WydP2H[0x2]].replace(/ /g,\"+\"),MyrZnn[WydP2H[0x4]]._decompress(PugOol[WydP2H[0x2]].length,WydP2H[0x7],YVrVbv(function(...MyrZnn){MyrZnn[WydP2H[0x0]]=WydP2H[0x3];return PEGf2Ir(NqvmoV,PugOol[WydP2H[0x2]].charAt(MyrZnn[WydP2H[0x2]]))})))}),compress:function(NqvmoV){return MyrZnn[WydP2H[0x4]]._compress(NqvmoV,WydP2H[0xd],function(MyrZnn){return PugOol(MyrZnn)})},_compress:function(MyrZnn,wQdUIp,YwPLty){if(WydP2H[0x6]==MyrZnn)return\"\";var BNOmOCh,CHDWybv,MsWp2Eg,q5kdT5={},tDyAgBo={},YVrVbv=\"\",putCzy=\"\",Hxpsdj_=\"\",UkVIMy=WydP2H[0x1],g7PNjlU=WydP2H[0xb],RT3qJW_=WydP2H[0x1],qLPG1Tw=[],be5E4W=WydP2H[0x2],GpA0Rz=WydP2H[0x2];for(MsWp2Eg=WydP2H[0x2];MsWp2Eg<MyrZnn.length;MsWp2Eg+=WydP2H[0x3])if(YVrVbv=MyrZnn.charAt(MsWp2Eg),Object.prototype.hasOwnProperty.call(q5kdT5,YVrVbv)||(q5kdT5[YVrVbv]=g7PNjlU++,tDyAgBo[YVrVbv]=!WydP2H[0x2]),putCzy=Hxpsdj_+YVrVbv,Object.prototype.hasOwnProperty.call(q5kdT5,putCzy))Hxpsdj_=putCzy;else{if(Object.prototype.hasOwnProperty.call(tDyAgBo,Hxpsdj_)){if(Hxpsdj_.charCodeAt(WydP2H[0x2])<WydP2H[0x9]){for(BNOmOCh=WydP2H[0x2];BNOmOCh<RT3qJW_;BNOmOCh++)be5E4W<<=WydP2H[0x3],GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++;for(CHDWybv=Hxpsdj_.charCodeAt(WydP2H[0x2]),BNOmOCh=WydP2H[0x2];BNOmOCh<WydP2H[0xc];BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|WydP2H[0x3]&CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv>>=WydP2H[0x3]}else{for(CHDWybv=WydP2H[0x3],BNOmOCh=WydP2H[0x2];BNOmOCh<RT3qJW_;BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv=WydP2H[0x2];for(CHDWybv=Hxpsdj_.charCodeAt(WydP2H[0x2]),BNOmOCh=WydP2H[0x2];BNOmOCh<WydP2H[0xd];BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|WydP2H[0x3]&CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv>>=WydP2H[0x3]}Fj4SwuY(WydP2H[0x2]==--UkVIMy&&(UkVIMy=Math.pow(WydP2H[0x1],RT3qJW_),RT3qJW_++),delete tDyAgBo[Hxpsdj_])}else for(CHDWybv=q5kdT5[Hxpsdj_],BNOmOCh=WydP2H[0x2];BNOmOCh<RT3qJW_;BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|WydP2H[0x3]&CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv>>=WydP2H[0x3];Fj4SwuY(WydP2H[0x2]==--UkVIMy&&(UkVIMy=Math.pow(WydP2H[0x1],RT3qJW_),RT3qJW_++),q5kdT5[putCzy]=g7PNjlU++,Hxpsdj_=String(YVrVbv))}if(\"\"!==Hxpsdj_){if(Object.prototype.hasOwnProperty.call(tDyAgBo,Hxpsdj_)){if(Hxpsdj_.charCodeAt(WydP2H[0x2])<WydP2H[0x9]){for(BNOmOCh=WydP2H[0x2];BNOmOCh<RT3qJW_;BNOmOCh++)be5E4W<<=WydP2H[0x3],GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++;for(CHDWybv=Hxpsdj_.charCodeAt(WydP2H[0x2]),BNOmOCh=WydP2H[0x2];BNOmOCh<WydP2H[0xc];BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|WydP2H[0x3]&CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv>>=WydP2H[0x3]}else{for(CHDWybv=WydP2H[0x3],BNOmOCh=WydP2H[0x2];BNOmOCh<RT3qJW_;BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv=WydP2H[0x2];for(CHDWybv=Hxpsdj_.charCodeAt(WydP2H[0x2]),BNOmOCh=WydP2H[0x2];BNOmOCh<WydP2H[0xd];BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|WydP2H[0x3]&CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv>>=WydP2H[0x3]}Fj4SwuY(WydP2H[0x2]==--UkVIMy&&(UkVIMy=Math.pow(WydP2H[0x1],RT3qJW_),RT3qJW_++),delete tDyAgBo[Hxpsdj_])}else for(CHDWybv=q5kdT5[Hxpsdj_],BNOmOCh=WydP2H[0x2];BNOmOCh<RT3qJW_;BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|WydP2H[0x3]&CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv>>=WydP2H[0x3];WydP2H[0x2]==--UkVIMy&&(UkVIMy=Math.pow(WydP2H[0x1],RT3qJW_),RT3qJW_++)}for(CHDWybv=WydP2H[0x1],BNOmOCh=WydP2H[0x2];BNOmOCh<RT3qJW_;BNOmOCh++)be5E4W=be5E4W<<WydP2H[0x3]|WydP2H[0x3]&CHDWybv,GpA0Rz==wQdUIp-WydP2H[0x3]?(GpA0Rz=WydP2H[0x2],qLPG1Tw.push(YwPLty(be5E4W)),be5E4W=WydP2H[0x2]):GpA0Rz++,CHDWybv>>=WydP2H[0x3];for(;;){if(be5E4W<<=WydP2H[0x3],GpA0Rz==wQdUIp-WydP2H[0x3]){qLPG1Tw.push(YwPLty(be5E4W));break}GpA0Rz++}return qLPG1Tw.join(\"\")},decompress:YVrVbv(function(...PugOol){PugOol[WydP2H[0x0]]=WydP2H[0x3];return WydP2H[0x6]==PugOol[WydP2H[0x2]]?\"\":\"\"==PugOol[WydP2H[0x2]]?WydP2H[0x6]:MyrZnn[WydP2H[0x4]]._decompress(PugOol[WydP2H[0x2]].length,0x8000,YVrVbv(function(...MyrZnn){MyrZnn[WydP2H[0x0]]=WydP2H[0x3];return PugOol[WydP2H[0x2]].charCodeAt(MyrZnn[WydP2H[0x2]])}))}),_decompress:function(MyrZnn,wQdUIp,YwPLty){var BNOmOCh,CHDWybv,MsWp2Eg,q5kdT5,tDyAgBo,YVrVbv,putCzy,Hxpsdj_=[],UkVIMy=WydP2H[0xe],g7PNjlU=WydP2H[0xe],RT3qJW_=WydP2H[0xb],qLPG1Tw=\"\",be5E4W=[],GpA0Rz={val:YwPLty(WydP2H[0x2]),position:wQdUIp,index:WydP2H[0x3]};for(BNOmOCh=WydP2H[0x2];BNOmOCh<WydP2H[0xb];BNOmOCh+=WydP2H[0x3])Hxpsdj_[BNOmOCh]=BNOmOCh;for(MsWp2Eg=WydP2H[0x2],tDyAgBo=Math.pow(WydP2H[0x1],WydP2H[0x1]),YVrVbv=WydP2H[0x3];YVrVbv!=tDyAgBo;)q5kdT5=GpA0Rz.val&GpA0Rz.position,GpA0Rz.position>>=WydP2H[0x3],WydP2H[0x2]==GpA0Rz.position&&(GpA0Rz.position=wQdUIp,GpA0Rz.val=YwPLty(GpA0Rz.index++)),MsWp2Eg|=(q5kdT5>WydP2H[0x2]?WydP2H[0x3]:WydP2H[0x2])*YVrVbv,YVrVbv<<=WydP2H[0x3];switch(MsWp2Eg){case WydP2H[0x2]:for(MsWp2Eg=WydP2H[0x2],tDyAgBo=Math.pow(WydP2H[0x1],WydP2H[0xc]),YVrVbv=WydP2H[0x3];YVrVbv!=tDyAgBo;)q5kdT5=GpA0Rz.val&GpA0Rz.position,GpA0Rz.position>>=WydP2H[0x3],WydP2H[0x2]==GpA0Rz.position&&(GpA0Rz.position=wQdUIp,GpA0Rz.val=YwPLty(GpA0Rz.index++)),MsWp2Eg|=(q5kdT5>WydP2H[0x2]?WydP2H[0x3]:WydP2H[0x2])*YVrVbv,YVrVbv<<=WydP2H[0x3];putCzy=PugOol(MsWp2Eg);break;case WydP2H[0x3]:for(MsWp2Eg=WydP2H[0x2],tDyAgBo=Math.pow(WydP2H[0x1],WydP2H[0xd]),YVrVbv=WydP2H[0x3];YVrVbv!=tDyAgBo;)q5kdT5=GpA0Rz.val&GpA0Rz.position,GpA0Rz.position>>=WydP2H[0x3],WydP2H[0x2]==GpA0Rz.position&&(GpA0Rz.position=wQdUIp,GpA0Rz.val=YwPLty(GpA0Rz.index++)),MsWp2Eg|=(q5kdT5>WydP2H[0x2]?WydP2H[0x3]:WydP2H[0x2])*YVrVbv,YVrVbv<<=WydP2H[0x3];putCzy=PugOol(MsWp2Eg);break;case WydP2H[0x1]:return\"\"}for(Hxpsdj_[WydP2H[0xb]]=putCzy,CHDWybv=putCzy,be5E4W.push(putCzy);;){if(GpA0Rz.index>MyrZnn)return\"\";for(MsWp2Eg=WydP2H[0x2],tDyAgBo=Math.pow(WydP2H[0x1],RT3qJW_),YVrVbv=WydP2H[0x3];YVrVbv!=tDyAgBo;)q5kdT5=GpA0Rz.val&GpA0Rz.position,GpA0Rz.position>>=WydP2H[0x3],WydP2H[0x2]==GpA0Rz.position&&(GpA0Rz.position=wQdUIp,GpA0Rz.val=YwPLty(GpA0Rz.index++)),MsWp2Eg|=(q5kdT5>WydP2H[0x2]?WydP2H[0x3]:WydP2H[0x2])*YVrVbv,YVrVbv<<=WydP2H[0x3];switch(putCzy=MsWp2Eg){case WydP2H[0x2]:for(MsWp2Eg=WydP2H[0x2],tDyAgBo=Math.pow(WydP2H[0x1],WydP2H[0xc]),YVrVbv=WydP2H[0x3];YVrVbv!=tDyAgBo;)q5kdT5=GpA0Rz.val&GpA0Rz.position,GpA0Rz.position>>=WydP2H[0x3],WydP2H[0x2]==GpA0Rz.position&&(GpA0Rz.position=wQdUIp,GpA0Rz.val=YwPLty(GpA0Rz.index++)),MsWp2Eg|=(q5kdT5>WydP2H[0x2]?WydP2H[0x3]:WydP2H[0x2])*YVrVbv,YVrVbv<<=WydP2H[0x3];Fj4SwuY(Hxpsdj_[g7PNjlU++]=PugOol(MsWp2Eg),putCzy=g7PNjlU-WydP2H[0x3],UkVIMy--);break;case WydP2H[0x3]:for(MsWp2Eg=WydP2H[0x2],tDyAgBo=Math.pow(WydP2H[0x1],WydP2H[0xd]),YVrVbv=WydP2H[0x3];YVrVbv!=tDyAgBo;)q5kdT5=GpA0Rz.val&GpA0Rz.position,GpA0Rz.position>>=WydP2H[0x3],WydP2H[0x2]==GpA0Rz.position&&(GpA0Rz.position=wQdUIp,GpA0Rz.val=YwPLty(GpA0Rz.index++)),MsWp2Eg|=(q5kdT5>WydP2H[0x2]?WydP2H[0x3]:WydP2H[0x2])*YVrVbv,YVrVbv<<=WydP2H[0x3];Fj4SwuY(Hxpsdj_[g7PNjlU++]=PugOol(MsWp2Eg),putCzy=g7PNjlU-WydP2H[0x3],UkVIMy--);break;case WydP2H[0x1]:return be5E4W.join(\"\")}if(WydP2H[0x2]==UkVIMy&&(UkVIMy=Math.pow(WydP2H[0x1],RT3qJW_),RT3qJW_++),Hxpsdj_[putCzy])qLPG1Tw=Hxpsdj_[putCzy];else{if(putCzy!==g7PNjlU)return WydP2H[0x6];qLPG1Tw=CHDWybv+CHDWybv.charAt(WydP2H[0x2])}Fj4SwuY(be5E4W.push(qLPG1Tw),Hxpsdj_[g7PNjlU++]=CHDWybv+qLPG1Tw.charAt(WydP2H[0x2]),CHDWybv=qLPG1Tw,WydP2H[0x2]==--UkVIMy&&(UkVIMy=Math.pow(WydP2H[0x1],RT3qJW_),RT3qJW_++))}}};return MyrZnn[WydP2H[0x4]]}(),\"function\"==tZzJOP[\"TE0C7CR\"]&&tZzJOP[\"_8iE0h\"].amd?tZzJOP[\"_8iE0h\"](function(){return iSDaP3}):WydP2H[0xf]!=tZzJOP[\"soSW4YC\"]&&WydP2H[0x6]!=tZzJOP[\"pXH_Js\"]?tZzJOP[\"pXH_Js\"].exports=iSDaP3:WydP2H[0xf]!=tZzJOP[\"xOGz1y\"]&&WydP2H[0x6]!=tZzJOP[\"ZQZggA\"]&&tZzJOP[\"ZQZggA\"].module(WydP2H[0x10],[]).factory(WydP2H[0x10],function(){return iSDaP3}),MyrZnn=void 0x0,function(){var PugOol=\"\\u15E1\\u6C29\\u416C\\u0680\\u4B30\\u5823\\u703F<\\u0298\\u0460\\u3CB4\\u03C0\\u0440\\u1EA0\\u04A0\\u1621\\u4E21\\u75F0\\u024D\\u592A\\u0238\\u0800\\u0CC2\\u404Bf\\u09D8\\u08E0\\u0E80\\u0BE0\\u0800\\u0D69\\u447C\\u205B\\u09B4e\\u147A\\xC2|\\u198C\\xC4h8\\u01A4\\u0154\\xDC\\u018D\\u4820\\u5C84\\u0824\\u72A8\\u1026\\u602C\\u202A\\u2021\\u202B\\u11F6\\u6027\\u4031\\u602A\\u6023\\u0821\\u1821\\u52A1\\u4433\\u0EA0\\u0660\\u02C6\\u3024\\u52C04\\u5420\\u4980\\u4032\\u42A0\\u0103\\u5292\\u1823\\u0C20\\u02E8\\u6748]\\u53B3\\u68AE\\u0EE0\\u0409\\u7515\\u422A\\u0520\\u1CB6\\u40A3\\u1468\\u7027\\u0961\\u4421\\u6E20\\u1B55\\u1273\\u1C78\\u29EF\\u7180\\xF0\\u3B31\\u7E11\\u3220\\u375F\\u4CE2\\u4320\\u2635\\u7BC0\\xF4\\xF6\\u62F8\\u7031\\u43DF\\u46E7\\u4946\\u0821\\u4894t\\u61B2\\u3698\\u5820\\u0CE1\\u22CD\\u1019\\u12F4\\u6620\\u17E9\\u4043\\u1CEE\\u3FAF\\u0170\\xA26\\u402D\\u57B9\\u6E97\\u25AA\\u4022\\u5570\\u58C2\\u04B0\\u11A6\\u3D4B\\u4A45\\u21A2\\u25A9\\u4346\\u3890\\u61BC\\u1A36\\u71A6\\u5466\\u2020\\u1A55\\u5880\\u1FC2\\u2319\\u7323\\u0F01\\u232C\\u1064\\u1485 \\u6F13#\\u6FE0\\u0128\\u1967\\u13E3\\u04E2\\u4443\\u4CAB\\u0A58\\u0764\\u1BA2\\u225C\\u0E5C\\u5248\\u4161\\u2932\\u106A\\u6255\\u4E8B\\u0DA1\\u509D\\u618C\\u4064\\u22D5\\u683D\\u1049\\u73A8\\u1994\\u0A48\\u7820\\u1AF8\\u3661\\u2379\\u08E1\\u3627\\u6539\\u0E20\\u37CD\\u1002\\u1D14%\\u5548\\u1254\\u4AF4\\u5FBE\\u7411\\u4E80\\u0223\\u02C4\\u2C94\\u17E3\\u0588\\u42D0\\u1C49\\u6021\\u6A2A\\u0CA6\\u0BC6\\u5027\\u0930\\u0A37\\u79F8\\u1337\\u1FA9\\u74BC\\u25BB\\u1461\\u4CC3\\u1272\\u6172\\u6CDE\\u25A8\\u4322\\u7CFC\\u373F\\u61A5\\u40E3\\u0EBB\\u43E8\\u54A8\\u2738\\u3150\\u2099\\u3CE7\\u2528\\u48C8\\u1D5B\\u01A7\\u108A\\u052B\\u2548\\u289A\\u3626\\u2729\\u56C9\\u2228\\u6501\\u20B8\\u127F\\u4806\\u3C98\\u3BA3\\u7696\\u62C5\\u1137\\u190A\\u7C7A\\u20BE\\u15D2\\u0180\\u2C67\\u2352\\u30B6\\u11A6\\u0BAE\\u5167\\u22C2\\u4B23\\u1254\\u24AA\\u092E\\u7E31\\u0B20\\u472A\\u41C8\\u232F\\u035A\\u62BD\\u0258\\u573B\\u4038\\u03A0\\u42C2\\u513B\\u02E4\\u5439\\u6BD8\\u4124\\u40D0\\u5A38\\u0150\\u23AE\\u0950 ...
*/

Bug report

Please open an issue with the code and config used.

Feature request

Please open an issue and be descriptive. Don't submit any PRs until approved.

License

MIT License

changelog

2.0.0

2.0 Rewrite 🎉

Complete rewrite of JS-Confuser using Babel! 🎉

⚠️ Breaking changes

Check out the Migration guide on how to properly update from 1.X to 2.0. The obfuscation upgrades in 2.0 are worth the small refactoring.

  • Revamped API Interface

    • JSConfuser.obfuscate() resolves to an object
Property Type Description
code string The obfuscated code.
  • Renamed Stack to Variable Masking

  • Added configurable limits to options:

const options = {
  target: "node",

  rgf: {
    value: 0.5, // = 50% of eligible functions
    limit: 10 // Maximum of 10 changes for performance reasons
  },

  // Original format is still valid (No limit applied)
  rgf: 0.5
}

2.0 Changes

  • Added Custom String Encoding and Custom Lock Code options

  • Added Rename Labels Learn more here

  • Added Pack Learn more here

  • RGF no longers uses new Function instead uses eval

  • Improved code transforms!

  • Improved Control Flow Flattening

    • Now supports lexical bindings (let, const, class)
    • with () { } statement obfuscation
  • Improved Minify

    • Removes unused variables and functions
  • Improved Moved Declaration ability to move variables as unused function parameters

  • Improved String transforms

    • Template literals are now obfuscated (First converted into equivalent String Literal)
    • Regular expressions are now obfuscated (First converted into equivalent RegExp() constructor calls)
    • String Compression now uses LZ-string compression (lz-string)
  • New Comment Syntax

    • /* @js-confuser-var */ "name" for improved variable mappings, such as eval() calls
// Input
var name = "Internet User";
eval( "console.log(" + /* @js-confuser-var */ "name" + ")" );

// Output
var zC3PLKu = "Internet User";
eval("console.log(" + "zC3PLKu" + ")");

Note: The function __JS_CONFUSER_VAR__ is still supported.

JS-Confuser.com Revamp

A new UI for JS-Confuser.com, featuring an advanced playground and documentation pages.

The previous version will remain available at old--confuser.netlify.com.

Removed features

  • Removed ES5 option - Use Babel Instead

  • Removed Browser Lock and OS Lock - Use Custom Locks instead

  • Removed Shuffle's Hash option

  • Removed Indent option

1.7.3

Tamper Protection

Tamper Protection

Tamper Protection safeguards the runtime behavior from being altered by JavaScript pitfalls.

Learn more here.


  • Rename Variables improvements:

  • A new exposed function, __JS_CONFUSER_VAR__, can be used to access renamed variables. Learn more here.

// Input
var name = "John Doe";
eval("console.log(" + __JS_CONFUSER_VAR__(name) + ")");

// Output
var CA1HU0 = 'John Doe';
eval('console.log(' + 'CA1HU0' + ')');
  • Improved the Zero Width identifier generator (Thanks @doctor8296!)

  • Pad the String Concealing array with more fake strings

  • Improve String Compression

  • New Web UI sneak peak: https://js-confuser.com/

1.7.2

Updates

  • Anti Tooling & Expression Obfuscation improvements
  • String Concealing improvements

    • Randomizes the charset for each obfuscation
    • Place multiple decryption functions throughout the code
  • Moved Declarations improvements

    • Now moves some variables as unused parameters on certain functions
  • RGF improvements

    • More likely to transform functions containing functions
  • Fixed #96

    • Removed hardcoded limits on String Concealing, String Compression, and Duplicate Literals Removal
  • Fixed #106

    • Final fix with const variables for Object Extraction
  • Fixed #131

    • __dirname is no longer changed by Global Concealing

New Option

preserveFunctionLength

  • Modified functions will retain the correct function.length property. (true/false) Enabled by default.

Minor improvements

  • Preserve function.length
  • Preserve Strict Mode behaviors
  • Preserve indirect vs. direct eval use

1.7.1

Updates

  • Fixed #107
    • RGF and Integrity clash issue fixed
  • Fixed #106

    • Object Extraction to properly handle const objects
  • Fixed #105

    • Duplicate Literals Removal updated to not cause this error
  • Fixed #103

    • Dispatcher will no longer apply to these types of functions to prevent this error
  • Added documentation page for ES5

  • Rollup Plugin created: https://github.com/ayecue/rollup-js-confuser (Thanks @ayecue !)

1.7.0

Updates

  • Fixed #89
    • Flatten to not break functions with invalid identifier names
  • Fixed #88

    • Stack to not break functions with syncing arguments
  • Fixed #91

    • Minify to preserve function.length property
  • Fixed #95

    • Rename Variables optimized to obfuscate much faster
  • Added documentation pages for RGF and Control Flow Flattening

  • Removed eval option in favor of rgf option.

    • Removed the "all" option from rgf.
  • Removed nameRecycling option

1.6.0

Website Redesign + Updates

The website is now redesigned and live at js-confuser.com!

New feature

selfDefending

Prevents the use of code beautifiers or formatters against your code.

Identical to Obfuscator.io's Self Defending

Improvements

  • Fixed #56
    • Calculator improved to apply to more operators
  • ES5 to handle destructuring member expressions

  • Improved Control Flow Flattening techniques

    • Outlining expressions
    • Control object to store numbers and strings
  • Updated the String concealing encoding algorithm

  • Optimizations / Small fixes

1.5.9

Big update

This updates comes with many bug fixes:

  • Fixed #72
    • ES5 to handle Class Fields

Note: The ES5 option is not meant to replace Babel. It is only intended to undo ES6 features the obfuscator may have added to your code.

  • Fixed #74
    • Anti Tooling to not break Symbols
  • Fixed #75

    • Minify to properly handle Object constructors
  • Fixed #76

    • Minify to not cause syntax errors when objects used ^, `, [, ] as property keys
  • Fixed #77

    • Dispatcher to not break code that uses generic names like toString and hasOwnProperty
  • Fixed #78

    • Object Extraction to not error on objects with spread elements
  • Fixed #79

    • JsConfuser now supports BigInt literals
  • Fixed #80

    • Rename Variables to not break code that had var and let variables in the same scope
  • Fixed #81

    • Control Flow Flattening to not break typeof expressions
  • Fixed #82

    • String Concealing to not break class constructors

1.5.8

Several fixes

  • Fixed #46
    • Updated the validation on lock options
  • Fixed #68

    • Name Recycling fixed to not break certain function declarations
  • Fixed #69, #70 and #71

    • Import statements to be properly handled
  • Slight improvements to String Concealing

1.5.7

Countermeasures function fixes

This update focuses on fixing Countermeasures bugs

The countermeasures is custom callback function to invoke when a lock is triggered.

  • Fixed #66
    • RGF to properly handle the countermeasures function
  • Added additional code to prevent an infinite loop from occurring

  • Slight improvements to RGF

1.5.6

Website changed and RGF fixes

The website is back at a different domain now: https://master--hungry-shannon-c1ce6b.netlify.app/

This update focuses on fixing RGF bugs

  • Fixed #64
    • RGF to properly handle Arrow functions and function expressions
  • RGF will no longer change getter/setter methods

  • RGF will no longer change class methods

  • RGF now works when using mangled variable names

  • Minify will remove unreachable code following a Throw statement

1.5.5

Updates

  • Fixed #53
    • Shuffle to not use common variable names like x
  • Fixed #60

    • Rename Variables to properly handle function parameters
  • Fixed #62

    • Rename Variables to properly handle catch-clause parameters

1.5.4

Small fix

  • Fixed #45
    • Opaque predicates fixed to not this cause error

1.5.3

Shuffle fix

  • Fixed #48
    • Shuffle was re-assigning const variables, fixed in this version.

1.5.2

Mini fixes

  • Fixed #41
    • Obfuscator mishandled switch statements with a default case
  • Fixed #43

    • Obfuscator mishandled variable destructuring in for-loops

1.5.1

Object Extraction Fix

  • Fixed #37
    • Object Extraction was applying to objects with get/set methods, fixed in this version.
  • Slight improvement to Flatten

1.5.0

Hexadecimal Numbers

  • The hexadecimal representation can now be used. #29
  • New option hexadecimalNumbers to control this behavior.

hexadecimalNumbers

Uses the hexadecimal representation (50 -> 0x32) for numbers. (true/false) -->

  • Slight improvement to Control Flow Flattening
  • Slight improvement to Calculator

1.4.3

Minify Fix

  • Fixed #34
    • Minify was removing return statements too aggressively, fixed in this version.
  • Slight improvement to Control Flow Flattening

1.4.2

Eval Fix

  • Fixed #31
    • Eval and Integrity didn't work together, fixed in this version.

1.4.1

AntiDebug Fix

  • Fixed #28
    • AntiDebug was causing syntax errors in some scenarios, fixed in this version.

1.4.0

Confusing Control Flow

  • Control Flow Flattening overhaul, now flattens embedded control structures

    • If statements
    • For statements
    • While statements
    • Switch statements
    • Do While statements
    • Certain functions
// Input
console.log(1);
console.log(2);
console.log(Number("3"));

for (var i = 4; i < 6; i++) {
  console.log(i);
}

var i = 0;
do {
  console.log(i + 6);
} while (i++ < 4);

// Output
var a = -123, b = 414, c = -191;
while (a + b + c != 104) {
    var d = (a + b + c) * -28 + 172;
    switch (d) {
    case -276:
        !(a *= 138 > b ? 2 : 158, a -= -5 < c ? -90 : -152, b *= b + 206, b -= a + -539, c += b + -372);
        break;
    case -2628:
        var e = (console['log'](-106 > c ? 1 : 182), console['log'](a + 125), console['log'](Number('3')), -87 < a ? -189 < a ? -133 : 93 : 107 < c ? 227 : 4);
        ~(a *= (-114 > c ? -164 : -107) < c ? -164 : 2, a -= 188 > b ? b + -211 : -369, b += -62 > c ? 168 > c ? -539 : 56 : 26, c += (c + 362 > a ? 73 : -157) < b ? 207 : 341);
        break;
    case -4420:
        +(a *= a + (a + 18), a -= 190 > a ? -344 : 71, b *= -206 < b ? c + -173 : -221, b -= b + 94, c += 89 > b ? -311 : 170);
        break;
    case -3972:
        if (e < c + -144) {
            !(a *= b + 127, a -= b + (b + 671), b += c + 82, c *= 61 < a ? -139 : 2, c -= b + -35);
            break;
        }
        typeof (a *= c + -148, a -= c + 271, b += c + 184, c += -89 < c ? -42 : -114);
        break;
    case -3244:
        +(a += a + 220, b += b + 317, c += b + -218);
        break;
    case -4308:
        !(a += 134 < b ? -233 : 89, b += -79 < b ? -69 : -241, c *= -107 > a ? -97 : 2, c -= (56 < a ? -27 : -184) > c ? -163 : 231);
        break;
    case -3664:
        ~(a += b + -362, b += -87 < b ? -666 : -172, c += c + 710);
        break;
    case -5344:
        +(a *= c + (-165 < a ? -266 : 182) > c ? 124 : 2, a -= -154 > b ? c + 92 : -388, b += c + -193, c *= c + (c + -30), c -= a + -11);
        break;
    case -2572:
        if (e++ < ((-125 < a ? -62 : 87) < c ? -112 : 4)) {
            ~(a += c + -268, b += 215 < b ? 136 : 18 < b ? -233 : 536, c += b + -535);
            break;
        }
        ~(a *= (123 > a ? -105 : 238) < b ? 216 : 2, a -= a + 57, b *= a + 59, b -= a + -369, c *= b + -236, c -= 200 > c ? -288 : -11);
        break;
    case -4784:
        +(console['log'](e), a *= c + -223, a -= 7 > c ? -227 > b ? -4 : 192 : -157, b *= a + (-186 > b ? 211 : 17), b -= -127 > c ? 76 : 280, c *= -63 > c ? a + 264 : 2, c -= (119 < c ? -206 : 85) < a ? 215 : 179);
        break;
    case -724:
        void (console['log'](e + (c + -246)), a *= -177 < c ? 2 : 207, a -= 152 > a ? 122 : -190, b *= c + -250, b -= b + 160, c += -141 < a ? a + 258 : 21);
        break;
    case -3804:
        var e = -143 > a ? 0 : 24;
        typeof (a += c + -9, b += c + 125, c += a + -261);
        break;
    case -1648:
        ~(e++, a += a + 3, b *= c + 68, b -= 89 < b ? -173 > b ? -147 : 267 : -228 > c ? -80 : -216 > b ? 93 : 68, c += 65 > a ? b + 156 : 216);
        break;
    }
}
  • New encoding type Hex Table
"{0x7E494534,0x688,0x7E6D53,0x401,0x7E584D4B,0x688,0x7E775853,0x688,0x7E5333,0x81}" 

// => "Hello World"
  • Improvements to renaming labels
  • Fixed #24
  • Fixed #25
  • Fixed #26

1.3.0

String Splitting Improvement

  • String Splitting now supports percentages and a custom callback. (#22)
{
  // percentage
  stringSplitting: 0.75, // = 75%

  // exclude certain strings
  stringSplitting: (str)=>{
    if ( str == "dont-split-string" ) {
      return false;
    }

    return true;
  },
}

1.2.2

Global name fix

  • Bug fix: Rename Variables breaking access to global variables
// Say `a` is a global library
// Input
function myFunction(param1){
  a(param1);
}

// Output on 1.2.1
function a(a){
  a(a);
}

// Output on 1.2.2
function b(b){
  a(b);
}
  • Bug fix: Flatten to not accidentally remove function parameters
  • Bug fix: Dispatcher on function calls within classes
  • Bug fix: Minify fixed syntax error
// Input
var o = {Infinity: 0};

// Output on 1.2.1
var o = {1/0: 0};

// Output on 1.2.2
var o = {[1/0]: 0};
  • Added base32 encoding to String Concealing
  • Minify improvements
    • true -> !0
    • false -> !1
  • Subtle changes to String Compression
  • Updated presets

1.2.1

Bug fixes

  • Bug fix: Control Flow Flattening on classes no longer creates syntax errors
  • Bug fix: String Concealing will check for duplicate strings
  • Bug fix: String Concealing now handles class properties
  • Bug fix: Stack and Control Flow Flattening no longer modifies floats

  • New API:

obfuscateAST(AST, options)

Obfuscates an ESTree compliant AST. Returns a Promise.

Note: Mutates the object.

Parameter Type Description
AST object The ESTree compliant AST. This object will be mutated.
options object The obfuscator settings.

1.2.0

Bug fixes

  • Bug fix: Eval moves function declarations to the top of the lexical block
  • Bug fix: Stack no longers changes function declarations
  • Improvements to Stack rotations
// Input
function add3(x,y,z){
  ok(typeof x === "number");
  ok(typeof y === "number");
  ok(typeof z === "number");

  return x + y + z;
}

console.log(add3(1,2,3))

// Output on 1.1.9
function _WFZLw(..._WFZLw) {
    void (_WFZLw.length = 3, ok(typeof _WFZLw[0] === 'number'), ok(typeof _WFZLw[1] === 'number'), ok(typeof _WFZLw[2] === 'number'));
    return _WFZLw[0] + _WFZLw[1] + _WFZLw[2];
}
console['log'](_WFZLw(1, 2, 3));

// Output on 1.2.0
var KZ6LyAL = (...KZ6LyAL) => {
    ~(KZ6LyAL.length = 3, ok(typeof KZ6LyAL[0] === 'number'), KZ6LyAL[186] = KZ6LyAL[0], ok(typeof KZ6LyAL[1] === 'number'), KZ6LyAL[227] = -22, ok(typeof KZ6LyAL[KZ6LyAL[KZ6LyAL[227] + 249] + 24] === 'number'));
    return KZ6LyAL[KZ6LyAL[227] - (KZ6LyAL[227] - 186)] + KZ6LyAL[KZ6LyAL[227] + 23] + KZ6LyAL[KZ6LyAL[KZ6LyAL[227] + 249] - (KZ6LyAL[227] - (KZ6LyAL[227] + 24))];
};
console.log(KZ6LyAL(1, 2, 3));

1.1.9

Browser Lock and OS Lock

  • Added Browser Lock and OS Lock
Mode Target Method
Browser Lock "browser" Checks window.navigator.userAgent
Browser Lock "node" N/A
OS Lock "browser" Checks window.navigator.userAgent
OS Lock "node" Checks require('os').platform()

  • Browser Lock

  • Array of browsers where the script is allowed to run. (string[])

    • Potency Low
    • Resilience Medium
    • Cost Medium
  • Allowed values: "firefox", "chrome", "iexplorer", "edge", "safari", "opera"

  • Example: ["firefox", "chrome"]


  • OS Lock

  • Array of operating-systems where the script is allowed to run. (string[])

    • Potency Low
    • Resilience Medium
    • Cost Medium
  • Allowed values: "linux", "windows", "osx", "android", "ios"

  • Example: ["linux", "windows"]


  • Bug fix: Moved Declarations no longer applies to loops
    • Previously broke Switch statements
  • String Splitting use larger chunk sizes to avoid creating too many strings

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.8

Bug Fixes and Improvements

  • Bug fix: Stack no longer replaces identifiers that are in nested contexts

  • es5 converts

    • fn(...args) -> fn.apply(this, args)
    • fn(...arguments) -> fn.apply(this, [].concat(Array.prototype.slice.call(arguments)))
  • Changes to identifierGenerator

    • mangled Now uses both lowercase and uppercase alphabets
  • Added antiTooling to stop JSNice.org from expanding sequence expressions

// Input
(console.log(1), console.log(2), console.log(3))

// Output
+(console.log(1), console.log(2), console.log(3))

// JSNice on Input
console.log(1)
console.log(2)
console.log(3)

// JSNice on Output
+(console.log(1), console.log(2), console.log(3))
  • Improved controlFlowFlattening
    • No longer changes blocks with const variables
    • Now obscures order of expressions `js // Input console.log(1) console.log(2) console.log(3) console.log(4) var five = 5; console.log(five);

// Output var oI8J9w6 = (console'log', console'log', console'log', console'log', 5); console'log';


- - Now entangles number literals with the state variables ex:

```js
// Input
console.log(1);
console.log(2);
console.log(3);
console.log(4);
console.log(5);
console.log(6);
console.log(7);
console.log(8);
console.log(9);
console.log(10);

// Output
var xYPTGP = -164, NYvTJV = -40, eB6EbU = 55, cD8ztD = -73, AnCfc3A = 237, n6wikC = 52;
while (xYPTGP + NYvTJV + eB6EbU + cD8ztD + AnCfc3A + n6wikC != 33) {
    var ruVzem = (xYPTGP + NYvTJV + eB6EbU + cD8ztD + AnCfc3A + n6wikC) * -184 - 38;
    switch (ruVzem) {
    case -3350:
        console.log(4), (NYvTJV *= -66 > AnCfc3A ? n6wikC + (134 > xYPTGP ? -190 : 194) : 2, NYvTJV -= 77 < xYPTGP ? 28 : 66), xYPTGP += AnCfc3A - 201, (AnCfc3A *= n6wikC + 109, AnCfc3A -= 16 < NYvTJV ? 661 : -169);
        break;
    case -26902:
        console.log(31 > AnCfc3A ? 39 : -2 > AnCfc3A ? -137 : 3), (NYvTJV *= -174 > n6wikC ? AnCfc3A - 292 : 2, NYvTJV -= n6wikC - 91), (eB6EbU *= 155 > cD8ztD ? 2 : 42, eB6EbU -= 155 > AnCfc3A ? 1 : -227), (cD8ztD *= 183 < eB6EbU ? 222 : 2, cD8ztD -= 214 < AnCfc3A ? 270 : 70);
        break;
    case -12366:
        console.log(196 < eB6EbU ? -5 : 1), eB6EbU += -47 > cD8ztD ? -225 : 57, (xYPTGP *= AnCfc3A - 235, xYPTGP -= -126 < eB6EbU ? 46 : -434);
        break;
    case -20646:
        console.log(2), (n6wikC *= cD8ztD + 75, n6wikC -= ((107 > xYPTGP ? -244 : -80) > cD8ztD ? 65 : 149) > cD8ztD ? -138 > eB6EbU ? cD8ztD + 284 : 159 : 73 < AnCfc3A ? -14 : 83), AnCfc3A += xYPTGP - 95 < n6wikC ? 199 : 147, xYPTGP += 227 < xYPTGP ? -238 : 46;
        break;
    case -10526:
        console.log(10), xYPTGP += n6wikC + 524, n6wikC += cD8ztD + 263, (AnCfc3A *= 67 > xYPTGP ? n6wikC + (xYPTGP - 433 > n6wikC ? -21 : -111) : 2, AnCfc3A -= AnCfc3A + 247);
        break;
    case -2614:
        console.log(5), (n6wikC *= xYPTGP - 333, n6wikC -= (-41 > cD8ztD ? -38 > AnCfc3A ? 96 : -97 : 49) < NYvTJV ? 131 : 112), (cD8ztD *= eB6EbU + 115, cD8ztD -= -216 < AnCfc3A ? -631 : 23), (AnCfc3A *= (NYvTJV + 1 > xYPTGP ? 235 : 206) < n6wikC ? n6wikC + 310 : 2, AnCfc3A -= NYvTJV - 236), (xYPTGP *= 185 > eB6EbU ? -169 < xYPTGP ? 2 : 236 : -19, xYPTGP -= -59 < n6wikC ? 100 : n6wikC + 779);
        break;
    case -5006:
        console.log(6), (cD8ztD *= cD8ztD + (-100 < n6wikC ? -66 : 203), cD8ztD -= -87 < eB6EbU ? -101 : -261);
        break;
    case -16046:
        console.log(240 > AnCfc3A ? -70 : 7), (NYvTJV *= AnCfc3A - 240, NYvTJV -= 240 > AnCfc3A ? -66 : 304), AnCfc3A += eB6EbU - 76, (eB6EbU *= 154 > NYvTJV ? xYPTGP - 234 : 103 > xYPTGP ? -138 : 2, eB6EbU -= AnCfc3A - 409);
        break;
    case -9974:
        console.log(NYvTJV + (-225 > AnCfc3A ? -98 : -103)), xYPTGP += n6wikC + 260, eB6EbU += NYvTJV - 67, (AnCfc3A *= eB6EbU - 173, AnCfc3A -= eB6EbU - 132 < NYvTJV ? 19 : -107 > NYvTJV ? 145 : -44);
        break;
    case -8318:
        console.log(AnCfc3A - 45), (n6wikC *= -126 < xYPTGP ? 2 : 53, n6wikC -= n6wikC + 336);
    }
}

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.7

Website is Live

1.1.6

New feature: Name Recycling

  • New feature: nameRecycling
    • Attempts to reuse released names.
    • Potency Medium
    • Resilience High
    • Cost Low
// Input
function percentage(decimal) {
  var multiplied = x * 100;
  var floored = Math.floor(multiplied);
  var output = floored + "%"
  return output;
}

// Output
function percentage(decimal) {
  var multiplied = x * 100;
  var floored = Math.floor(multiplied);
  multiplied = floored + "%";
  return multiplied;
}
  • delete operator is now properly parsed
  • No longers changes constructor method on classes
  • Added two new Dead Code samples and fixed one
  • RGF now skips async and generator functions
  • Object Extraction now places the extracted properties in the same position as the declaration
  • Name Conflicts disabled to speed up obfuscation times
  • Improvements to Minify (better Variable Grouping)
  • The renameGlobals option now has affect

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.5

Performance Improvements

  • Bug fix: Object Extraction
    • Improved safety checks (searches further down tree)
    • No longer applies to empty objects
  • String Concealing results are now cached

  • Minification improvements

    • a += -1 -> a -= 1
    • a -= -1 -> a += 1
    • a + -b -> a - b
    • a - -b -> a + b
  • Dispatcher no longer applies to redefined functions

  • Ensure controlFlowFlattening numbers don't get too large (hardcoded limit of 100,000)

  • Opaque Predicates now excludes await expressions

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.4

Improved ES5 Support

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.3

Minification Changes

  • Fixed minification errors
    • No longer accidentally removes function declarations/class declarations
  • RGF Changes

    • Function cannot rely on this
    • Better support with renameVariables
  • Opaque Predicate Changes

    • Now correctly applies to switch case tests
  • Fixed Flatten bug causing undefined return values

  • Support for transpiling ES6 template strings

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.2

New String Compression feature and Fixed Syntax errors

  • New feature: stringCompression
    • String Compression uses LZW's compression algorithm to reduce file size. (true/false/0-1)
    • "console" -> inflate('replaĕ!ğğuģģ<~@')
    • Potency High
    • Resilience Medium
    • Cost Medium
  • Fixed error with String encoding

  • Fixed syntax error from obfuscating destructuring with computed keys

  • Fixed syntax error when getters/setters were being converted to arrow functions
  • Integrity fixes:
    • Better support with Dispatcher
    • Better support with Calculator

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.1

General fixes

  • No longer encodes "use strict" and other directives
  • No longer encodes require("str") or import("str") strings

  • Fixed several controlFlowFlattening bugs: Fixed rare code corruption when nested Fixed obfuscation on for and while loops

  • Fixed stack from creating syntax errors (No longer applies to for-loop initializers)

  • Fixed renaming identifiers in object destructing

  • Better support for let variables

  • Checks for invalid options

  • Increased test coverage to 90%

  • debugTransformations, Obfuscator and Transform objects exposed.

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.1.0

New feature: Stack, and various improvements

  • New feature: stack Local variables are consolidated into a rotating array. (true/false/0-1) Similar to Jscrambler's Variable Masking

    • Potency Medium
    • Resilience Medium
    • Cost Low
    // input
    function add3(x, y, z){
     return x + y + z;
    }
    
    // output
    function add3(...AxaSQr){AxaSQr.length=3;return AxaSQr.shift()+AxaSQr.shift()+AxaSQr.shift()}
  • Improvements to flatten

  • Properly renames let variables now
  • Improvements to dispatcher

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.0.9

Support for lower versions of NodeJS

  • Adjusted babel config to be more forgiving to the older versions of NodeJS.

1.0.8

New shuffle feature and improvements

  • New feature for shuffle: hash - Shift based on the hash of the array contents If the hash changes, the order of the array will be messed up causing your program to brick.

  • Lock improvements Fixed issue with nativeFunctions Now errors when countermeasures callback can't be found. Countermeasures callback works with Integrity. New rules for countermeasures callback: Must be top-level, No references to locked code (otherwise infinite loop)

  • General improvements Updated presets and documentation Added index.d.ts for type-intellisense

Available now on NPM: https://www.npmjs.com/package/js-confuser

1.0.7

Integrity fixed

  • Integrity Improvements
    • Countermeasures function works with Integrity
    • Fixed hashing issues
      • Wrote more tests for integrity
  • Documentation Update
    • Fixed errors in examples