1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247 |
- /*
- Copyright (C) 2016 Timofey Kachalov <[email protected]>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- require("source-map-support").install();
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId])
- /******/ return installedModules[moduleId].exports;
- /******/
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // identity function for calling harmory imports with the correct context
- /******/ __webpack_require__.i = function(value) { return value; };
- /******/
- /******/ // define getter function for harmory exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 67);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var chance_1 = __webpack_require__(62);
- var JSFuck_1 = __webpack_require__(16);
- var Utils = function () {
- function Utils() {
- _classCallCheck(this, Utils);
- }
- _createClass(Utils, null, [{
- key: 'arrayContains',
- value: function arrayContains(array, searchElement) {
- return array.indexOf(searchElement) >= 0;
- }
- }, {
- key: 'arrayRotate',
- value: function arrayRotate(array, times) {
- if (!array.length) {
- throw new ReferenceError('Cannot rotate empty array.');
- }
- if (times <= 0) {
- return array;
- }
- var newArray = array,
- temp = void 0;
- while (times--) {
- temp = newArray.pop();
- newArray.unshift(temp);
- }
- return newArray;
- }
- }, {
- key: 'btoa',
- value: function btoa(string) {
- var encode = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
- return new Buffer(encode ? encodeURI(string) : string).toString('base64');
- }
- }, {
- key: 'decToHex',
- value: function decToHex(dec) {
- var radix = 16;
- return Number(dec).toString(radix);
- }
- }, {
- key: 'getRandomGenerator',
- value: function getRandomGenerator() {
- return Utils.randomGenerator;
- }
- }, {
- key: 'getRandomVariableName',
- value: function getRandomVariableName() {
- var length = arguments.length <= 0 || arguments[0] === undefined ? 6 : arguments[0];
- var rangeMinInteger = 10000,
- rangeMaxInteger = 99999999,
- prefix = '_0x';
- return '' + prefix + Utils.decToHex(Utils.getRandomGenerator().integer({
- min: rangeMinInteger,
- max: rangeMaxInteger
- })).substr(0, length);
- }
- }, {
- key: 'isInteger',
- value: function isInteger(number) {
- return number % 1 === 0;
- }
- }, {
- key: 'strEnumify',
- value: function strEnumify(obj) {
- return obj;
- }
- }, {
- key: 'stringToJSFuck',
- value: function stringToJSFuck(string) {
- return Array.from(string).map(function (character) {
- return JSFuck_1.JSFuck[character] || character;
- }).join(' + ');
- }
- }, {
- key: 'stringToUnicode',
- value: function stringToUnicode(string) {
- var radix = 16;
- var prefix = void 0,
- regexp = new RegExp('[\x00-\x7F]'),
- template = void 0;
- return '\'' + string.replace(/[\s\S]/g, function (escape) {
- if (regexp.test(escape)) {
- prefix = '\\x';
- template = '0'.repeat(2);
- } else {
- prefix = '\\u';
- template = '0'.repeat(4);
- }
- return '' + prefix + (template + escape.charCodeAt(0).toString(radix)).slice(-template.length);
- }) + '\'';
- }
- }]);
- return Utils;
- }();
- Utils.randomGenerator = new chance_1.Chance();
- exports.Utils = Utils;
- /***/ },
- /* 1 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var escodegen = __webpack_require__(10);
- var esprima = __webpack_require__(18);
- var estraverse = __webpack_require__(4);
- var NodeType_1 = __webpack_require__(7);
- var Nodes_1 = __webpack_require__(6);
- var Utils_1 = __webpack_require__(0);
- var NodeUtils = function () {
- function NodeUtils() {
- _classCallCheck(this, NodeUtils);
- }
- _createClass(NodeUtils, null, [{
- key: 'addXVerbatimPropertyToLiterals',
- value: function addXVerbatimPropertyToLiterals(node) {
- estraverse.replace(node, {
- enter: function enter(node, parentNode) {
- if (Nodes_1.Nodes.isLiteralNode(node)) {
- node['x-verbatim-property'] = {
- content: node.raw,
- precedence: escodegen.Precedence.Primary
- };
- }
- }
- });
- }
- }, {
- key: 'appendNode',
- value: function appendNode(blockScopeBody, node) {
- if (!NodeUtils.validateNode(node)) {
- return;
- }
- blockScopeBody.push(node);
- }
- }, {
- key: 'convertCodeToStructure',
- value: function convertCodeToStructure(code) {
- var structure = esprima.parse(code);
- NodeUtils.addXVerbatimPropertyToLiterals(structure);
- NodeUtils.parentize(structure);
- return NodeUtils.getBlockStatementNodeByIndex(structure);
- }
- }, {
- key: 'getBlockStatementNodeByIndex',
- value: function getBlockStatementNodeByIndex(node) {
- var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
- if (Nodes_1.Nodes.isNodeHasBlockStatement(node)) {
- if (node.body[index] === undefined) {
- throw new ReferenceError('Wrong index `' + index + '`. Block-statement body length is `' + node.body.length + '`');
- }
- return node.body[index];
- }
- throw new TypeError('The specified node have no a block-statement');
- }
- }, {
- key: 'getBlockScopeOfNode',
- value: function getBlockScopeOfNode(node) {
- var depth = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
- var parentNode = node.parentNode;
- if (!parentNode) {
- throw new ReferenceError('`parentNode` property of given node is `undefined`');
- }
- if (Nodes_1.Nodes.isBlockStatementNode(parentNode)) {
- if (!parentNode.parentNode) {
- throw new ReferenceError('`parentNode` property of `parentNode` of given node is `undefined`');
- }
- if (!Utils_1.Utils.arrayContains(NodeUtils.nodesWithBlockScope, parentNode.parentNode.type)) {
- return NodeUtils.getBlockScopeOfNode(parentNode, depth);
- } else if (depth > 0) {
- return NodeUtils.getBlockScopeOfNode(parentNode, --depth);
- }
- return parentNode;
- }
- if (Nodes_1.Nodes.isProgramNode(parentNode)) {
- return parentNode;
- }
- return NodeUtils.getBlockScopeOfNode(parentNode);
- }
- }, {
- key: 'insertNodeAtIndex',
- value: function insertNodeAtIndex(blockScopeBody, node, index) {
- if (!NodeUtils.validateNode(node)) {
- return;
- }
- blockScopeBody.splice(index, 0, node);
- }
- }, {
- key: 'parentize',
- value: function parentize(node) {
- var isRootNode = true;
- estraverse.replace(node, {
- enter: function enter(node, parentNode) {
- var value = void 0;
- if (isRootNode) {
- if (node.type === NodeType_1.NodeType.Program) {
- value = node;
- } else {
- value = Nodes_1.Nodes.getProgramNode([node]);
- value['parentNode'] = value;
- }
- isRootNode = false;
- } else {
- value = parentNode || node;
- }
- node['parentNode'] = value;
- }
- });
- }
- }, {
- key: 'prependNode',
- value: function prependNode(blockScopeBody, node) {
- if (!NodeUtils.validateNode(node)) {
- return;
- }
- blockScopeBody.unshift(node);
- }
- }, {
- key: 'validateNode',
- value: function validateNode(node) {
- return !!node && node.hasOwnProperty('type');
- }
- }]);
- return NodeUtils;
- }();
- NodeUtils.nodesWithBlockScope = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression, NodeType_1.NodeType.MethodDefinition, NodeType_1.NodeType.Program];
- exports.NodeUtils = NodeUtils;
- /***/ },
- /* 2 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- (function (AppendState) {
- AppendState[AppendState["AfterObfuscation"] = 0] = "AfterObfuscation";
- AppendState[AppendState["BeforeObfuscation"] = 1] = "BeforeObfuscation";
- })(exports.AppendState || (exports.AppendState = {}));
- var AppendState = exports.AppendState;
- /***/ },
- /* 3 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Node = function () {
- function Node(options) {
- _classCallCheck(this, Node);
- this.options = options;
- }
- _createClass(Node, [{
- key: "getAppendState",
- value: function getAppendState() {
- return this.appendState;
- }
- }, {
- key: "getNode",
- value: function getNode() {
- return this.getNodeStructure();
- }
- }]);
- return Node;
- }();
- exports.Node = Node;
- /***/ },
- /* 4 */
- /***/ function(module, exports) {
- module.exports = require("estraverse");
- /***/ },
- /* 5 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var JSFuck_1 = __webpack_require__(16);
- var Nodes_1 = __webpack_require__(6);
- var Utils_1 = __webpack_require__(0);
- var NodeObfuscator = function () {
- function NodeObfuscator(nodes, options) {
- _classCallCheck(this, NodeObfuscator);
- this.nodes = nodes;
- this.options = options;
- }
- _createClass(NodeObfuscator, [{
- key: "isReservedName",
- value: function isReservedName(name) {
- return this.options.reservedNames.some(function (reservedName) {
- return new RegExp(reservedName, 'g').test(name);
- });
- }
- }, {
- key: "storeIdentifiersNames",
- value: function storeIdentifiersNames(node, namesMap) {
- if (Nodes_1.Nodes.isIdentifierNode(node) && !this.isReservedName(node.name)) {
- namesMap.set(node.name, Utils_1.Utils.getRandomVariableName());
- }
- }
- }, {
- key: "replaceIdentifiersWithRandomNames",
- value: function replaceIdentifiersWithRandomNames(node, parentNode, namesMap) {
- if (Nodes_1.Nodes.isIdentifierNode(node) && namesMap.has(node.name)) {
- var parentNodeIsPropertyNode = Nodes_1.Nodes.isPropertyNode(parentNode) && parentNode.key === node,
- parentNodeIsMemberExpressionNode = Nodes_1.Nodes.isMemberExpressionNode(parentNode) && parentNode.computed === false && parentNode.property === node;
- if (parentNodeIsPropertyNode || parentNodeIsMemberExpressionNode) {
- return;
- }
- node.name = namesMap.get(node.name);
- }
- }
- }, {
- key: "replaceLiteralBooleanWithJSFuck",
- value: function replaceLiteralBooleanWithJSFuck(nodeValue) {
- return nodeValue ? JSFuck_1.JSFuck.True : JSFuck_1.JSFuck.False;
- }
- }, {
- key: "replaceLiteralNumberWithHexadecimalValue",
- value: function replaceLiteralNumberWithHexadecimalValue(nodeValue) {
- var prefix = '0x';
- if (!Utils_1.Utils.isInteger(nodeValue)) {
- return String(nodeValue);
- }
- return "" + prefix + Utils_1.Utils.decToHex(nodeValue);
- }
- }, {
- key: "replaceLiteralValueWithUnicodeValue",
- value: function replaceLiteralValueWithUnicodeValue(nodeValue) {
- var replaceWithUnicodeArrayFlag = Math.random() <= this.options.unicodeArrayThreshold;
- if (this.options.encodeUnicodeLiterals && replaceWithUnicodeArrayFlag) {
- nodeValue = Utils_1.Utils.btoa(nodeValue);
- }
- nodeValue = Utils_1.Utils.stringToUnicode(nodeValue);
- if (this.options.unicodeArray && replaceWithUnicodeArrayFlag) {
- return this.replaceLiteralValueWithUnicodeArrayCall(nodeValue);
- }
- return nodeValue;
- }
- }, {
- key: "replaceLiteralValueWithUnicodeArrayCall",
- value: function replaceLiteralValueWithUnicodeArrayCall(value) {
- var unicodeArrayNode = this.nodes.get('unicodeArrayNode');
- if (!unicodeArrayNode) {
- throw new ReferenceError('`unicodeArrayNode` node is not found in Map with custom nodes.');
- }
- var unicodeArray = unicodeArrayNode.getNodeData(),
- indexOfExistingValue = unicodeArray.getIndexOf(value),
- indexOfValue = void 0,
- hexadecimalIndex = void 0;
- if (indexOfExistingValue >= 0) {
- indexOfValue = indexOfExistingValue;
- } else {
- indexOfValue = unicodeArray.getLength();
- unicodeArrayNode.updateNodeData(value);
- }
- hexadecimalIndex = this.replaceLiteralNumberWithHexadecimalValue(indexOfValue);
- if (this.options.wrapUnicodeArrayCalls) {
- var unicodeArrayCallsWrapper = this.nodes.get('unicodeArrayCallsWrapper');
- if (!unicodeArrayCallsWrapper) {
- throw new ReferenceError('`unicodeArrayCallsWrapper` node is not found in Map with custom nodes.');
- }
- return unicodeArrayCallsWrapper.getNodeIdentifier() + "('" + hexadecimalIndex + "')";
- }
- return unicodeArrayNode.getNodeIdentifier() + "[" + hexadecimalIndex + "]";
- }
- }]);
- return NodeObfuscator;
- }();
- exports.NodeObfuscator = NodeObfuscator;
- /***/ },
- /* 6 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var NodeType_1 = __webpack_require__(7);
- var Nodes = function () {
- function Nodes() {
- _classCallCheck(this, Nodes);
- }
- _createClass(Nodes, null, [{
- key: "getProgramNode",
- value: function getProgramNode(bodyNode) {
- return {
- 'type': NodeType_1.NodeType.Program,
- 'body': bodyNode,
- 'sourceType': 'script'
- };
- }
- }, {
- key: "isBlockStatementNode",
- value: function isBlockStatementNode(node) {
- return node.type === NodeType_1.NodeType.BlockStatement;
- }
- }, {
- key: "isIdentifierNode",
- value: function isIdentifierNode(node) {
- return node.type === NodeType_1.NodeType.Identifier;
- }
- }, {
- key: "isLiteralNode",
- value: function isLiteralNode(node) {
- return node.type === NodeType_1.NodeType.Literal;
- }
- }, {
- key: "isMemberExpressionNode",
- value: function isMemberExpressionNode(node) {
- return node.type === NodeType_1.NodeType.MemberExpression;
- }
- }, {
- key: "isProgramNode",
- value: function isProgramNode(node) {
- return node.type === NodeType_1.NodeType.Program;
- }
- }, {
- key: "isPropertyNode",
- value: function isPropertyNode(node) {
- return node.type === NodeType_1.NodeType.Property;
- }
- }, {
- key: "isVariableDeclaratorNode",
- value: function isVariableDeclaratorNode(node) {
- return node.type === NodeType_1.NodeType.VariableDeclarator;
- }
- }, {
- key: "isNodeHasBlockStatement",
- value: function isNodeHasBlockStatement(node) {
- return node.hasOwnProperty('body') && Array.isArray(node.body);
- }
- }]);
- return Nodes;
- }();
- exports.Nodes = Nodes;
- /***/ },
- /* 7 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var Utils_1 = __webpack_require__(0);
- exports.NodeType = Utils_1.Utils.strEnumify({
- ArrayExpression: 'ArrayExpression',
- ArrowFunctionExpression: 'ArrowFunctionExpression',
- AssignmentExpression: 'AssignmentExpression',
- BinaryExpression: 'BinaryExpression',
- BlockStatement: 'BlockStatement',
- CallExpression: 'CallExpression',
- CatchClause: 'CatchClause',
- ClassDeclaration: 'ClassDeclaration',
- ExpressionStatement: 'ExpressionStatement',
- FunctionDeclaration: 'FunctionDeclaration',
- FunctionExpression: 'FunctionExpression',
- Identifier: 'Identifier',
- IfStatement: 'IfStatement',
- Literal: 'Literal',
- LogicalExpression: 'LogicalExpression',
- MemberExpression: 'MemberExpression',
- MethodDefinition: 'MethodDefinition',
- ObjectExpression: 'ObjectExpression',
- Program: 'Program',
- Property: 'Property',
- ReturnStatement: 'ReturnStatement',
- TryStatement: 'TryStatement',
- UnaryExpression: 'UnaryExpression',
- UpdateExpression: 'UpdateExpression',
- VariableDeclaration: 'VariableDeclaration',
- VariableDeclarator: 'VariableDeclarator',
- WhileStatement: 'WhileStatement'
- });
- /***/ },
- /* 8 */
- /***/ function(module, exports) {
- module.exports = require("format-unicorn");
- /***/ },
- /* 9 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var JavaScriptObfuscatorCLI_1 = __webpack_require__(25);
- var JavaScriptObfuscatorInternal_1 = __webpack_require__(14);
- var JavaScriptObfuscator = function () {
- function JavaScriptObfuscator() {
- _classCallCheck(this, JavaScriptObfuscator);
- }
- _createClass(JavaScriptObfuscator, null, [{
- key: "obfuscate",
- value: function obfuscate(sourceCode) {
- var obfuscatorOptions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
- var javaScriptObfuscator = new JavaScriptObfuscatorInternal_1.JavaScriptObfuscatorInternal(sourceCode, obfuscatorOptions);
- javaScriptObfuscator.obfuscate();
- return javaScriptObfuscator.getObfuscationResult();
- }
- }, {
- key: "runCLI",
- value: function runCLI(argv) {
- new JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI(argv).run();
- }
- }]);
- return JavaScriptObfuscator;
- }();
- exports.JavaScriptObfuscator = JavaScriptObfuscator;
- /***/ },
- /* 10 */
- /***/ function(module, exports) {
- module.exports = require("escodegen");
- /***/ },
- /* 11 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- exports.SourceMapMode = {
- Inline: 'inline',
- Separate: 'separate'
- };
- /***/ },
- /* 12 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var NodesGroup = function () {
- function NodesGroup(options) {
- _classCallCheck(this, NodesGroup);
- this.nodes = new Map();
- this.options = options;
- }
- _createClass(NodesGroup, [{
- key: "getNodes",
- value: function getNodes() {
- return this.nodes;
- }
- }]);
- return NodesGroup;
- }();
- exports.NodesGroup = NodesGroup;
- /***/ },
- /* 13 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var SourceMapMode_1 = __webpack_require__(11);
- exports.NO_CUSTOM_NODES_PRESET = Object.freeze({
- compact: true,
- debugProtection: false,
- debugProtectionInterval: false,
- disableConsoleOutput: false,
- encodeUnicodeLiterals: false,
- reservedNames: [],
- rotateUnicodeArray: false,
- selfDefending: false,
- sourceMap: false,
- sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
- unicodeArray: false,
- unicodeArrayThreshold: 0,
- wrapUnicodeArrayCalls: false
- });
- /***/ },
- /* 14 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var esprima = __webpack_require__(18);
- var escodegen = __webpack_require__(10);
- var ObfuscationResult_1 = __webpack_require__(15);
- var Obfuscator_1 = __webpack_require__(21);
- var Options_1 = __webpack_require__(47);
- var SourceMapCorrector_1 = __webpack_require__(22);
- var JavaScriptObfuscatorInternal = function () {
- function JavaScriptObfuscatorInternal(sourceCode, obfuscatorOptions) {
- _classCallCheck(this, JavaScriptObfuscatorInternal);
- this.sourceMapUrl = '';
- this.sourceCode = sourceCode;
- if (obfuscatorOptions) {
- this.options = new Options_1.Options(obfuscatorOptions);
- }
- }
- _createClass(JavaScriptObfuscatorInternal, [{
- key: 'getObfuscationResult',
- value: function getObfuscationResult() {
- return new SourceMapCorrector_1.SourceMapCorrector(new ObfuscationResult_1.ObfuscationResult(this.generatorOutput.code, this.generatorOutput.map), this.sourceMapUrl, this.options.sourceMapMode).correct();
- }
- }, {
- key: 'obfuscate',
- value: function obfuscate() {
- var astTree = esprima.parse(this.sourceCode, {
- loc: true
- });
- astTree = new Obfuscator_1.Obfuscator(this.options).obfuscateNode(astTree);
- this.generatorOutput = JavaScriptObfuscatorInternal.generateCode(this.sourceCode, astTree, this.options);
- }
- }, {
- key: 'setSourceMapUrl',
- value: function setSourceMapUrl(url) {
- this.sourceMapUrl = url;
- }
- }], [{
- key: 'generateCode',
- value: function generateCode(sourceCode, astTree, options) {
- var escodegenParams = Object.assign({}, JavaScriptObfuscatorInternal.escodegenParams),
- generatorOutput = void 0;
- if (options.sourceMap) {
- escodegenParams.sourceMap = 'sourceMap';
- escodegenParams.sourceContent = sourceCode;
- }
- escodegenParams.format = {
- compact: options.compact
- };
- generatorOutput = escodegen.generate(astTree, escodegenParams);
- generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
- return generatorOutput;
- }
- }]);
- return JavaScriptObfuscatorInternal;
- }();
- JavaScriptObfuscatorInternal.escodegenParams = {
- verbatim: 'x-verbatim-property',
- sourceMapWithCode: true
- };
- exports.JavaScriptObfuscatorInternal = JavaScriptObfuscatorInternal;
- /***/ },
- /* 15 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var ObfuscationResult = function () {
- function ObfuscationResult(obfuscatedCode, sourceMap) {
- _classCallCheck(this, ObfuscationResult);
- this.obfuscatedCode = obfuscatedCode;
- this.sourceMap = sourceMap;
- }
- _createClass(ObfuscationResult, [{
- key: "getObfuscatedCode",
- value: function getObfuscatedCode() {
- return this.obfuscatedCode;
- }
- }, {
- key: "getSourceMap",
- value: function getSourceMap() {
- return this.sourceMap;
- }
- }, {
- key: "toString",
- value: function toString() {
- return this.obfuscatedCode;
- }
- }]);
- return ObfuscationResult;
- }();
- exports.ObfuscationResult = ObfuscationResult;
- /***/ },
- /* 16 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- exports.JSFuck = {
- Window: '[]["filter"]["constructor"]("return this")()',
- False: '![]',
- True: '!![]',
- a: '(false+"")[1]',
- b: '([]["entries"]()+"")[2]',
- c: '([]["fill"]+"")[3]',
- d: '(undefined+"")[2]',
- e: '(true+"")[3]',
- f: '(false+"")[0]',
- g: '(false+[0]+String)[20]',
- h: '(+(101))["to"+String["name"]](21)[1]',
- i: '([false]+undefined)[10]',
- j: '([]["entries"]()+"")[3]',
- k: '(+(20))["to"+String["name"]](21)',
- l: '(false+"")[2]',
- m: '(Number+"")[11]',
- n: '(undefined+"")[1]',
- o: '(true+[]["fill"])[10]',
- p: '(+(211))["to"+String["name"]](31)[1]',
- q: '(+(212))["to"+String["name"]](31)[1]',
- r: '(true+"")[1]',
- s: '(false+"")[3]',
- t: '(true+"")[0]',
- u: '(undefined+"")[0]',
- v: '(+(31))["to"+String["name"]](32)',
- w: '(+(32))["to"+String["name"]](33)',
- x: '(+(101))["to"+String["name"]](34)[1]',
- y: '(NaN+[Infinity])[10]',
- z: '(+(35))["to"+String["name"]](36)',
- A: '(+[]+Array)[10]',
- B: '(+[]+Boolean)[10]',
- C: 'Function("return escape")()(("")["italics"]())[2]',
- D: 'Function("return escape")()([]["fill"])["slice"]("-1")',
- E: '(RegExp+"")[12]',
- F: '(+[]+Function)[10]',
- G: '(false+Function("return Date")()())[30]',
- H: '\'H\'',
- I: '(Infinity+"")[0]',
- J: '\'J\'',
- K: '\'K\'',
- L: '\'L\'',
- M: '(true+Function("return Date")()())[30]',
- N: '(NaN+"")[0]',
- O: '(NaN+Function("return{}")())[11]',
- P: '\'P\'',
- Q: '\'Q\'',
- R: '(+[]+RegExp)[10]',
- S: '(+[]+String)[10]',
- T: '(NaN+Function("return Date")()())[30]',
- U: '(NaN+Function("return{}")()["to"+String["name"]]["call"]())[11]',
- V: '\'V\'',
- W: '\'W\'',
- X: '\'X\'',
- Y: '\'Y\'',
- Z: '\'Z\''
- };
- /***/ },
- /* 17 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var SourceMapMode_1 = __webpack_require__(11);
- exports.DEFAULT_PRESET = Object.freeze({
- compact: true,
- debugProtection: false,
- debugProtectionInterval: false,
- disableConsoleOutput: true,
- encodeUnicodeLiterals: false,
- reservedNames: [],
- rotateUnicodeArray: true,
- selfDefending: true,
- sourceMap: false,
- sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
- unicodeArray: true,
- unicodeArrayThreshold: 0.8,
- wrapUnicodeArrayCalls: true
- });
- /***/ },
- /* 18 */
- /***/ function(module, exports) {
- module.exports = require("esprima");
- /***/ },
- /* 19 */
- /***/ function(module, exports) {
- module.exports = require("path");
- /***/ },
- /* 20 */
- /***/ function(module, exports) {
- module.exports = require("babel-polyfill");
- /***/ },
- /* 21 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var estraverse = __webpack_require__(4);
- var AppendState_1 = __webpack_require__(2);
- var NodeType_1 = __webpack_require__(7);
- var CatchClauseObfuscator_1 = __webpack_require__(39);
- var ConsoleOutputNodesGroup_1 = __webpack_require__(35);
- var DebugProtectionNodesGroup_1 = __webpack_require__(36);
- var FunctionDeclarationObfuscator_1 = __webpack_require__(40);
- var FunctionObfuscator_1 = __webpack_require__(41);
- var LiteralObfuscator_1 = __webpack_require__(42);
- var MemberExpressionObfuscator_1 = __webpack_require__(43);
- var MethodDefinitionObfuscator_1 = __webpack_require__(44);
- var Nodes_1 = __webpack_require__(6);
- var NodeUtils_1 = __webpack_require__(1);
- var ObjectExpressionObfuscator_1 = __webpack_require__(45);
- var SelfDefendingNodesGroup_1 = __webpack_require__(37);
- var UnicodeArrayNodesGroup_1 = __webpack_require__(38);
- var VariableDeclarationObfuscator_1 = __webpack_require__(46);
- var Obfuscator = function () {
- function Obfuscator(options) {
- _classCallCheck(this, Obfuscator);
- this.nodeObfuscators = new Map([[NodeType_1.NodeType.ArrowFunctionExpression, [FunctionObfuscator_1.FunctionObfuscator]], [NodeType_1.NodeType.ClassDeclaration, [FunctionDeclarationObfuscator_1.FunctionDeclarationObfuscator]], [NodeType_1.NodeType.CatchClause, [CatchClauseObfuscator_1.CatchClauseObfuscator]], [NodeType_1.NodeType.FunctionDeclaration, [FunctionDeclarationObfuscator_1.FunctionDeclarationObfuscator, FunctionObfuscator_1.FunctionObfuscator]], [NodeType_1.NodeType.FunctionExpression, [FunctionObfuscator_1.FunctionObfuscator]], [NodeType_1.NodeType.MemberExpression, [MemberExpressionObfuscator_1.MemberExpressionObfuscator]], [NodeType_1.NodeType.MethodDefinition, [MethodDefinitionObfuscator_1.MethodDefinitionObfuscator]], [NodeType_1.NodeType.ObjectExpression, [ObjectExpressionObfuscator_1.ObjectExpressionObfuscator]], [NodeType_1.NodeType.VariableDeclaration, [VariableDeclarationObfuscator_1.VariableDeclarationObfuscator]], [NodeType_1.NodeType.Literal, [LiteralObfuscator_1.LiteralObfuscator]]]);
- this.options = options;
- this.nodes = new Map([].concat(_toConsumableArray(new SelfDefendingNodesGroup_1.SelfDefendingNodesGroup(this.options).getNodes()), _toConsumableArray(new ConsoleOutputNodesGroup_1.ConsoleOutputNodesGroup(this.options).getNodes()), _toConsumableArray(new DebugProtectionNodesGroup_1.DebugProtectionNodesGroup(this.options).getNodes()), _toConsumableArray(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options).getNodes())));
- }
- _createClass(Obfuscator, [{
- key: 'obfuscateNode',
- value: function obfuscateNode(node) {
- if (Nodes_1.Nodes.isProgramNode(node) && !node.body.length) {
- return node;
- }
- NodeUtils_1.NodeUtils.parentize(node);
- this.beforeObfuscation(node);
- this.obfuscate(node);
- this.afterObfuscation(node);
- return node;
- }
- }, {
- key: 'afterObfuscation',
- value: function afterObfuscation(astTree) {
- this.nodes.forEach(function (node) {
- if (node.getAppendState() === AppendState_1.AppendState.AfterObfuscation) {
- node.appendNode(astTree);
- }
- });
- }
- }, {
- key: 'beforeObfuscation',
- value: function beforeObfuscation(astTree) {
- this.nodes.forEach(function (node) {
- if (node.getAppendState() === AppendState_1.AppendState.BeforeObfuscation) {
- node.appendNode(astTree);
- }
- });
- }
- }, {
- key: 'initializeNodeObfuscators',
- value: function initializeNodeObfuscators(node, parentNode) {
- var _this = this;
- var nodeObfuscators = this.nodeObfuscators.get(node.type);
- if (!nodeObfuscators) {
- return;
- }
- nodeObfuscators.forEach(function (obfuscator) {
- new obfuscator(_this.nodes, _this.options).obfuscateNode(node, parentNode);
- });
- }
- }, {
- key: 'obfuscate',
- value: function obfuscate(node) {
- var _this2 = this;
- estraverse.replace(node, {
- leave: function leave(node, parentNode) {
- _this2.initializeNodeObfuscators(node, parentNode);
- }
- });
- }
- }]);
- return Obfuscator;
- }();
- exports.Obfuscator = Obfuscator;
- /***/ },
- /* 22 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var SourceMapMode_1 = __webpack_require__(11);
- var ObfuscationResult_1 = __webpack_require__(15);
- var Utils_1 = __webpack_require__(0);
- var SourceMapCorrector = function () {
- function SourceMapCorrector(obfuscationResult, sourceMapUrl, sourceMapMode) {
- _classCallCheck(this, SourceMapCorrector);
- this.obfuscatedCode = obfuscationResult.getObfuscatedCode();
- this.sourceMap = obfuscationResult.getSourceMap();
- this.sourceMapUrl = sourceMapUrl;
- this.sourceMapMode = sourceMapMode;
- }
- _createClass(SourceMapCorrector, [{
- key: "correct",
- value: function correct() {
- return new ObfuscationResult_1.ObfuscationResult(this.correctObfuscatedCode(), this.correctSourceMap());
- }
- }, {
- key: "correctObfuscatedCode",
- value: function correctObfuscatedCode() {
- if (!this.sourceMap) {
- return this.obfuscatedCode;
- }
- var sourceMappingUrl = '//# sourceMappingURL=';
- switch (this.sourceMapMode) {
- case SourceMapMode_1.SourceMapMode.Inline:
- sourceMappingUrl += "data:application/json;base64," + Utils_1.Utils.btoa(this.sourceMapUrl || this.sourceMap, false);
- break;
- case SourceMapMode_1.SourceMapMode.Separate:
- default:
- if (this.sourceMapUrl) {
- sourceMappingUrl += this.sourceMapUrl;
- break;
- }
- return this.obfuscatedCode;
- }
- return this.obfuscatedCode + "\n" + sourceMappingUrl;
- }
- }, {
- key: "correctSourceMap",
- value: function correctSourceMap() {
- if (this.sourceMapMode === SourceMapMode_1.SourceMapMode.Inline) {
- return '';
- }
- return this.sourceMap;
- }
- }]);
- return SourceMapCorrector;
- }();
- exports.SourceMapCorrector = SourceMapCorrector;
- /***/ },
- /* 23 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Utils_1 = __webpack_require__(0);
- var UnicodeArray = function () {
- function UnicodeArray() {
- _classCallCheck(this, UnicodeArray);
- this.array = [];
- }
- _createClass(UnicodeArray, [{
- key: "addToArray",
- value: function addToArray(value) {
- this.array.push(value);
- }
- }, {
- key: "getArray",
- value: function getArray() {
- return this.array;
- }
- }, {
- key: "getIndexOf",
- value: function getIndexOf(value) {
- return this.array.indexOf(value);
- }
- }, {
- key: "getLength",
- value: function getLength() {
- return this.array.length;
- }
- }, {
- key: "rotateArray",
- value: function rotateArray(rotationValue) {
- this.array = Utils_1.Utils.arrayRotate(this.array, rotationValue);
- }
- }, {
- key: "toString",
- value: function toString() {
- return this.array.toString();
- }
- }]);
- return UnicodeArray;
- }();
- exports.UnicodeArray = UnicodeArray;
- /***/ },
- /* 24 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var fs = __webpack_require__(65);
- var mkdirp = __webpack_require__(66);
- var path = __webpack_require__(19);
- var Utils_1 = __webpack_require__(0);
- var CLIUtils = function () {
- function CLIUtils() {
- _classCallCheck(this, CLIUtils);
- }
- _createClass(CLIUtils, null, [{
- key: 'getOutputCodePath',
- value: function getOutputCodePath(outputPath, inputPath) {
- if (outputPath) {
- return outputPath;
- }
- return inputPath.split('.').map(function (value, index) {
- return index === 0 ? value + '-obfuscated' : value;
- }).join('.');
- }
- }, {
- key: 'getOutputSourceMapPath',
- value: function getOutputSourceMapPath(outputCodePath) {
- return outputCodePath.split('.').map(function (value, index, array) {
- return index === array.length - 1 ? value + '.map' : value;
- }).join('.');
- }
- }, {
- key: 'getPackageConfig',
- value: function getPackageConfig() {
- return JSON.parse(fs.readFileSync(path.join(path.dirname(fs.realpathSync(process.argv[1])), '../package.json'), CLIUtils.encoding));
- }
- }, {
- key: 'isFilePath',
- value: function isFilePath(filePath) {
- try {
- return fs.statSync(filePath).isFile();
- } catch (e) {
- return false;
- }
- }
- }, {
- key: 'readFile',
- value: function readFile(inputPath) {
- return fs.readFileSync(inputPath, CLIUtils.encoding);
- }
- }, {
- key: 'validateInputPath',
- value: function validateInputPath(inputPath) {
- if (!CLIUtils.isFilePath(inputPath)) {
- throw new ReferenceError('Given input path must be a valid file path');
- }
- if (!Utils_1.Utils.arrayContains(CLIUtils.availableInputExtensions, path.extname(inputPath))) {
- throw new ReferenceError('Input file must have .js extension');
- }
- }
- }, {
- key: 'writeFile',
- value: function writeFile(outputPath, data) {
- mkdirp.sync(path.dirname(outputPath));
- fs.writeFileSync(outputPath, data, {
- encoding: CLIUtils.encoding
- });
- }
- }]);
- return CLIUtils;
- }();
- CLIUtils.availableInputExtensions = ['.js'];
- CLIUtils.encoding = 'utf8';
- exports.CLIUtils = CLIUtils;
- /***/ },
- /* 25 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var commander = __webpack_require__(64);
- var path = __webpack_require__(19);
- var SourceMapMode_1 = __webpack_require__(11);
- var DefaultPreset_1 = __webpack_require__(17);
- var CLIUtils_1 = __webpack_require__(24);
- var JavaScriptObfuscator_1 = __webpack_require__(9);
- var JavaScriptObfuscatorInternal_1 = __webpack_require__(14);
- var Utils_1 = __webpack_require__(0);
- var JavaScriptObfuscatorCLI = function () {
- function JavaScriptObfuscatorCLI(argv) {
- _classCallCheck(this, JavaScriptObfuscatorCLI);
- this.data = '';
- this.rawArguments = argv;
- this.arguments = this.rawArguments.slice(2);
- }
- _createClass(JavaScriptObfuscatorCLI, [{
- key: 'run',
- value: function run() {
- this.configureCommands();
- if (!this.arguments.length || Utils_1.Utils.arrayContains(this.arguments, '--help')) {
- this.commands.outputHelp();
- return;
- }
- this.inputPath = this.arguments[0];
- CLIUtils_1.CLIUtils.validateInputPath(this.inputPath);
- this.getData();
- this.processData();
- }
- }, {
- key: 'buildOptions',
- value: function buildOptions() {
- var obfuscatorOptions = {},
- availableOptions = Object.keys(DefaultPreset_1.DEFAULT_PRESET);
- for (var option in this.commands) {
- if (!this.commands.hasOwnProperty(option)) {
- continue;
- }
- if (!Utils_1.Utils.arrayContains(availableOptions, option)) {
- continue;
- }
- obfuscatorOptions[option] = this.commands[option];
- }
- return Object.assign({}, DefaultPreset_1.DEFAULT_PRESET, obfuscatorOptions);
- }
- }, {
- key: 'configureCommands',
- value: function configureCommands() {
- this.commands = new commander.Command().version(JavaScriptObfuscatorCLI.getBuildVersion(), '-v, --version').usage('<inputPath> [options]').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean).option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean).option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', function (val) {
- return val.split(',');
- }).option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean).option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMap <boolean>', 'Enables source map generation', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMapMode <string> [inline, separate]', 'Specify source map output mode', JavaScriptObfuscatorCLI.parseSourceMapMode).option('--unicodeArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', JavaScriptObfuscatorCLI.parseBoolean).option('--unicodeArrayThreshold <number>', 'The probability that the literal string will be inserted into unicodeArray (Default: 0.8, Min: 0, Max: 1)', parseFloat).option('--wrapUnicodeArrayCalls <boolean>', 'Disables usage of special access function instead of direct array call', JavaScriptObfuscatorCLI.parseBoolean).parse(this.rawArguments);
- this.commands.on('--help', function () {
- console.log(' Examples:\n');
- console.log(' %> javascript-obfuscator in.js --compact true --selfDefending false');
- console.log(' %> javascript-obfuscator in.js --output out.js --compact true --selfDefending false');
- console.log('');
- });
- }
- }, {
- key: 'getData',
- value: function getData() {
- this.data = CLIUtils_1.CLIUtils.readFile(this.inputPath);
- }
- }, {
- key: 'processData',
- value: function processData() {
- var options = this.buildOptions(),
- outputCodePath = CLIUtils_1.CLIUtils.getOutputCodePath(this.commands.output, this.inputPath);
- if (options.sourceMap) {
- this.processDataWithSourceMap(outputCodePath, options);
- } else {
- this.processDataWithoutSourceMap(outputCodePath, options);
- }
- }
- }, {
- key: 'processDataWithoutSourceMap',
- value: function processDataWithoutSourceMap(outputCodePath, options) {
- var obfuscatedCode = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(this.data, options).getObfuscatedCode();
- CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscatedCode);
- }
- }, {
- key: 'processDataWithSourceMap',
- value: function processDataWithSourceMap(outputCodePath, options) {
- var javaScriptObfuscator = new JavaScriptObfuscatorInternal_1.JavaScriptObfuscatorInternal(this.data, options),
- obfuscationResult = void 0,
- outputSourceMapPath = CLIUtils_1.CLIUtils.getOutputSourceMapPath(outputCodePath);
- javaScriptObfuscator.obfuscate();
- if (options.sourceMapMode === SourceMapMode_1.SourceMapMode.Separate) {
- javaScriptObfuscator.setSourceMapUrl(path.basename(outputSourceMapPath));
- }
- obfuscationResult = javaScriptObfuscator.getObfuscationResult();
- CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscationResult.getObfuscatedCode());
- if (obfuscationResult.getSourceMap()) {
- CLIUtils_1.CLIUtils.writeFile(outputSourceMapPath, obfuscationResult.getSourceMap());
- }
- }
- }], [{
- key: 'getBuildVersion',
- value: function getBuildVersion() {
- return CLIUtils_1.CLIUtils.getPackageConfig().version;
- }
- }, {
- key: 'parseBoolean',
- value: function parseBoolean(value) {
- return value === 'true' || value === '1';
- }
- }, {
- key: 'parseSourceMapMode',
- value: function parseSourceMapMode(value) {
- var availableMode = Object.keys(SourceMapMode_1.SourceMapMode).some(function (key) {
- return SourceMapMode_1.SourceMapMode[key] === value;
- });
- if (!availableMode) {
- throw new ReferenceError('Invalid value of `--sourceMapMode` option');
- }
- return value;
- }
- }]);
- return JavaScriptObfuscatorCLI;
- }();
- exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLI;
- /***/ },
- /* 26 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var AppendState_1 = __webpack_require__(2);
- var ConsoleOutputDisableExpressionTemplate_1 = __webpack_require__(51);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var ConsoleOutputDisableExpressionNode = function (_Node_1$Node) {
- _inherits(ConsoleOutputDisableExpressionNode, _Node_1$Node);
- function ConsoleOutputDisableExpressionNode() {
- var _Object$getPrototypeO;
- _classCallCheck(this, ConsoleOutputDisableExpressionNode);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call.apply(_Object$getPrototypeO, [this].concat(args)));
- _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
- return _this;
- }
- _createClass(ConsoleOutputDisableExpressionNode, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- return NodeUtils_1.NodeUtils.convertCodeToStructure(ConsoleOutputDisableExpressionTemplate_1.ConsoleOutputDisableExpressionTemplate());
- }
- }]);
- return ConsoleOutputDisableExpressionNode;
- }(Node_1.Node);
- exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
- /***/ },
- /* 27 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- __webpack_require__(8);
- var AppendState_1 = __webpack_require__(2);
- var DebufProtectionFunctionCallTemplate_1 = __webpack_require__(52);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var DebugProtectionFunctionCallNode = function (_Node_1$Node) {
- _inherits(DebugProtectionFunctionCallNode, _Node_1$Node);
- function DebugProtectionFunctionCallNode(debugProtectionFunctionName, options) {
- _classCallCheck(this, DebugProtectionFunctionCallNode);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionCallNode).call(this, options));
- _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
- _this.debugProtectionFunctionName = debugProtectionFunctionName;
- return _this;
- }
- _createClass(DebugProtectionFunctionCallNode, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- return NodeUtils_1.NodeUtils.convertCodeToStructure(DebufProtectionFunctionCallTemplate_1.DebugProtectionFunctionCallTemplate().formatUnicorn({
- debugProtectionFunctionName: this.debugProtectionFunctionName
- }));
- }
- }]);
- return DebugProtectionFunctionCallNode;
- }(Node_1.Node);
- exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
- /***/ },
- /* 28 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- __webpack_require__(8);
- var AppendState_1 = __webpack_require__(2);
- var DebugProtectionFunctionIntervalTemplate_1 = __webpack_require__(53);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var DebugProtectionFunctionIntervalNode = function (_Node_1$Node) {
- _inherits(DebugProtectionFunctionIntervalNode, _Node_1$Node);
- function DebugProtectionFunctionIntervalNode(debugProtectionFunctionName, options) {
- _classCallCheck(this, DebugProtectionFunctionIntervalNode);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionIntervalNode).call(this, options));
- _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
- _this.debugProtectionFunctionName = debugProtectionFunctionName;
- return _this;
- }
- _createClass(DebugProtectionFunctionIntervalNode, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- return NodeUtils_1.NodeUtils.convertCodeToStructure(DebugProtectionFunctionIntervalTemplate_1.DebugProtectionFunctionIntervalTemplate().formatUnicorn({
- debugProtectionFunctionName: this.debugProtectionFunctionName
- }));
- }
- }]);
- return DebugProtectionFunctionIntervalNode;
- }(Node_1.Node);
- exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
- /***/ },
- /* 29 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- __webpack_require__(8);
- var AppendState_1 = __webpack_require__(2);
- var DebugProtectionFunctionTemplate_1 = __webpack_require__(54);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var DebugProtectionFunctionNode = function (_Node_1$Node) {
- _inherits(DebugProtectionFunctionNode, _Node_1$Node);
- function DebugProtectionFunctionNode(debugProtectionFunctionName, options) {
- _classCallCheck(this, DebugProtectionFunctionNode);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionNode).call(this, options));
- _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
- _this.debugProtectionFunctionName = debugProtectionFunctionName;
- return _this;
- }
- _createClass(DebugProtectionFunctionNode, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- var programBodyLength = blockScopeNode.body.length,
- randomIndex = Utils_1.Utils.getRandomGenerator().integer({
- min: 0,
- max: programBodyLength
- });
- NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex);
- }
- }, {
- key: "getNodeIdentifier",
- value: function getNodeIdentifier() {
- return this.debugProtectionFunctionName;
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- return NodeUtils_1.NodeUtils.convertCodeToStructure(DebugProtectionFunctionTemplate_1.DebugProtectionFunctionTemplate().formatUnicorn({
- debugProtectionFunctionName: this.debugProtectionFunctionName
- }));
- }
- }]);
- return DebugProtectionFunctionNode;
- }(Node_1.Node);
- exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
- /***/ },
- /* 30 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var AppendState_1 = __webpack_require__(2);
- var NoCustomNodesPreset_1 = __webpack_require__(13);
- var SelfDefendingTemplate_1 = __webpack_require__(55);
- var JavaScriptObfuscator_1 = __webpack_require__(9);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var SelfDefendingUnicodeNode = function (_Node_1$Node) {
- _inherits(SelfDefendingUnicodeNode, _Node_1$Node);
- function SelfDefendingUnicodeNode() {
- var _Object$getPrototypeO;
- _classCallCheck(this, SelfDefendingUnicodeNode);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SelfDefendingUnicodeNode)).call.apply(_Object$getPrototypeO, [this].concat(args)));
- _this.appendState = AppendState_1.AppendState.AfterObfuscation;
- return _this;
- }
- _createClass(SelfDefendingUnicodeNode, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- var programBodyLength = blockScopeNode.body.length,
- randomIndex = 0;
- if (programBodyLength > 2) {
- randomIndex = Utils_1.Utils.getRandomGenerator().integer({
- min: programBodyLength / 2,
- max: programBodyLength - 1
- });
- }
- NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex);
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(SelfDefendingTemplate_1.SelfDefendingTemplate(), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode());
- }
- }]);
- return SelfDefendingUnicodeNode;
- }(Node_1.Node);
- exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
- /***/ },
- /* 31 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- __webpack_require__(8);
- var AppendState_1 = __webpack_require__(2);
- var UnicodeArrayCallsWrapperTemplate_1 = __webpack_require__(56);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var UnicodeArrayCallsWrapper = function (_Node_1$Node) {
- _inherits(UnicodeArrayCallsWrapper, _Node_1$Node);
- function UnicodeArrayCallsWrapper(unicodeArrayCallsWrapperName, unicodeArrayName, unicodeArray, options) {
- _classCallCheck(this, UnicodeArrayCallsWrapper);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayCallsWrapper).call(this, options));
- _this.appendState = AppendState_1.AppendState.AfterObfuscation;
- _this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
- _this.unicodeArrayName = unicodeArrayName;
- _this.unicodeArray = unicodeArray;
- return _this;
- }
- _createClass(UnicodeArrayCallsWrapper, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- if (!this.unicodeArray.getLength()) {
- return;
- }
- NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
- }
- }, {
- key: "getNodeIdentifier",
- value: function getNodeIdentifier() {
- return this.unicodeArrayCallsWrapperName;
- }
- }, {
- key: "getNode",
- value: function getNode() {
- return _get(Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), "getNode", this).call(this);
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- var keyName = Utils_1.Utils.getRandomVariableName();
- return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayCallsWrapperTemplate_1.UnicodeArrayCallsWrapperTemplate().formatUnicorn({
- keyName: keyName,
- unicodeArrayCallsWrapperName: this.unicodeArrayCallsWrapperName,
- unicodeArrayName: this.unicodeArrayName
- }));
- }
- }]);
- return UnicodeArrayCallsWrapper;
- }(Node_1.Node);
- exports.UnicodeArrayCallsWrapper = UnicodeArrayCallsWrapper;
- /***/ },
- /* 32 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- __webpack_require__(8);
- var AppendState_1 = __webpack_require__(2);
- var NoCustomNodesPreset_1 = __webpack_require__(13);
- var AtobTemplate_1 = __webpack_require__(50);
- var SelfDefendingTemplate_1 = __webpack_require__(57);
- var UnicodeArrayDecodeTemplate_1 = __webpack_require__(58);
- var JavaScriptObfuscator_1 = __webpack_require__(9);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var UnicodeArrayDecodeNode = function (_Node_1$Node) {
- _inherits(UnicodeArrayDecodeNode, _Node_1$Node);
- function UnicodeArrayDecodeNode(unicodeArrayName, unicodeArray, options) {
- _classCallCheck(this, UnicodeArrayDecodeNode);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayDecodeNode).call(this, options));
- _this.appendState = AppendState_1.AppendState.AfterObfuscation;
- _this.unicodeArrayName = unicodeArrayName;
- _this.unicodeArray = unicodeArray;
- return _this;
- }
- _createClass(UnicodeArrayDecodeNode, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- if (!this.unicodeArray.getLength()) {
- return;
- }
- NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
- }
- }, {
- key: "getNode",
- value: function getNode() {
- return _get(Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), "getNode", this).call(this);
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- var forLoopFunctionName = 'forLoopFunc';
- var code = void 0;
- if (this.options.selfDefending) {
- code = SelfDefendingTemplate_1.SelfDefendingTemplate().formatUnicorn({
- forLoopFunctionName: forLoopFunctionName,
- unicodeArrayName: this.unicodeArrayName
- });
- } else {
- code = forLoopFunctionName + "();";
- }
- return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(UnicodeArrayDecodeTemplate_1.UnicodeArrayDecodeTemplate().formatUnicorn({
- atobPolyfill: AtobTemplate_1.AtobTemplate(),
- code: code,
- forLoopFunctionName: forLoopFunctionName,
- unicodeArrayName: this.unicodeArrayName
- }), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode());
- }
- }]);
- return UnicodeArrayDecodeNode;
- }(Node_1.Node);
- exports.UnicodeArrayDecodeNode = UnicodeArrayDecodeNode;
- /***/ },
- /* 33 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- __webpack_require__(8);
- var AppendState_1 = __webpack_require__(2);
- var UnicodeArrayTemplate_1 = __webpack_require__(59);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var UnicodeArrayNode = function (_Node_1$Node) {
- _inherits(UnicodeArrayNode, _Node_1$Node);
- function UnicodeArrayNode(unicodeArray, unicodeArrayName) {
- var unicodeArrayRotateValue = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
- var options = arguments[3];
- _classCallCheck(this, UnicodeArrayNode);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNode).call(this, options));
- _this.appendState = AppendState_1.AppendState.AfterObfuscation;
- _this.unicodeArray = unicodeArray;
- _this.unicodeArrayName = unicodeArrayName;
- _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
- return _this;
- }
- _createClass(UnicodeArrayNode, [{
- key: 'appendNode',
- value: function appendNode(blockScopeNode) {
- if (!this.unicodeArray.getLength()) {
- return;
- }
- NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
- }
- }, {
- key: 'getNodeIdentifier',
- value: function getNodeIdentifier() {
- return this.unicodeArrayName;
- }
- }, {
- key: 'getNodeData',
- value: function getNodeData() {
- return this.unicodeArray;
- }
- }, {
- key: 'getNode',
- value: function getNode() {
- this.unicodeArray.rotateArray(this.unicodeArrayRotateValue);
- return _get(Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
- }
- }, {
- key: 'updateNodeData',
- value: function updateNodeData(data) {
- this.unicodeArray.addToArray(data);
- }
- }, {
- key: 'getNodeStructure',
- value: function getNodeStructure() {
- return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayTemplate_1.UnicodeArrayTemplate().formatUnicorn({
- unicodeArrayName: this.unicodeArrayName,
- unicodeArray: this.unicodeArray.toString()
- }));
- }
- }]);
- return UnicodeArrayNode;
- }(Node_1.Node);
- UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH = 4;
- exports.UnicodeArrayNode = UnicodeArrayNode;
- /***/ },
- /* 34 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- __webpack_require__(8);
- var AppendState_1 = __webpack_require__(2);
- var NoCustomNodesPreset_1 = __webpack_require__(13);
- var SelfDefendingTemplate_1 = __webpack_require__(60);
- var UnicodeArrayRotateFunctionTemplate_1 = __webpack_require__(61);
- var JavaScriptObfuscator_1 = __webpack_require__(9);
- var Node_1 = __webpack_require__(3);
- var NodeUtils_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var UnicodeArrayRotateFunctionNode = function (_Node_1$Node) {
- _inherits(UnicodeArrayRotateFunctionNode, _Node_1$Node);
- function UnicodeArrayRotateFunctionNode(unicodeArrayName, unicodeArray, unicodeArrayRotateValue, options) {
- _classCallCheck(this, UnicodeArrayRotateFunctionNode);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayRotateFunctionNode).call(this, options));
- _this.appendState = AppendState_1.AppendState.AfterObfuscation;
- _this.unicodeArrayName = unicodeArrayName;
- _this.unicodeArray = unicodeArray;
- _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
- return _this;
- }
- _createClass(UnicodeArrayRotateFunctionNode, [{
- key: "appendNode",
- value: function appendNode(blockScopeNode) {
- if (!this.unicodeArray.getLength()) {
- return;
- }
- NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
- }
- }, {
- key: "getNode",
- value: function getNode() {
- return _get(Object.getPrototypeOf(UnicodeArrayRotateFunctionNode.prototype), "getNode", this).call(this);
- }
- }, {
- key: "getNodeStructure",
- value: function getNodeStructure() {
- var code = '',
- timesName = Utils_1.Utils.getRandomVariableName(),
- whileFunctionName = Utils_1.Utils.getRandomVariableName();
- if (this.options.selfDefending) {
- code = SelfDefendingTemplate_1.SelfDefendingTemplate().formatUnicorn({
- timesName: timesName,
- whileFunctionName: whileFunctionName
- });
- } else {
- code = whileFunctionName + "(++" + timesName + ")";
- }
- return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(UnicodeArrayRotateFunctionTemplate_1.UnicodeArrayRotateFunctionTemplate().formatUnicorn({
- code: code,
- timesName: timesName,
- unicodeArrayName: this.unicodeArrayName,
- unicodeArrayRotateValue: Utils_1.Utils.decToHex(this.unicodeArrayRotateValue),
- whileFunctionName: whileFunctionName
- }), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode());
- }
- }]);
- return UnicodeArrayRotateFunctionNode;
- }(Node_1.Node);
- exports.UnicodeArrayRotateFunctionNode = UnicodeArrayRotateFunctionNode;
- /***/ },
- /* 35 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(26);
- var NodesGroup_1 = __webpack_require__(12);
- var ConsoleOutputNodesGroup = function (_NodesGroup_1$NodesGr) {
- _inherits(ConsoleOutputNodesGroup, _NodesGroup_1$NodesGr);
- function ConsoleOutputNodesGroup(options) {
- _classCallCheck(this, ConsoleOutputNodesGroup);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ConsoleOutputNodesGroup).call(this, options));
- if (!_this.options.disableConsoleOutput) {
- return _possibleConstructorReturn(_this);
- }
- _this.nodes.set('consoleOutputDisableExpressionNode', new ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode(_this.options));
- return _this;
- }
- return ConsoleOutputNodesGroup;
- }(NodesGroup_1.NodesGroup);
- exports.ConsoleOutputNodesGroup = ConsoleOutputNodesGroup;
- /***/ },
- /* 36 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var DebugProtectionFunctionCallNode_1 = __webpack_require__(27);
- var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(28);
- var DebugProtectionFunctionNode_1 = __webpack_require__(29);
- var NodesGroup_1 = __webpack_require__(12);
- var Utils_1 = __webpack_require__(0);
- var DebugProtectionNodesGroup = function (_NodesGroup_1$NodesGr) {
- _inherits(DebugProtectionNodesGroup, _NodesGroup_1$NodesGr);
- function DebugProtectionNodesGroup(options) {
- _classCallCheck(this, DebugProtectionNodesGroup);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionNodesGroup).call(this, options));
- _this.debugProtectionFunctionIdentifier = Utils_1.Utils.getRandomVariableName();
- if (!_this.options.debugProtection) {
- return _possibleConstructorReturn(_this);
- }
- _this.nodes.set('debugProtectionFunctionNode', new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(_this.debugProtectionFunctionIdentifier, _this.options));
- _this.nodes.set('debugProtectionFunctionCallNode', new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(_this.debugProtectionFunctionIdentifier, _this.options));
- if (_this.options.debugProtectionInterval) {
- _this.nodes.set('debugProtectionFunctionIntervalNode', new DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode(_this.debugProtectionFunctionIdentifier, _this.options));
- }
- return _this;
- }
- return DebugProtectionNodesGroup;
- }(NodesGroup_1.NodesGroup);
- exports.DebugProtectionNodesGroup = DebugProtectionNodesGroup;
- /***/ },
- /* 37 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var NodesGroup_1 = __webpack_require__(12);
- var SelfDefendingUnicodeNode_1 = __webpack_require__(30);
- var SelfDefendingNodesGroup = function (_NodesGroup_1$NodesGr) {
- _inherits(SelfDefendingNodesGroup, _NodesGroup_1$NodesGr);
- function SelfDefendingNodesGroup(options) {
- _classCallCheck(this, SelfDefendingNodesGroup);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SelfDefendingNodesGroup).call(this, options));
- if (!_this.options.selfDefending) {
- return _possibleConstructorReturn(_this);
- }
- _this.nodes.set('selfDefendingUnicodeNode', new SelfDefendingUnicodeNode_1.SelfDefendingUnicodeNode(_this.options));
- return _this;
- }
- return SelfDefendingNodesGroup;
- }(NodesGroup_1.NodesGroup);
- exports.SelfDefendingNodesGroup = SelfDefendingNodesGroup;
- /***/ },
- /* 38 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var NodesGroup_1 = __webpack_require__(12);
- var UnicodeArray_1 = __webpack_require__(23);
- var UnicodeArrayCallsWrapper_1 = __webpack_require__(31);
- var UnicodeArrayDecodeNode_1 = __webpack_require__(32);
- var UnicodeArrayNode_1 = __webpack_require__(33);
- var UnicodeArrayRotateFunctionNode_1 = __webpack_require__(34);
- var Utils_1 = __webpack_require__(0);
- var UnicodeArrayNodesGroup = function (_NodesGroup_1$NodesGr) {
- _inherits(UnicodeArrayNodesGroup, _NodesGroup_1$NodesGr);
- function UnicodeArrayNodesGroup(options) {
- _classCallCheck(this, UnicodeArrayNodesGroup);
- var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNodesGroup).call(this, options));
- _this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
- _this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
- if (!_this.options.unicodeArray) {
- return _possibleConstructorReturn(_this);
- }
- if (_this.options.rotateUnicodeArray) {
- _this.unicodeArrayRotateValue = Utils_1.Utils.getRandomGenerator().integer({
- min: 100,
- max: 500
- });
- } else {
- _this.unicodeArrayRotateValue = 0;
- }
- var unicodeArray = new UnicodeArray_1.UnicodeArray(),
- unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(unicodeArray, _this.unicodeArrayName, _this.unicodeArrayRotateValue, _this.options);
- _this.nodes.set('unicodeArrayNode', unicodeArrayNode);
- if (_this.options.wrapUnicodeArrayCalls) {
- _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
- }
- if (_this.options.encodeUnicodeLiterals) {
- _this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(_this.unicodeArrayName, unicodeArray, _this.options));
- }
- if (_this.options.rotateUnicodeArray) {
- _this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(_this.unicodeArrayName, unicodeArray, _this.unicodeArrayRotateValue, _this.options));
- }
- return _this;
- }
- return UnicodeArrayNodesGroup;
- }(NodesGroup_1.NodesGroup);
- exports.UnicodeArrayNodesGroup = UnicodeArrayNodesGroup;
- /***/ },
- /* 39 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var estraverse = __webpack_require__(4);
- var NodeObfuscator_1 = __webpack_require__(5);
- var CatchClauseObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(CatchClauseObfuscator, _NodeObfuscator_1$Nod);
- function CatchClauseObfuscator() {
- var _Object$getPrototypeO;
- _classCallCheck(this, CatchClauseObfuscator);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CatchClauseObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
- _this.catchClauseParam = new Map();
- return _this;
- }
- _createClass(CatchClauseObfuscator, [{
- key: 'obfuscateNode',
- value: function obfuscateNode(catchClauseNode) {
- this.storeCatchClauseParam(catchClauseNode);
- this.replaceCatchClauseParam(catchClauseNode);
- }
- }, {
- key: 'storeCatchClauseParam',
- value: function storeCatchClauseParam(catchClauseNode) {
- var _this2 = this;
- estraverse.traverse(catchClauseNode.param, {
- leave: function leave(node) {
- return _this2.storeIdentifiersNames(node, _this2.catchClauseParam);
- }
- });
- }
- }, {
- key: 'replaceCatchClauseParam',
- value: function replaceCatchClauseParam(catchClauseNode) {
- var _this3 = this;
- estraverse.replace(catchClauseNode, {
- leave: function leave(node, parentNode) {
- _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.catchClauseParam);
- }
- });
- }
- }]);
- return CatchClauseObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.CatchClauseObfuscator = CatchClauseObfuscator;
- /***/ },
- /* 40 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var estraverse = __webpack_require__(4);
- var NodeType_1 = __webpack_require__(7);
- var NodeObfuscator_1 = __webpack_require__(5);
- var NodeUtils_1 = __webpack_require__(1);
- var FunctionDeclarationObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(FunctionDeclarationObfuscator, _NodeObfuscator_1$Nod);
- function FunctionDeclarationObfuscator() {
- var _Object$getPrototypeO;
- _classCallCheck(this, FunctionDeclarationObfuscator);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(FunctionDeclarationObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
- _this.functionName = new Map();
- return _this;
- }
- _createClass(FunctionDeclarationObfuscator, [{
- key: "obfuscateNode",
- value: function obfuscateNode(functionDeclarationNode, parentNode) {
- if (parentNode.type === NodeType_1.NodeType.Program) {
- return;
- }
- this.storeFunctionName(functionDeclarationNode);
- this.replaceFunctionName(functionDeclarationNode);
- }
- }, {
- key: "storeFunctionName",
- value: function storeFunctionName(functionDeclarationNode) {
- var _this2 = this;
- estraverse.traverse(functionDeclarationNode.id, {
- leave: function leave(node) {
- return _this2.storeIdentifiersNames(node, _this2.functionName);
- }
- });
- }
- }, {
- key: "replaceFunctionName",
- value: function replaceFunctionName(functionDeclarationNode) {
- var _this3 = this;
- var scopeNode = NodeUtils_1.NodeUtils.getBlockScopeOfNode(functionDeclarationNode);
- estraverse.replace(scopeNode, {
- enter: function enter(node, parentNode) {
- _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.functionName);
- }
- });
- }
- }]);
- return FunctionDeclarationObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.FunctionDeclarationObfuscator = FunctionDeclarationObfuscator;
- /***/ },
- /* 41 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var estraverse = __webpack_require__(4);
- var NodeObfuscator_1 = __webpack_require__(5);
- var FunctionObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(FunctionObfuscator, _NodeObfuscator_1$Nod);
- function FunctionObfuscator() {
- var _Object$getPrototypeO;
- _classCallCheck(this, FunctionObfuscator);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(FunctionObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
- _this.functionParams = new Map();
- return _this;
- }
- _createClass(FunctionObfuscator, [{
- key: 'obfuscateNode',
- value: function obfuscateNode(functionNode) {
- this.storeFunctionParams(functionNode);
- this.replaceFunctionParams(functionNode);
- }
- }, {
- key: 'storeFunctionParams',
- value: function storeFunctionParams(functionNode) {
- var _this2 = this;
- functionNode.params.forEach(function (paramsNode) {
- estraverse.traverse(paramsNode, {
- leave: function leave(node) {
- return _this2.storeIdentifiersNames(node, _this2.functionParams);
- }
- });
- });
- }
- }, {
- key: 'replaceFunctionParams',
- value: function replaceFunctionParams(functionNode) {
- var _this3 = this;
- var replaceVisitor = {
- leave: function leave(node, parentNode) {
- _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.functionParams);
- }
- };
- functionNode.params.forEach(function (paramsNode) {
- estraverse.replace(paramsNode, replaceVisitor);
- });
- estraverse.replace(functionNode.body, replaceVisitor);
- }
- }]);
- return FunctionObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.FunctionObfuscator = FunctionObfuscator;
- /***/ },
- /* 42 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var escodegen = __webpack_require__(10);
- var NodeObfuscator_1 = __webpack_require__(5);
- var Nodes_1 = __webpack_require__(6);
- var LiteralObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(LiteralObfuscator, _NodeObfuscator_1$Nod);
- function LiteralObfuscator() {
- _classCallCheck(this, LiteralObfuscator);
- return _possibleConstructorReturn(this, Object.getPrototypeOf(LiteralObfuscator).apply(this, arguments));
- }
- _createClass(LiteralObfuscator, [{
- key: 'obfuscateNode',
- value: function obfuscateNode(literalNode, parentNode) {
- if (Nodes_1.Nodes.isPropertyNode(parentNode) && parentNode.key === literalNode) {
- return;
- }
- if (literalNode['x-verbatim-property']) {
- return;
- }
- var content = void 0;
- switch (_typeof(literalNode.value)) {
- case 'boolean':
- content = this.replaceLiteralBooleanWithJSFuck(literalNode.value);
- break;
- case 'number':
- content = this.replaceLiteralNumberWithHexadecimalValue(literalNode.value);
- break;
- case 'string':
- content = this.replaceLiteralValueWithUnicodeValue(literalNode.value);
- break;
- default:
- return;
- }
- literalNode['x-verbatim-property'] = {
- content: content,
- precedence: escodegen.Precedence.Primary
- };
- }
- }]);
- return LiteralObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.LiteralObfuscator = LiteralObfuscator;
- /***/ },
- /* 43 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var escodegen = __webpack_require__(10);
- var estraverse = __webpack_require__(4);
- var NodeType_1 = __webpack_require__(7);
- var NodeObfuscator_1 = __webpack_require__(5);
- var Nodes_1 = __webpack_require__(6);
- var MemberExpressionObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(MemberExpressionObfuscator, _NodeObfuscator_1$Nod);
- function MemberExpressionObfuscator() {
- _classCallCheck(this, MemberExpressionObfuscator);
- return _possibleConstructorReturn(this, Object.getPrototypeOf(MemberExpressionObfuscator).apply(this, arguments));
- }
- _createClass(MemberExpressionObfuscator, [{
- key: 'obfuscateNode',
- value: function obfuscateNode(memberExpressionNode) {
- var _this2 = this;
- estraverse.replace(memberExpressionNode.property, {
- leave: function leave(node, parentNode) {
- if (Nodes_1.Nodes.isLiteralNode(node)) {
- _this2.obfuscateLiteralProperty(node);
- return;
- }
- if (Nodes_1.Nodes.isIdentifierNode(node)) {
- if (memberExpressionNode.computed) {
- return;
- }
- memberExpressionNode.computed = true;
- _this2.obfuscateIdentifierProperty(node);
- }
- }
- });
- }
- }, {
- key: 'obfuscateIdentifierProperty',
- value: function obfuscateIdentifierProperty(node) {
- var nodeValue = node.name,
- literalNode = {
- raw: '\'' + nodeValue + '\'',
- 'x-verbatim-property': {
- content: this.replaceLiteralValueWithUnicodeValue(nodeValue),
- precedence: escodegen.Precedence.Primary
- },
- type: NodeType_1.NodeType.Literal,
- value: nodeValue
- };
- delete node.name;
- Object.assign(node, literalNode);
- }
- }, {
- key: 'obfuscateLiteralProperty',
- value: function obfuscateLiteralProperty(node) {
- if (typeof node.value === 'string' && !node['x-verbatim-property']) {
- node['x-verbatim-property'] = {
- content: this.replaceLiteralValueWithUnicodeValue(node.value),
- precedence: escodegen.Precedence.Primary
- };
- }
- }
- }]);
- return MemberExpressionObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.MemberExpressionObfuscator = MemberExpressionObfuscator;
- /***/ },
- /* 44 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var estraverse = __webpack_require__(4);
- var NodeObfuscator_1 = __webpack_require__(5);
- var Nodes_1 = __webpack_require__(6);
- var Utils_1 = __webpack_require__(0);
- var MethodDefinitionObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(MethodDefinitionObfuscator, _NodeObfuscator_1$Nod);
- function MethodDefinitionObfuscator() {
- var _Object$getPrototypeO;
- _classCallCheck(this, MethodDefinitionObfuscator);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(MethodDefinitionObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
- _this.ignoredNames = ['constructor'];
- return _this;
- }
- _createClass(MethodDefinitionObfuscator, [{
- key: 'obfuscateNode',
- value: function obfuscateNode(methodDefinitionNode, parentNode) {
- this.replaceMethodName(methodDefinitionNode);
- }
- }, {
- key: 'replaceMethodName',
- value: function replaceMethodName(methodDefinitionNode) {
- var _this2 = this;
- estraverse.replace(methodDefinitionNode.key, {
- leave: function leave(node) {
- if (Nodes_1.Nodes.isIdentifierNode(node) && !Utils_1.Utils.arrayContains(_this2.ignoredNames, node.name) && methodDefinitionNode.computed === false) {
- methodDefinitionNode.computed = true;
- node.name = _this2.replaceLiteralValueWithUnicodeValue(node.name);
- return;
- }
- return estraverse.VisitorOption.Skip;
- }
- });
- }
- }]);
- return MethodDefinitionObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.MethodDefinitionObfuscator = MethodDefinitionObfuscator;
- /***/ },
- /* 45 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var escodegen = __webpack_require__(10);
- var estraverse = __webpack_require__(4);
- var NodeType_1 = __webpack_require__(7);
- var NodeObfuscator_1 = __webpack_require__(5);
- var Nodes_1 = __webpack_require__(6);
- var Utils_1 = __webpack_require__(0);
- var ObjectExpressionObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(ObjectExpressionObfuscator, _NodeObfuscator_1$Nod);
- function ObjectExpressionObfuscator() {
- _classCallCheck(this, ObjectExpressionObfuscator);
- return _possibleConstructorReturn(this, Object.getPrototypeOf(ObjectExpressionObfuscator).apply(this, arguments));
- }
- _createClass(ObjectExpressionObfuscator, [{
- key: 'obfuscateNode',
- value: function obfuscateNode(objectExpressionNode) {
- var _this2 = this;
- objectExpressionNode.properties.forEach(function (property) {
- estraverse.replace(property.key, {
- leave: function leave(node, parentNode) {
- if (Nodes_1.Nodes.isLiteralNode(node)) {
- _this2.obfuscateLiteralPropertyKey(node);
- return;
- }
- if (Nodes_1.Nodes.isIdentifierNode(node)) {
- _this2.obfuscateIdentifierPropertyKey(node);
- }
- }
- });
- });
- }
- }, {
- key: 'obfuscateLiteralPropertyKey',
- value: function obfuscateLiteralPropertyKey(node) {
- if (typeof node.value === 'string' && !node['x-verbatim-property']) {
- node['x-verbatim-property'] = {
- content: Utils_1.Utils.stringToUnicode(node.value),
- precedence: escodegen.Precedence.Primary
- };
- }
- }
- }, {
- key: 'obfuscateIdentifierPropertyKey',
- value: function obfuscateIdentifierPropertyKey(node) {
- var nodeValue = node.name,
- literalNode = {
- raw: '\'' + nodeValue + '\'',
- 'x-verbatim-property': {
- content: Utils_1.Utils.stringToUnicode(nodeValue),
- precedence: escodegen.Precedence.Primary
- },
- type: NodeType_1.NodeType.Literal,
- value: nodeValue
- };
- delete node.name;
- Object.assign(node, literalNode);
- }
- }]);
- return ObjectExpressionObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.ObjectExpressionObfuscator = ObjectExpressionObfuscator;
- /***/ },
- /* 46 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- var estraverse = __webpack_require__(4);
- var NodeType_1 = __webpack_require__(7);
- var NodeObfuscator_1 = __webpack_require__(5);
- var NodeUtils_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var VariableDeclarationObfuscator = function (_NodeObfuscator_1$Nod) {
- _inherits(VariableDeclarationObfuscator, _NodeObfuscator_1$Nod);
- function VariableDeclarationObfuscator() {
- var _Object$getPrototypeO;
- _classCallCheck(this, VariableDeclarationObfuscator);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(VariableDeclarationObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
- _this.variableNames = new Map();
- return _this;
- }
- _createClass(VariableDeclarationObfuscator, [{
- key: "obfuscateNode",
- value: function obfuscateNode(variableDeclarationNode, parentNode) {
- if (parentNode.type === NodeType_1.NodeType.Program) {
- return;
- }
- this.storeVariableNames(variableDeclarationNode);
- this.replaceVariableNames(variableDeclarationNode, parentNode);
- }
- }, {
- key: "storeVariableNames",
- value: function storeVariableNames(variableDeclarationNode) {
- var _this2 = this;
- variableDeclarationNode.declarations.forEach(function (declarationNode) {
- estraverse.traverse(declarationNode.id, {
- enter: function enter(node) {
- return _this2.storeIdentifiersNames(node, _this2.variableNames);
- }
- });
- });
- }
- }, {
- key: "replaceVariableNames",
- value: function replaceVariableNames(variableDeclarationNode, variableParentNode) {
- var _this3 = this;
- var scopeNode = variableDeclarationNode.kind === 'var' ? NodeUtils_1.NodeUtils.getBlockScopeOfNode(variableDeclarationNode) : variableParentNode,
- isNodeAfterVariableDeclaratorFlag = false;
- estraverse.replace(scopeNode, {
- enter: function enter(node, parentNode) {
- var functionNodes = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression];
- if (Utils_1.Utils.arrayContains(functionNodes, node.type)) {
- estraverse.replace(node, {
- enter: function enter(node, parentNode) {
- _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.variableNames);
- }
- });
- }
- if (node === variableDeclarationNode) {
- isNodeAfterVariableDeclaratorFlag = true;
- }
- if (isNodeAfterVariableDeclaratorFlag) {
- _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.variableNames);
- }
- }
- });
- }
- }]);
- return VariableDeclarationObfuscator;
- }(NodeObfuscator_1.NodeObfuscator);
- exports.VariableDeclarationObfuscator = VariableDeclarationObfuscator;
- /***/ },
- /* 47 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
- var c = arguments.length,
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
- d;
- if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
- if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- }return c > 3 && r && Object.defineProperty(target, key, r), r;
- };
- var __metadata = undefined && undefined.__metadata || function (k, v) {
- if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
- };
- var class_validator_1 = __webpack_require__(63);
- var DefaultPreset_1 = __webpack_require__(17);
- var OptionsNormalizer_1 = __webpack_require__(48);
- var ValidationErrorsFormatter_1 = __webpack_require__(49);
- var Options = function Options(obfuscatorOptions) {
- _classCallCheck(this, Options);
- Object.assign(this, DefaultPreset_1.DEFAULT_PRESET, obfuscatorOptions);
- var errors = class_validator_1.validateSync(this, Options.validatorOptions);
- if (errors.length) {
- throw new ReferenceError("Validation failed. errors:\n" + ValidationErrorsFormatter_1.ValidationErrorsFormatter.format(errors));
- }
- Object.assign(this, OptionsNormalizer_1.OptionsNormalizer.normalizeOptions(this));
- };
- Options.validatorOptions = {
- validationError: {
- target: false
- }
- };
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "compact", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "debugProtection", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "debugProtectionInterval", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "disableConsoleOutput", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "encodeUnicodeLiterals", void 0);
- __decorate([class_validator_1.IsString({
- each: true
- }), __metadata('design:type', Array)], Options.prototype, "reservedNames", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "rotateUnicodeArray", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "selfDefending", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "sourceMap", void 0);
- __decorate([class_validator_1.IsIn(['inline', 'separate']), __metadata('design:type', String)], Options.prototype, "sourceMapMode", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "unicodeArray", void 0);
- __decorate([class_validator_1.IsNumber(), class_validator_1.Min(0), class_validator_1.Max(1), __metadata('design:type', Number)], Options.prototype, "unicodeArrayThreshold", void 0);
- __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "wrapUnicodeArrayCalls", void 0);
- exports.Options = Options;
- /***/ },
- /* 48 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var OptionsNormalizer = function () {
- function OptionsNormalizer() {
- _classCallCheck(this, OptionsNormalizer);
- }
- _createClass(OptionsNormalizer, null, [{
- key: "normalizeOptions",
- value: function normalizeOptions(options) {
- var normalizedOptions = Object.assign({}, options);
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = OptionsNormalizer.normalizerRules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var normalizerRule = _step.value;
- normalizedOptions = normalizerRule(normalizedOptions);
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- return normalizedOptions;
- }
- }, {
- key: "encodeUnicodeLiteralsRule",
- value: function encodeUnicodeLiteralsRule(options) {
- if (options.unicodeArray && options.encodeUnicodeLiterals) {
- Object.assign(options, OptionsNormalizer.ENCODE_UNICODE_LITERALS_OPTIONS);
- }
- return options;
- }
- }, {
- key: "selfDefendingRule",
- value: function selfDefendingRule(options) {
- if (options.selfDefending) {
- Object.assign(options, OptionsNormalizer.SELF_DEFENDING_OPTIONS);
- }
- return options;
- }
- }, {
- key: "unicodeArrayRule",
- value: function unicodeArrayRule(options) {
- if (!options.unicodeArray) {
- Object.assign(options, OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS);
- }
- return options;
- }
- }, {
- key: "unicodeArrayThresholdRule",
- value: function unicodeArrayThresholdRule(options) {
- if (options.unicodeArrayThreshold === 0) {
- Object.assign(options, OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS);
- }
- return options;
- }
- }]);
- return OptionsNormalizer;
- }();
- OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS = {
- encodeUnicodeLiterals: false,
- rotateUnicodeArray: false,
- unicodeArray: false,
- unicodeArrayThreshold: 0,
- wrapUnicodeArrayCalls: false
- };
- OptionsNormalizer.ENCODE_UNICODE_LITERALS_OPTIONS = {
- encodeUnicodeLiterals: true,
- wrapUnicodeArrayCalls: true
- };
- OptionsNormalizer.SELF_DEFENDING_OPTIONS = {
- compact: true,
- selfDefending: true
- };
- OptionsNormalizer.normalizerRules = [OptionsNormalizer.unicodeArrayRule, OptionsNormalizer.unicodeArrayThresholdRule, OptionsNormalizer.encodeUnicodeLiteralsRule, OptionsNormalizer.selfDefendingRule];
- exports.OptionsNormalizer = OptionsNormalizer;
- /***/ },
- /* 49 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var ValidationErrorsFormatter = function () {
- function ValidationErrorsFormatter() {
- _classCallCheck(this, ValidationErrorsFormatter);
- }
- _createClass(ValidationErrorsFormatter, null, [{
- key: "format",
- value: function format(validationErrors) {
- var errorsArray = [];
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = validationErrors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var error = _step.value;
- errorsArray.push(ValidationErrorsFormatter.formatError(error));
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- return errorsArray.join('\n');
- }
- }, {
- key: "formatError",
- value: function formatError(validationError) {
- var errorString = "`" + validationError.property + "` errors:\n",
- constraints = validationError.constraints;
- for (var constraint in constraints) {
- if (!constraints.hasOwnProperty(constraint)) {
- continue;
- }
- errorString += " - " + constraints[constraint] + "\n";
- }
- return errorString;
- }
- }]);
- return ValidationErrorsFormatter;
- }();
- exports.ValidationErrorsFormatter = ValidationErrorsFormatter;
- /***/ },
- /* 50 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function AtobTemplate() {
- return "\n (function () {\n var object = []['filter']['constructor']('return this')();\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n object.atob || (\n object.atob = function(input) {\n var str = String(input).replace(/=+$/, '');\n for (\n var bc = 0, bs, buffer, idx = 0, output = '';\n buffer = str.charAt(idx++);\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n ";
- }
- exports.AtobTemplate = AtobTemplate;
- /***/ },
- /* 51 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function ConsoleOutputDisableExpressionTemplate() {
- return "\n (function () {\n var _ = '(\u0004\u0006\u0003\u0005[]' + '[\"filter\"][\"\u0007tructor\"]' + '(\"return this\")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons', \n Y, \n $;\n \n for (Y in $ = \"\u0007\u0006\u0005\u0004\u0003\u0002\u0001\") {\n var arr = _.split($[Y]);\n _ = arr.join(arr.pop());\n }\n \n [][\"filter\"][\"constructor\"](_)();\n })()\n ";
- }
- exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
- /***/ },
- /* 52 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function DebugProtectionFunctionCallTemplate() {
- return "{debugProtectionFunctionName}();";
- }
- exports.DebugProtectionFunctionCallTemplate = DebugProtectionFunctionCallTemplate;
- /***/ },
- /* 53 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function DebugProtectionFunctionIntervalTemplate() {
- return "\n setInterval(function () {\n {debugProtectionFunctionName}();\n }, 4000);\n ";
- }
- exports.DebugProtectionFunctionIntervalTemplate = DebugProtectionFunctionIntervalTemplate;
- /***/ },
- /* 54 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var Utils_1 = __webpack_require__(0);
- function DebugProtectionFunctionTemplate() {
- return "\n var {debugProtectionFunctionName} = function () {\n function debuggerProtection (counter) {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n (function () {}.constructor('debugger')());\n } else {\n [].filter.constructor(" + Utils_1.Utils.stringToJSFuck('debugger') + ")();\n }\n \n debuggerProtection(++counter);\n }\n \n try {\n debuggerProtection(0);\n } catch (y) {}\n };\n ";
- }
- exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate;
- /***/ },
- /* 55 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var Utils_1 = __webpack_require__(0);
- function SelfDefendingTemplate() {
- return "\n (function () { \n var func = function(){return 'dev';},\n func2 = function () {\n return 'window';\n };\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? Function(" + Utils_1.Utils.stringToUnicode("return/(\\\\[x|u](\\w){2,4})+/") + ")().test(func2.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(false){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(true){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(false){}')();\n })();\n ";
- }
- exports.SelfDefendingTemplate = SelfDefendingTemplate;
- /***/ },
- /* 56 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function UnicodeArrayCallsWrapperTemplate() {
- return "\n var {unicodeArrayCallsWrapperName} = function ({keyName}) {\n return {unicodeArrayName}[parseInt({keyName}, 0x010)];\n };\n ";
- }
- exports.UnicodeArrayCallsWrapperTemplate = UnicodeArrayCallsWrapperTemplate;
- /***/ },
- /* 57 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var Utils_1 = __webpack_require__(0);
- function SelfDefendingTemplate() {
- return "\n var func = function(){return 'dev';};\n \n Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")()['test'](func['toString']()) !== true && !{unicodeArrayName}++ ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(true){}')() : Function('a', atob(" + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + "))({forLoopFunctionName}) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(false){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(false){}')();\n ";
- }
- exports.SelfDefendingTemplate = SelfDefendingTemplate;
- /***/ },
- /* 58 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function UnicodeArrayDecodeTemplate() {
- return "\n (function () {\n {atobPolyfill}\n \n var {forLoopFunctionName} = function () {\n var array = [];\n \n for (var i in {unicodeArrayName}) {\n array['push'](decodeURI(atob({unicodeArrayName}[i])));\n }\n \n {unicodeArrayName} = array;\n };\n \n {code}\n })();\n ";
- }
- exports.UnicodeArrayDecodeTemplate = UnicodeArrayDecodeTemplate;
- /***/ },
- /* 59 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function UnicodeArrayTemplate() {
- return "\n var {unicodeArrayName} = [{unicodeArray}];\n ";
- }
- exports.UnicodeArrayTemplate = UnicodeArrayTemplate;
- /***/ },
- /* 60 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var Utils_1 = __webpack_require__(0);
- function SelfDefendingTemplate() {
- return "(function () {\n var func = function(){return 'dev';};\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(true){}')() : Function('a', 'b', 'a(++b)')({whileFunctionName}, {timesName}) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(false){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(false){}')();\n })();";
- }
- exports.SelfDefendingTemplate = SelfDefendingTemplate;
- /***/ },
- /* 61 */
- /***/ function(module, exports) {
- "use strict";
- "use strict";
- function UnicodeArrayRotateFunctionTemplate() {
- return "\n (function (array, {timesName}) {\n var {whileFunctionName} = function (times) {\n while (--times) {\n array['push'](array['shift']());\n }\n };\n \n {code}\n })({unicodeArrayName}, 0x{unicodeArrayRotateValue});\n ";
- }
- exports.UnicodeArrayRotateFunctionTemplate = UnicodeArrayRotateFunctionTemplate;
- /***/ },
- /* 62 */
- /***/ function(module, exports) {
- module.exports = require("chance");
- /***/ },
- /* 63 */
- /***/ function(module, exports) {
- module.exports = require("class-validator");
- /***/ },
- /* 64 */
- /***/ function(module, exports) {
- module.exports = require("commander");
- /***/ },
- /* 65 */
- /***/ function(module, exports) {
- module.exports = require("fs");
- /***/ },
- /* 66 */
- /***/ function(module, exports) {
- module.exports = require("mkdirp");
- /***/ },
- /* 67 */
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- "use strict";
- var JavaScriptObfuscator_1 = __webpack_require__(9);
- if (!global._babelPolyfill) {
- __webpack_require__(20);
- }
- module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator;
- /***/ }
- /******/ ]);
- //# sourceMappingURL=index.js.map
|