index.js 128 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658
  1. /*
  2. Copyright (C) 2016 Timofey Kachalov <[email protected]>
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. * Redistributions of source code must retain the above copyright
  6. notice, this list of conditions and the following disclaimer.
  7. * Redistributions in binary form must reproduce the above copyright
  8. notice, this list of conditions and the following disclaimer in the
  9. documentation and/or other materials provided with the distribution.
  10. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  11. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  13. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  14. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  15. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  16. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  17. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  18. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  19. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20. */
  21. require("source-map-support").install();
  22. module.exports =
  23. /******/ (function(modules) { // webpackBootstrap
  24. /******/ // The module cache
  25. /******/ var installedModules = {};
  26. /******/
  27. /******/ // The require function
  28. /******/ function __webpack_require__(moduleId) {
  29. /******/
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId])
  32. /******/ return installedModules[moduleId].exports;
  33. /******/
  34. /******/ // Create a new module (and put it into the cache)
  35. /******/ var module = installedModules[moduleId] = {
  36. /******/ i: moduleId,
  37. /******/ l: false,
  38. /******/ exports: {}
  39. /******/ };
  40. /******/
  41. /******/ // Execute the module function
  42. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  43. /******/
  44. /******/ // Flag the module as loaded
  45. /******/ module.l = true;
  46. /******/
  47. /******/ // Return the exports of the module
  48. /******/ return module.exports;
  49. /******/ }
  50. /******/
  51. /******/
  52. /******/ // expose the modules object (__webpack_modules__)
  53. /******/ __webpack_require__.m = modules;
  54. /******/
  55. /******/ // expose the module cache
  56. /******/ __webpack_require__.c = installedModules;
  57. /******/
  58. /******/ // identity function for calling harmory imports with the correct context
  59. /******/ __webpack_require__.i = function(value) { return value; };
  60. /******/
  61. /******/ // define getter function for harmory exports
  62. /******/ __webpack_require__.d = function(exports, name, getter) {
  63. /******/ Object.defineProperty(exports, name, {
  64. /******/ configurable: false,
  65. /******/ enumerable: true,
  66. /******/ get: getter
  67. /******/ });
  68. /******/ };
  69. /******/
  70. /******/ // Object.prototype.hasOwnProperty.call
  71. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  72. /******/
  73. /******/ // __webpack_public_path__
  74. /******/ __webpack_require__.p = "";
  75. /******/
  76. /******/ // Load entry module and return exports
  77. /******/ return __webpack_require__(__webpack_require__.s = 15);
  78. /******/ })
  79. /************************************************************************/
  80. /******/ ([
  81. /* 0 */
  82. /***/ function(module, exports, __webpack_require__) {
  83. "use strict";
  84. "use strict";
  85. 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; }; }();
  86. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  87. var chance_1 = __webpack_require__(40);
  88. var JSFuck_1 = __webpack_require__(10);
  89. var Utils = function () {
  90. function Utils() {
  91. _classCallCheck(this, Utils);
  92. }
  93. _createClass(Utils, null, [{
  94. key: 'arrayContains',
  95. value: function arrayContains(array, searchElement) {
  96. return array.indexOf(searchElement) >= 0;
  97. }
  98. }, {
  99. key: 'arrayRotate',
  100. value: function arrayRotate(array, times) {
  101. var reverse = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];
  102. if (times <= 0) {
  103. return array;
  104. }
  105. var newArray = array,
  106. temp = void 0;
  107. while (times--) {
  108. if (!reverse) {
  109. temp = newArray.pop();
  110. newArray.unshift(temp);
  111. } else {
  112. temp = newArray.shift();
  113. newArray.push(temp);
  114. }
  115. }
  116. return newArray;
  117. }
  118. }, {
  119. key: 'btoa',
  120. value: function btoa(string) {
  121. return new Buffer(encodeURI(string)).toString('base64');
  122. }
  123. }, {
  124. key: 'decToHex',
  125. value: function decToHex(dec) {
  126. var decToHexSliceValue = -6,
  127. exponent = 6,
  128. radix = 16;
  129. return (dec + Math.pow(radix, exponent)).toString(radix).substr(decToHexSliceValue).replace(Utils.hexRepetitiveZerosRegExp, '');
  130. }
  131. }, {
  132. key: 'getRandomGenerator',
  133. value: function getRandomGenerator() {
  134. return Utils.randomGenerator;
  135. }
  136. }, {
  137. key: 'getRandomVariableName',
  138. value: function getRandomVariableName() {
  139. var length = arguments.length <= 0 || arguments[0] === undefined ? 6 : arguments[0];
  140. var rangeMinInteger = 10000,
  141. rangeMaxInteger = 99999999,
  142. prefix = '_0x';
  143. return '' + prefix + Utils.decToHex(Utils.getRandomGenerator().integer({
  144. min: rangeMinInteger,
  145. max: rangeMaxInteger
  146. })).substr(0, length);
  147. }
  148. }, {
  149. key: 'isInteger',
  150. value: function isInteger(number) {
  151. return number % 1 === 0;
  152. }
  153. }, {
  154. key: 'strEnumify',
  155. value: function strEnumify(obj) {
  156. return obj;
  157. }
  158. }, {
  159. key: 'stringToJSFuck',
  160. value: function stringToJSFuck(string) {
  161. return Array.from(string).map(function (character) {
  162. return JSFuck_1.JSFuck[character] || character;
  163. }).join(' + ');
  164. }
  165. }, {
  166. key: 'stringToUnicode',
  167. value: function stringToUnicode(string) {
  168. var radix = 16;
  169. var prefix = void 0,
  170. regexp = new RegExp('[\x00-\x7F]'),
  171. template = void 0;
  172. return '\'' + string.replace(/[\s\S]/g, function (escape) {
  173. if (regexp.test(escape)) {
  174. prefix = '\\x';
  175. template = '0'.repeat(2);
  176. } else {
  177. prefix = '\\u';
  178. template = '0'.repeat(4);
  179. }
  180. return '' + prefix + (template + escape.charCodeAt(0).toString(radix)).slice(-template.length);
  181. }) + '\'';
  182. }
  183. }]);
  184. return Utils;
  185. }();
  186. Utils.hexRepetitiveZerosRegExp = new RegExp('^(0{2,})+(?!$)', '');
  187. Utils.randomGenerator = new chance_1.Chance();
  188. exports.Utils = Utils;
  189. /***/ },
  190. /* 1 */
  191. /***/ function(module, exports, __webpack_require__) {
  192. "use strict";
  193. "use strict";
  194. 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; }; }();
  195. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  196. var estraverse = __webpack_require__(3);
  197. var NodeType_1 = __webpack_require__(2);
  198. var Nodes_1 = __webpack_require__(8);
  199. var Utils_1 = __webpack_require__(0);
  200. var NodeUtils = function () {
  201. function NodeUtils() {
  202. _classCallCheck(this, NodeUtils);
  203. }
  204. _createClass(NodeUtils, null, [{
  205. key: "addXVerbatimPropertyToLiterals",
  206. value: function addXVerbatimPropertyToLiterals(node) {
  207. estraverse.replace(node, {
  208. enter: function enter(node, parentNode) {
  209. if (Nodes_1.Nodes.isLiteralNode(node)) {
  210. node['x-verbatim-property'] = node.raw;
  211. }
  212. }
  213. });
  214. }
  215. }, {
  216. key: "appendNode",
  217. value: function appendNode(blockScopeBody, node) {
  218. if (!NodeUtils.validateNode(node)) {
  219. return;
  220. }
  221. blockScopeBody.push(node);
  222. }
  223. }, {
  224. key: "getBlockStatementNodeByIndex",
  225. value: function getBlockStatementNodeByIndex(node) {
  226. var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
  227. if (Nodes_1.Nodes.isNodeHasBlockStatement(node)) {
  228. if (node.body[index] === undefined) {
  229. throw new ReferenceError("Wrong index `" + index + "`. Block-statement body length is `" + node.body.length + "`");
  230. }
  231. return node.body[index];
  232. }
  233. throw new TypeError('The specified node have no a block-statement');
  234. }
  235. }, {
  236. key: "getBlockScopeOfNode",
  237. value: function getBlockScopeOfNode(node) {
  238. var depth = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
  239. var parentNode = node.parentNode;
  240. if (!parentNode) {
  241. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  242. }
  243. if (Nodes_1.Nodes.isBlockStatementNode(parentNode)) {
  244. if (!Utils_1.Utils.arrayContains(NodeUtils.nodesWithBlockScope, parentNode['parentNode'].type)) {
  245. return NodeUtils.getBlockScopeOfNode(parentNode, depth);
  246. } else if (depth > 0) {
  247. return NodeUtils.getBlockScopeOfNode(parentNode, --depth);
  248. }
  249. return parentNode;
  250. }
  251. if (Nodes_1.Nodes.isProgramNode(parentNode)) {
  252. return parentNode;
  253. }
  254. return NodeUtils.getBlockScopeOfNode(parentNode);
  255. }
  256. }, {
  257. key: "insertNodeAtIndex",
  258. value: function insertNodeAtIndex(blockScopeBody, node, index) {
  259. if (!NodeUtils.validateNode(node)) {
  260. return;
  261. }
  262. blockScopeBody.splice(index, 0, node);
  263. }
  264. }, {
  265. key: "parentize",
  266. value: function parentize(node) {
  267. var isRootNode = true;
  268. estraverse.replace(node, {
  269. enter: function enter(node, parentNode) {
  270. Object.defineProperty(node, 'parentNode', {
  271. configurable: true,
  272. enumerable: true,
  273. value: isRootNode ? Nodes_1.Nodes.getProgramNode([node]) : parentNode || node,
  274. writable: true
  275. });
  276. isRootNode = false;
  277. }
  278. });
  279. }
  280. }, {
  281. key: "prependNode",
  282. value: function prependNode(blockScopeBody, node) {
  283. if (!NodeUtils.validateNode(node)) {
  284. return;
  285. }
  286. blockScopeBody.unshift(node);
  287. }
  288. }, {
  289. key: "validateNode",
  290. value: function validateNode(node) {
  291. return !!node && node.hasOwnProperty('type');
  292. }
  293. }]);
  294. return NodeUtils;
  295. }();
  296. NodeUtils.nodesWithBlockScope = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression, NodeType_1.NodeType.MethodDefinition, NodeType_1.NodeType.Program];
  297. exports.NodeUtils = NodeUtils;
  298. /***/ },
  299. /* 2 */
  300. /***/ function(module, exports, __webpack_require__) {
  301. "use strict";
  302. "use strict";
  303. var Utils_1 = __webpack_require__(0);
  304. exports.NodeType = Utils_1.Utils.strEnumify({
  305. ArrayExpression: 'ArrayExpression',
  306. ArrowFunctionExpression: 'ArrowFunctionExpression',
  307. AssignmentExpression: 'AssignmentExpression',
  308. BinaryExpression: 'BinaryExpression',
  309. BlockStatement: 'BlockStatement',
  310. CallExpression: 'CallExpression',
  311. CatchClause: 'CatchClause',
  312. ClassDeclaration: 'ClassDeclaration',
  313. ExpressionStatement: 'ExpressionStatement',
  314. FunctionDeclaration: 'FunctionDeclaration',
  315. FunctionExpression: 'FunctionExpression',
  316. Identifier: 'Identifier',
  317. IfStatement: 'IfStatement',
  318. Literal: 'Literal',
  319. LogicalExpression: 'LogicalExpression',
  320. MemberExpression: 'MemberExpression',
  321. MethodDefinition: 'MethodDefinition',
  322. ObjectExpression: 'ObjectExpression',
  323. Program: 'Program',
  324. Property: 'Property',
  325. ReturnStatement: 'ReturnStatement',
  326. TryStatement: 'TryStatement',
  327. UnaryExpression: 'UnaryExpression',
  328. UpdateExpression: 'UpdateExpression',
  329. VariableDeclaration: 'VariableDeclaration',
  330. VariableDeclarator: 'VariableDeclarator',
  331. WhileStatement: 'WhileStatement'
  332. });
  333. /***/ },
  334. /* 3 */
  335. /***/ function(module, exports) {
  336. module.exports = require("estraverse");
  337. /***/ },
  338. /* 4 */
  339. /***/ function(module, exports, __webpack_require__) {
  340. "use strict";
  341. "use strict";
  342. 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; }; }();
  343. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  344. var AppendState_1 = __webpack_require__(6);
  345. var NodeUtils_1 = __webpack_require__(1);
  346. var Node = function () {
  347. function Node(options) {
  348. _classCallCheck(this, Node);
  349. this.appendState = AppendState_1.AppendState.BeforeObfuscation;
  350. this.options = options;
  351. }
  352. _createClass(Node, [{
  353. key: "getAppendState",
  354. value: function getAppendState() {
  355. return this.appendState;
  356. }
  357. }, {
  358. key: "getNode",
  359. value: function getNode() {
  360. NodeUtils_1.NodeUtils.parentize(this.node);
  361. return this.node;
  362. }
  363. }, {
  364. key: "setNode",
  365. value: function setNode(node) {
  366. this.node = node;
  367. }
  368. }, {
  369. key: "updateNode",
  370. value: function updateNode() {
  371. this.node = this.getNodeStructure();
  372. }
  373. }]);
  374. return Node;
  375. }();
  376. exports.Node = Node;
  377. /***/ },
  378. /* 5 */
  379. /***/ function(module, exports, __webpack_require__) {
  380. "use strict";
  381. "use strict";
  382. 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; }; }();
  383. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  384. var estraverse = __webpack_require__(3);
  385. var JSFuck_1 = __webpack_require__(10);
  386. var Nodes_1 = __webpack_require__(8);
  387. var Utils_1 = __webpack_require__(0);
  388. var NodeObfuscator = function () {
  389. function NodeObfuscator(nodes, options) {
  390. _classCallCheck(this, NodeObfuscator);
  391. this.nodes = nodes;
  392. this.options = options;
  393. }
  394. _createClass(NodeObfuscator, [{
  395. key: "isReservedName",
  396. value: function isReservedName(name) {
  397. return this.options.get('reservedNames').some(function (reservedName) {
  398. return new RegExp(reservedName, 'g').test(name);
  399. });
  400. }
  401. }, {
  402. key: "storeIdentifiersNames",
  403. value: function storeIdentifiersNames(node, namesMap) {
  404. if (Nodes_1.Nodes.isIdentifierNode(node) && !this.isReservedName(node.name)) {
  405. namesMap.set(node.name, Utils_1.Utils.getRandomVariableName());
  406. return;
  407. }
  408. return estraverse.VisitorOption.Skip;
  409. }
  410. }, {
  411. key: "replaceIdentifiersWithRandomNames",
  412. value: function replaceIdentifiersWithRandomNames(node, parentNode, namesMap) {
  413. if (Nodes_1.Nodes.isIdentifierNode(node) && namesMap.has(node.name)) {
  414. var parentNodeIsPropertyNode = Nodes_1.Nodes.isPropertyNode(parentNode) && parentNode.key === node,
  415. parentNodeIsMemberExpressionNode = Nodes_1.Nodes.isMemberExpressionNode(parentNode) && parentNode.computed === false && parentNode.property === node;
  416. if (parentNodeIsPropertyNode || parentNodeIsMemberExpressionNode) {
  417. return;
  418. }
  419. node.name = namesMap.get(node.name);
  420. }
  421. }
  422. }, {
  423. key: "replaceLiteralBooleanWithJSFuck",
  424. value: function replaceLiteralBooleanWithJSFuck(nodeValue) {
  425. return nodeValue ? JSFuck_1.JSFuck.True : JSFuck_1.JSFuck.False;
  426. }
  427. }, {
  428. key: "replaceLiteralNumberWithHexadecimalValue",
  429. value: function replaceLiteralNumberWithHexadecimalValue(nodeValue) {
  430. var prefix = '0x';
  431. if (!Utils_1.Utils.isInteger(nodeValue)) {
  432. return String(nodeValue);
  433. }
  434. return "" + prefix + Utils_1.Utils.decToHex(nodeValue);
  435. }
  436. }, {
  437. key: "replaceLiteralValueWithUnicodeValue",
  438. value: function replaceLiteralValueWithUnicodeValue(nodeValue) {
  439. var value = nodeValue,
  440. replaceWithUnicodeArrayFlag = Math.random() <= this.options.get('unicodeArrayThreshold');
  441. if (this.options.get('encodeUnicodeLiterals') && replaceWithUnicodeArrayFlag) {
  442. value = Utils_1.Utils.btoa(value);
  443. }
  444. value = Utils_1.Utils.stringToUnicode(value);
  445. if (!this.options.get('unicodeArray') || !replaceWithUnicodeArrayFlag) {
  446. return value;
  447. }
  448. return this.replaceLiteralValueWithUnicodeArrayCall(value);
  449. }
  450. }, {
  451. key: "replaceLiteralValueWithUnicodeArrayCall",
  452. value: function replaceLiteralValueWithUnicodeArrayCall(value) {
  453. var unicodeArrayNode = this.nodes.get('unicodeArrayNode'),
  454. unicodeArray = unicodeArrayNode.getNodeData(),
  455. sameIndex = unicodeArray.indexOf(value),
  456. index = void 0,
  457. hexadecimalIndex = void 0;
  458. if (sameIndex >= 0) {
  459. index = sameIndex;
  460. } else {
  461. index = unicodeArray.length;
  462. unicodeArrayNode.updateNodeData(value);
  463. }
  464. hexadecimalIndex = this.replaceLiteralNumberWithHexadecimalValue(index);
  465. if (this.options.get('wrapUnicodeArrayCalls')) {
  466. return this.nodes.get('unicodeArrayCallsWrapper').getNodeIdentifier() + "('" + hexadecimalIndex + "')";
  467. }
  468. return unicodeArrayNode.getNodeIdentifier() + "[" + hexadecimalIndex + "]";
  469. }
  470. }]);
  471. return NodeObfuscator;
  472. }();
  473. exports.NodeObfuscator = NodeObfuscator;
  474. /***/ },
  475. /* 6 */
  476. /***/ function(module, exports) {
  477. "use strict";
  478. "use strict";
  479. (function (AppendState) {
  480. AppendState[AppendState["AfterObfuscation"] = 0] = "AfterObfuscation";
  481. AppendState[AppendState["BeforeObfuscation"] = 1] = "BeforeObfuscation";
  482. })(exports.AppendState || (exports.AppendState = {}));
  483. var AppendState = exports.AppendState;
  484. /***/ },
  485. /* 7 */
  486. /***/ function(module, exports) {
  487. module.exports = require("esprima");
  488. /***/ },
  489. /* 8 */
  490. /***/ function(module, exports, __webpack_require__) {
  491. "use strict";
  492. "use strict";
  493. 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; }; }();
  494. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  495. var NodeType_1 = __webpack_require__(2);
  496. var Nodes = function () {
  497. function Nodes() {
  498. _classCallCheck(this, Nodes);
  499. }
  500. _createClass(Nodes, null, [{
  501. key: "getProgramNode",
  502. value: function getProgramNode(bodyNode) {
  503. return {
  504. 'type': NodeType_1.NodeType.Program,
  505. 'body': bodyNode
  506. };
  507. }
  508. }, {
  509. key: "isBlockStatementNode",
  510. value: function isBlockStatementNode(node) {
  511. return node.type === NodeType_1.NodeType.BlockStatement;
  512. }
  513. }, {
  514. key: "isIdentifierNode",
  515. value: function isIdentifierNode(node) {
  516. return node.type === NodeType_1.NodeType.Identifier;
  517. }
  518. }, {
  519. key: "isLiteralNode",
  520. value: function isLiteralNode(node) {
  521. return node.type === NodeType_1.NodeType.Literal;
  522. }
  523. }, {
  524. key: "isMemberExpressionNode",
  525. value: function isMemberExpressionNode(node) {
  526. return node.type === NodeType_1.NodeType.MemberExpression;
  527. }
  528. }, {
  529. key: "isProgramNode",
  530. value: function isProgramNode(node) {
  531. return node.type === NodeType_1.NodeType.Program;
  532. }
  533. }, {
  534. key: "isPropertyNode",
  535. value: function isPropertyNode(node) {
  536. return node.type === NodeType_1.NodeType.Property;
  537. }
  538. }, {
  539. key: "isVariableDeclaratorNode",
  540. value: function isVariableDeclaratorNode(node) {
  541. return node.type === NodeType_1.NodeType.VariableDeclarator;
  542. }
  543. }, {
  544. key: "isNodeHasBlockStatement",
  545. value: function isNodeHasBlockStatement(node) {
  546. return node.hasOwnProperty('body') && Array.isArray(node.body);
  547. }
  548. }]);
  549. return Nodes;
  550. }();
  551. exports.Nodes = Nodes;
  552. /***/ },
  553. /* 9 */
  554. /***/ function(module, exports, __webpack_require__) {
  555. "use strict";
  556. "use strict";
  557. 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; }; }();
  558. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  559. var esprima = __webpack_require__(7);
  560. var escodegen = __webpack_require__(11);
  561. var JavaScriptObfuscatorCLI_1 = __webpack_require__(19);
  562. var Obfuscator_1 = __webpack_require__(16);
  563. var Options_1 = __webpack_require__(17);
  564. var JavaScriptObfuscator = function () {
  565. function JavaScriptObfuscator() {
  566. _classCallCheck(this, JavaScriptObfuscator);
  567. }
  568. _createClass(JavaScriptObfuscator, null, [{
  569. key: 'obfuscate',
  570. value: function obfuscate(sourceCode, customOptions) {
  571. var astTree = esprima.parse(sourceCode),
  572. options = new Options_1.Options(customOptions),
  573. obfuscator = new Obfuscator_1.Obfuscator(options);
  574. astTree = obfuscator.obfuscateNode(astTree);
  575. return JavaScriptObfuscator.generateCode(astTree, options);
  576. }
  577. }, {
  578. key: 'runCLI',
  579. value: function runCLI(argv) {
  580. new JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI(argv).run();
  581. }
  582. }, {
  583. key: 'generateCode',
  584. value: function generateCode(astTree, options) {
  585. var escodegenParams = Object.assign({}, JavaScriptObfuscator.escodegenParams);
  586. escodegenParams.format = {
  587. compact: options.get('compact')
  588. };
  589. return escodegen.generate(astTree, escodegenParams);
  590. }
  591. }]);
  592. return JavaScriptObfuscator;
  593. }();
  594. JavaScriptObfuscator.escodegenParams = {
  595. verbatim: 'x-verbatim-property'
  596. };
  597. exports.JavaScriptObfuscator = JavaScriptObfuscator;
  598. /***/ },
  599. /* 10 */
  600. /***/ function(module, exports) {
  601. "use strict";
  602. "use strict";
  603. exports.JSFuck = {
  604. Window: '[]["filter"]["constructor"]("return this")()',
  605. False: '![]',
  606. True: '!![]',
  607. a: '(false+"")[1]',
  608. b: '([]["entries"]()+"")[2]',
  609. c: '([]["fill"]+"")[3]',
  610. d: '(undefined+"")[2]',
  611. e: '(true+"")[3]',
  612. f: '(false+"")[0]',
  613. g: '(false+[0]+String)[20]',
  614. h: '(+(101))["to"+String["name"]](21)[1]',
  615. i: '([false]+undefined)[10]',
  616. j: '([]["entries"]()+"")[3]',
  617. k: '(+(20))["to"+String["name"]](21)',
  618. l: '(false+"")[2]',
  619. m: '(Number+"")[11]',
  620. n: '(undefined+"")[1]',
  621. o: '(true+[]["fill"])[10]',
  622. p: '(+(211))["to"+String["name"]](31)[1]',
  623. q: '(+(212))["to"+String["name"]](31)[1]',
  624. r: '(true+"")[1]',
  625. s: '(false+"")[3]',
  626. t: '(true+"")[0]',
  627. u: '(undefined+"")[0]',
  628. v: '(+(31))["to"+String["name"]](32)',
  629. w: '(+(32))["to"+String["name"]](33)',
  630. x: '(+(101))["to"+String["name"]](34)[1]',
  631. y: '(NaN+[Infinity])[10]',
  632. z: '(+(35))["to"+String["name"]](36)',
  633. A: '(+[]+Array)[10]',
  634. B: '(+[]+Boolean)[10]',
  635. C: 'Function("return escape")()(("")["italics"]())[2]',
  636. D: 'Function("return escape")()([]["fill"])["slice"]("-1")',
  637. E: '(RegExp+"")[12]',
  638. F: '(+[]+Function)[10]',
  639. G: '(false+Function("return Date")()())[30]',
  640. H: '\'H\'',
  641. I: '(Infinity+"")[0]',
  642. J: '\'J\'',
  643. K: '\'K\'',
  644. L: '\'L\'',
  645. M: '(true+Function("return Date")()())[30]',
  646. N: '(NaN+"")[0]',
  647. O: '(NaN+Function("return{}")())[11]',
  648. P: '\'P\'',
  649. Q: '\'Q\'',
  650. R: '(+[]+RegExp)[10]',
  651. S: '(+[]+String)[10]',
  652. T: '(NaN+Function("return Date")()())[30]',
  653. U: '(NaN+Function("return{}")()["to"+String["name"]]["call"]())[11]',
  654. V: '\'V\'',
  655. W: '\'W\'',
  656. X: '\'X\'',
  657. Y: '\'Y\'',
  658. Z: '\'Z\''
  659. };
  660. /***/ },
  661. /* 11 */
  662. /***/ function(module, exports) {
  663. module.exports = require("escodegen");
  664. /***/ },
  665. /* 12 */
  666. /***/ function(module, exports) {
  667. "use strict";
  668. "use strict";
  669. 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; }; }();
  670. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  671. var NodesGroup = function () {
  672. function NodesGroup(options) {
  673. _classCallCheck(this, NodesGroup);
  674. this.nodes = new Map();
  675. this.options = options;
  676. }
  677. _createClass(NodesGroup, [{
  678. key: "getNodes",
  679. value: function getNodes() {
  680. return this.nodes;
  681. }
  682. }]);
  683. return NodesGroup;
  684. }();
  685. exports.NodesGroup = NodesGroup;
  686. /***/ },
  687. /* 13 */
  688. /***/ function(module, exports) {
  689. "use strict";
  690. "use strict";
  691. exports.NO_CUSTOM_NODES_PRESET = Object.freeze({
  692. compact: true,
  693. debugProtection: false,
  694. debugProtectionInterval: false,
  695. disableConsoleOutput: false,
  696. encodeUnicodeLiterals: false,
  697. reservedNames: [],
  698. rotateUnicodeArray: false,
  699. selfDefending: false,
  700. unicodeArray: false,
  701. unicodeArrayThreshold: 0,
  702. wrapUnicodeArrayCalls: false
  703. });
  704. /***/ },
  705. /* 14 */
  706. /***/ function(module, exports) {
  707. "use strict";
  708. "use strict";
  709. exports.DEFAULT_PRESET = Object.freeze({
  710. compact: true,
  711. debugProtection: false,
  712. debugProtectionInterval: false,
  713. disableConsoleOutput: true,
  714. encodeUnicodeLiterals: false,
  715. reservedNames: [],
  716. rotateUnicodeArray: true,
  717. selfDefending: true,
  718. unicodeArray: true,
  719. unicodeArrayThreshold: 0.8,
  720. wrapUnicodeArrayCalls: true
  721. });
  722. /***/ },
  723. /* 15 */
  724. /***/ function(module, exports, __webpack_require__) {
  725. "use strict";
  726. "use strict";
  727. var JavaScriptObfuscator_1 = __webpack_require__(9);
  728. module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator;
  729. /***/ },
  730. /* 16 */
  731. /***/ function(module, exports, __webpack_require__) {
  732. "use strict";
  733. "use strict";
  734. 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; }; }();
  735. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  736. var estraverse = __webpack_require__(3);
  737. var AppendState_1 = __webpack_require__(6);
  738. var NodeType_1 = __webpack_require__(2);
  739. var CatchClauseObfuscator_1 = __webpack_require__(32);
  740. var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(20);
  741. var DebugProtectionNodesGroup_1 = __webpack_require__(29);
  742. var FunctionDeclarationObfuscator_1 = __webpack_require__(33);
  743. var FunctionObfuscator_1 = __webpack_require__(34);
  744. var LiteralObfuscator_1 = __webpack_require__(35);
  745. var MemberExpressionObfuscator_1 = __webpack_require__(36);
  746. var MethodDefinitionObfuscator_1 = __webpack_require__(37);
  747. var NodeUtils_1 = __webpack_require__(1);
  748. var ObjectExpressionObfuscator_1 = __webpack_require__(38);
  749. var SelfDefendingNodesGroup_1 = __webpack_require__(30);
  750. var UnicodeArrayNodesGroup_1 = __webpack_require__(31);
  751. var VariableDeclarationObfuscator_1 = __webpack_require__(39);
  752. var Obfuscator = function () {
  753. function Obfuscator(options) {
  754. _classCallCheck(this, Obfuscator);
  755. this.nodes = new Map();
  756. 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]]]);
  757. this.options = options;
  758. }
  759. _createClass(Obfuscator, [{
  760. key: 'obfuscateNode',
  761. value: function obfuscateNode(node) {
  762. this.setNewNodes();
  763. NodeUtils_1.NodeUtils.parentize(node);
  764. this.beforeObfuscation(node);
  765. this.obfuscate(node);
  766. this.afterObfuscation(node);
  767. return node;
  768. }
  769. }, {
  770. key: 'setNode',
  771. value: function setNode(nodeName, node) {
  772. this.nodes.set(nodeName, node);
  773. }
  774. }, {
  775. key: 'setNodesGroup',
  776. value: function setNodesGroup(nodesGroup) {
  777. var _this = this;
  778. var nodes = nodesGroup.getNodes();
  779. nodes.forEach(function (node, key) {
  780. _this.nodes.set(key, node);
  781. });
  782. }
  783. }, {
  784. key: 'afterObfuscation',
  785. value: function afterObfuscation(astTree) {
  786. this.nodes.forEach(function (node) {
  787. if (node.getAppendState() === AppendState_1.AppendState.AfterObfuscation) {
  788. node.appendNode(astTree);
  789. }
  790. });
  791. }
  792. }, {
  793. key: 'beforeObfuscation',
  794. value: function beforeObfuscation(astTree) {
  795. this.nodes.forEach(function (node) {
  796. if (node.getAppendState() === AppendState_1.AppendState.BeforeObfuscation) {
  797. node.appendNode(astTree);
  798. }
  799. });
  800. }
  801. }, {
  802. key: 'initializeNodeObfuscators',
  803. value: function initializeNodeObfuscators(node, parentNode) {
  804. var _this2 = this;
  805. if (!this.nodeObfuscators.has(node.type)) {
  806. return;
  807. }
  808. this.nodeObfuscators.get(node.type).forEach(function (obfuscator) {
  809. new obfuscator(_this2.nodes, _this2.options).obfuscateNode(node, parentNode);
  810. });
  811. }
  812. }, {
  813. key: 'obfuscate',
  814. value: function obfuscate(node) {
  815. var _this3 = this;
  816. estraverse.replace(node, {
  817. leave: function leave(node, parentNode) {
  818. _this3.initializeNodeObfuscators(node, parentNode);
  819. }
  820. });
  821. }
  822. }, {
  823. key: 'setNewNodes',
  824. value: function setNewNodes() {
  825. if (this.options.get('selfDefending')) {
  826. this.setNodesGroup(new SelfDefendingNodesGroup_1.SelfDefendingNodesGroup(this.options));
  827. }
  828. if (this.options.get('disableConsoleOutput')) {
  829. this.setNode('consoleOutputDisableExpressionNode', new ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode(this.options));
  830. }
  831. if (this.options.get('debugProtection')) {
  832. this.setNodesGroup(new DebugProtectionNodesGroup_1.DebugProtectionNodesGroup(this.options));
  833. }
  834. if (this.options.get('unicodeArray')) {
  835. this.setNodesGroup(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options));
  836. }
  837. }
  838. }]);
  839. return Obfuscator;
  840. }();
  841. exports.Obfuscator = Obfuscator;
  842. /***/ },
  843. /* 17 */
  844. /***/ function(module, exports, __webpack_require__) {
  845. "use strict";
  846. "use strict";
  847. 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; }; }();
  848. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  849. var OptionsNormalizer_1 = __webpack_require__(18);
  850. var DefaultPreset_1 = __webpack_require__(14);
  851. var Options = function () {
  852. function Options(options) {
  853. _classCallCheck(this, Options);
  854. this.options = Object.freeze(OptionsNormalizer_1.OptionsNormalizer.normalizeOptionsPreset(Object.assign({}, DefaultPreset_1.DEFAULT_PRESET, options)));
  855. }
  856. _createClass(Options, [{
  857. key: "get",
  858. value: function get(optionName) {
  859. return this.options[optionName];
  860. }
  861. }]);
  862. return Options;
  863. }();
  864. exports.Options = Options;
  865. /***/ },
  866. /* 18 */
  867. /***/ function(module, exports) {
  868. "use strict";
  869. "use strict";
  870. 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; }; }();
  871. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  872. var OptionsNormalizer = function () {
  873. function OptionsNormalizer() {
  874. _classCallCheck(this, OptionsNormalizer);
  875. }
  876. _createClass(OptionsNormalizer, null, [{
  877. key: 'normalizeOptionsPreset',
  878. value: function normalizeOptionsPreset(options) {
  879. var normalizedOptions = Object.assign({}, options);
  880. normalizedOptions = OptionsNormalizer.unicodeArrayRule(normalizedOptions);
  881. normalizedOptions = OptionsNormalizer.unicodeArrayThresholdRule(normalizedOptions);
  882. normalizedOptions = OptionsNormalizer.selfDefendingRule(normalizedOptions);
  883. return normalizedOptions;
  884. }
  885. }, {
  886. key: 'selfDefendingRule',
  887. value: function selfDefendingRule(options) {
  888. if (options['selfDefending']) {
  889. Object.assign(options, OptionsNormalizer.SELF_DEFENDING_OPTIONS);
  890. }
  891. return options;
  892. }
  893. }, {
  894. key: 'unicodeArrayRule',
  895. value: function unicodeArrayRule(options) {
  896. if (!options['unicodeArray']) {
  897. Object.assign(options, OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS);
  898. }
  899. return options;
  900. }
  901. }, {
  902. key: 'unicodeArrayThresholdRule',
  903. value: function unicodeArrayThresholdRule(options) {
  904. var minValue = 0,
  905. maxValue = 1;
  906. options['unicodeArrayThreshold'] = Math.min(Math.max(options['unicodeArrayThreshold'], minValue), maxValue);
  907. return options;
  908. }
  909. }]);
  910. return OptionsNormalizer;
  911. }();
  912. OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS = {
  913. encodeUnicodeLiterals: false,
  914. rotateUnicodeArray: false,
  915. unicodeArray: false,
  916. unicodeArrayThreshold: 0,
  917. wrapUnicodeArrayCalls: false
  918. };
  919. OptionsNormalizer.SELF_DEFENDING_OPTIONS = {
  920. compact: true,
  921. selfDefending: true
  922. };
  923. exports.OptionsNormalizer = OptionsNormalizer;
  924. /***/ },
  925. /* 19 */
  926. /***/ function(module, exports, __webpack_require__) {
  927. "use strict";
  928. "use strict";
  929. 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; }; }();
  930. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  931. var commands = __webpack_require__(42);
  932. var fs = __webpack_require__(43);
  933. var mkdirp = __webpack_require__(44);
  934. var path = __webpack_require__(45);
  935. var child_process_1 = __webpack_require__(41);
  936. var DefaultPreset_1 = __webpack_require__(14);
  937. var JavaScriptObfuscator_1 = __webpack_require__(9);
  938. var JavaScriptObfuscatorCLI = function () {
  939. function JavaScriptObfuscatorCLI(argv) {
  940. _classCallCheck(this, JavaScriptObfuscatorCLI);
  941. this.data = '';
  942. this.rawArguments = argv;
  943. this.arguments = this.rawArguments.slice(2);
  944. }
  945. _createClass(JavaScriptObfuscatorCLI, [{
  946. key: 'run',
  947. value: function run() {
  948. this.configureCommands();
  949. if (!this.arguments.length || this.arguments.indexOf('--help') >= 0) {
  950. commands.outputHelp();
  951. return;
  952. }
  953. this.inputPath = this.getInputPath();
  954. this.getData();
  955. this.processData();
  956. }
  957. }, {
  958. key: 'configureCommands',
  959. value: function configureCommands() {
  960. commands.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) {
  961. return val.split(',');
  962. }).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('--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);
  963. commands.on('--help', function () {
  964. var isWindows = process.platform === 'win32',
  965. commandName = isWindows ? 'type' : 'cat';
  966. console.log(' Examples:\n');
  967. console.log(' %> javascript-obfuscator < in.js > out.js');
  968. console.log(' %> ' + commandName + ' in1.js in2.js | javascript-obfuscator > out.js');
  969. console.log('');
  970. process.exit();
  971. });
  972. }
  973. }, {
  974. key: 'getData',
  975. value: function getData() {
  976. this.data = fs.readFileSync(this.inputPath, JavaScriptObfuscatorCLI.encoding);
  977. }
  978. }, {
  979. key: 'getInputPath',
  980. value: function getInputPath() {
  981. var inputPath = this.arguments[0];
  982. if (!JavaScriptObfuscatorCLI.isFilePath(inputPath)) {
  983. throw new ReferenceError('First argument must be a valid file path');
  984. }
  985. if (JavaScriptObfuscatorCLI.availableInputExtensions.indexOf(path.extname(inputPath)) === -1) {
  986. throw new ReferenceError('Input file must have .js extension');
  987. }
  988. return inputPath;
  989. }
  990. }, {
  991. key: 'getOutputPath',
  992. value: function getOutputPath() {
  993. var outputPath = commands.output;
  994. if (outputPath) {
  995. return outputPath;
  996. }
  997. return this.inputPath.split('.').map(function (value, index) {
  998. return index === 0 ? value + '-obfuscated' : value;
  999. }).join('.');
  1000. }
  1001. }, {
  1002. key: 'processData',
  1003. value: function processData() {
  1004. var outputPath = this.getOutputPath(),
  1005. dirName = path.dirname(outputPath);
  1006. mkdirp.sync(dirName);
  1007. fs.writeFileSync(this.getOutputPath(), JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(this.data, JavaScriptObfuscatorCLI.buildOptions()), {
  1008. encoding: JavaScriptObfuscatorCLI.encoding
  1009. });
  1010. }
  1011. }], [{
  1012. key: 'buildOptions',
  1013. value: function buildOptions() {
  1014. var options = {},
  1015. availableOptions = Object.keys(DefaultPreset_1.DEFAULT_PRESET);
  1016. for (var option in commands) {
  1017. if (!commands.hasOwnProperty(option)) {
  1018. continue;
  1019. }
  1020. if (availableOptions.indexOf(option) === -1) {
  1021. continue;
  1022. }
  1023. options[option] = commands[option];
  1024. }
  1025. return Object.assign({}, DefaultPreset_1.DEFAULT_PRESET, options);
  1026. }
  1027. }, {
  1028. key: 'getBuildVersion',
  1029. value: function getBuildVersion() {
  1030. return child_process_1.execSync('npm info ' + JavaScriptObfuscatorCLI.packageName + ' version', {
  1031. encoding: JavaScriptObfuscatorCLI.encoding
  1032. });
  1033. }
  1034. }, {
  1035. key: 'isFilePath',
  1036. value: function isFilePath(filePath) {
  1037. try {
  1038. return fs.statSync(filePath).isFile();
  1039. } catch (e) {
  1040. return false;
  1041. }
  1042. }
  1043. }, {
  1044. key: 'parseBoolean',
  1045. value: function parseBoolean(value) {
  1046. return value === 'true' || value === '1';
  1047. }
  1048. }]);
  1049. return JavaScriptObfuscatorCLI;
  1050. }();
  1051. JavaScriptObfuscatorCLI.availableInputExtensions = ['.js'];
  1052. JavaScriptObfuscatorCLI.encoding = 'utf8';
  1053. JavaScriptObfuscatorCLI.packageName = 'javascript-obfuscator';
  1054. exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLI;
  1055. /***/ },
  1056. /* 20 */
  1057. /***/ function(module, exports, __webpack_require__) {
  1058. "use strict";
  1059. "use strict";
  1060. 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; }; }();
  1061. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1062. 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; }
  1063. 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; }
  1064. var esprima = __webpack_require__(7);
  1065. var Node_1 = __webpack_require__(4);
  1066. var NodeUtils_1 = __webpack_require__(1);
  1067. var ConsoleOutputDisableExpressionNode = function (_Node_1$Node) {
  1068. _inherits(ConsoleOutputDisableExpressionNode, _Node_1$Node);
  1069. function ConsoleOutputDisableExpressionNode(options) {
  1070. _classCallCheck(this, ConsoleOutputDisableExpressionNode);
  1071. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ConsoleOutputDisableExpressionNode).call(this, options));
  1072. _this.node = _this.getNodeStructure();
  1073. return _this;
  1074. }
  1075. _createClass(ConsoleOutputDisableExpressionNode, [{
  1076. key: 'appendNode',
  1077. value: function appendNode(blockScopeNode) {
  1078. NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
  1079. }
  1080. }, {
  1081. key: 'getNodeStructure',
  1082. value: function getNodeStructure() {
  1083. return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(esprima.parse('\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 '));
  1084. }
  1085. }]);
  1086. return ConsoleOutputDisableExpressionNode;
  1087. }(Node_1.Node);
  1088. exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
  1089. /***/ },
  1090. /* 21 */
  1091. /***/ function(module, exports, __webpack_require__) {
  1092. "use strict";
  1093. "use strict";
  1094. 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; }; }();
  1095. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1096. 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; }
  1097. 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; }
  1098. var NodeType_1 = __webpack_require__(2);
  1099. var Node_1 = __webpack_require__(4);
  1100. var NodeUtils_1 = __webpack_require__(1);
  1101. var DebugProtectionFunctionCallNode = function (_Node_1$Node) {
  1102. _inherits(DebugProtectionFunctionCallNode, _Node_1$Node);
  1103. function DebugProtectionFunctionCallNode(debugProtectionFunctionName, options) {
  1104. _classCallCheck(this, DebugProtectionFunctionCallNode);
  1105. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionCallNode).call(this, options));
  1106. _this.debugProtectionFunctionName = debugProtectionFunctionName;
  1107. _this.node = _this.getNodeStructure();
  1108. return _this;
  1109. }
  1110. _createClass(DebugProtectionFunctionCallNode, [{
  1111. key: "appendNode",
  1112. value: function appendNode(blockScopeNode) {
  1113. NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
  1114. }
  1115. }, {
  1116. key: "getNodeStructure",
  1117. value: function getNodeStructure() {
  1118. return {
  1119. 'type': NodeType_1.NodeType.ExpressionStatement,
  1120. 'expression': {
  1121. 'type': NodeType_1.NodeType.CallExpression,
  1122. 'callee': {
  1123. 'type': NodeType_1.NodeType.Identifier,
  1124. 'name': this.debugProtectionFunctionName
  1125. },
  1126. 'arguments': []
  1127. }
  1128. };
  1129. }
  1130. }]);
  1131. return DebugProtectionFunctionCallNode;
  1132. }(Node_1.Node);
  1133. exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
  1134. /***/ },
  1135. /* 22 */
  1136. /***/ function(module, exports, __webpack_require__) {
  1137. "use strict";
  1138. "use strict";
  1139. 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; }; }();
  1140. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1141. 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; }
  1142. 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; }
  1143. var NodeType_1 = __webpack_require__(2);
  1144. var Node_1 = __webpack_require__(4);
  1145. var NodeUtils_1 = __webpack_require__(1);
  1146. var DebugProtectionFunctionIntervalNode = function (_Node_1$Node) {
  1147. _inherits(DebugProtectionFunctionIntervalNode, _Node_1$Node);
  1148. function DebugProtectionFunctionIntervalNode(debugProtectionFunctionName, options) {
  1149. _classCallCheck(this, DebugProtectionFunctionIntervalNode);
  1150. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionIntervalNode).call(this, options));
  1151. _this.debugProtectionFunctionName = debugProtectionFunctionName;
  1152. _this.node = _this.getNodeStructure();
  1153. return _this;
  1154. }
  1155. _createClass(DebugProtectionFunctionIntervalNode, [{
  1156. key: 'appendNode',
  1157. value: function appendNode(blockScopeNode) {
  1158. NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
  1159. }
  1160. }, {
  1161. key: 'getNodeStructure',
  1162. value: function getNodeStructure() {
  1163. return {
  1164. 'type': NodeType_1.NodeType.ExpressionStatement,
  1165. 'expression': {
  1166. 'type': NodeType_1.NodeType.CallExpression,
  1167. 'callee': {
  1168. 'type': NodeType_1.NodeType.Identifier,
  1169. 'name': 'setInterval'
  1170. },
  1171. 'arguments': [{
  1172. 'type': NodeType_1.NodeType.FunctionExpression,
  1173. 'id': null,
  1174. 'params': [],
  1175. 'defaults': [],
  1176. 'body': {
  1177. 'type': NodeType_1.NodeType.BlockStatement,
  1178. 'body': [{
  1179. 'type': NodeType_1.NodeType.ExpressionStatement,
  1180. 'expression': {
  1181. 'type': NodeType_1.NodeType.CallExpression,
  1182. 'callee': {
  1183. 'type': NodeType_1.NodeType.Identifier,
  1184. 'name': this.debugProtectionFunctionName
  1185. },
  1186. 'arguments': []
  1187. }
  1188. }]
  1189. },
  1190. 'generator': false,
  1191. 'expression': false
  1192. }, {
  1193. 'type': NodeType_1.NodeType.Literal,
  1194. 'value': 4000,
  1195. 'raw': '4000'
  1196. }]
  1197. }
  1198. };
  1199. }
  1200. }]);
  1201. return DebugProtectionFunctionIntervalNode;
  1202. }(Node_1.Node);
  1203. exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
  1204. /***/ },
  1205. /* 23 */
  1206. /***/ function(module, exports, __webpack_require__) {
  1207. "use strict";
  1208. "use strict";
  1209. 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; }; }();
  1210. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1211. 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; }
  1212. 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; }
  1213. var esprima = __webpack_require__(7);
  1214. var Node_1 = __webpack_require__(4);
  1215. var NodeUtils_1 = __webpack_require__(1);
  1216. var Utils_1 = __webpack_require__(0);
  1217. var DebugProtectionFunctionNode = function (_Node_1$Node) {
  1218. _inherits(DebugProtectionFunctionNode, _Node_1$Node);
  1219. function DebugProtectionFunctionNode(debugProtectionFunctionName, options) {
  1220. _classCallCheck(this, DebugProtectionFunctionNode);
  1221. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionNode).call(this, options));
  1222. _this.debugProtectionFunctionName = debugProtectionFunctionName;
  1223. _this.node = _this.getNodeStructure();
  1224. return _this;
  1225. }
  1226. _createClass(DebugProtectionFunctionNode, [{
  1227. key: 'appendNode',
  1228. value: function appendNode(blockScopeNode) {
  1229. var programBodyLength = blockScopeNode.body.length,
  1230. randomIndex = Utils_1.Utils.getRandomGenerator().integer({
  1231. min: 0,
  1232. max: programBodyLength
  1233. });
  1234. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex);
  1235. }
  1236. }, {
  1237. key: 'getNodeIdentifier',
  1238. value: function getNodeIdentifier() {
  1239. return this.debugProtectionFunctionName;
  1240. }
  1241. }, {
  1242. key: 'getNodeStructure',
  1243. value: function getNodeStructure() {
  1244. return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(esprima.parse('\n var ' + this.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 '));
  1245. }
  1246. }]);
  1247. return DebugProtectionFunctionNode;
  1248. }(Node_1.Node);
  1249. exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
  1250. /***/ },
  1251. /* 24 */
  1252. /***/ function(module, exports, __webpack_require__) {
  1253. "use strict";
  1254. "use strict";
  1255. 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; }; }();
  1256. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1257. 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; }
  1258. 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; }
  1259. var esprima = __webpack_require__(7);
  1260. var AppendState_1 = __webpack_require__(6);
  1261. var JSFuck_1 = __webpack_require__(10);
  1262. var NoCustomNodesPreset_1 = __webpack_require__(13);
  1263. var JavaScriptObfuscator_1 = __webpack_require__(9);
  1264. var Node_1 = __webpack_require__(4);
  1265. var NodeUtils_1 = __webpack_require__(1);
  1266. var Utils_1 = __webpack_require__(0);
  1267. var SelfDefendingUnicodeNode = function (_Node_1$Node) {
  1268. _inherits(SelfDefendingUnicodeNode, _Node_1$Node);
  1269. function SelfDefendingUnicodeNode(options) {
  1270. _classCallCheck(this, SelfDefendingUnicodeNode);
  1271. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SelfDefendingUnicodeNode).call(this, options));
  1272. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1273. _this.node = _this.getNodeStructure();
  1274. return _this;
  1275. }
  1276. _createClass(SelfDefendingUnicodeNode, [{
  1277. key: "appendNode",
  1278. value: function appendNode(blockScopeNode) {
  1279. var programBodyLength = blockScopeNode.body.length,
  1280. randomIndex = 0;
  1281. if (programBodyLength > 2) {
  1282. randomIndex = Utils_1.Utils.getRandomGenerator().integer({
  1283. min: programBodyLength / 2,
  1284. max: programBodyLength - 1
  1285. });
  1286. }
  1287. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex);
  1288. }
  1289. }, {
  1290. key: "getNodeStructure",
  1291. value: function getNodeStructure() {
  1292. var node = esprima.parse(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () { \n var func = function(){return " + Utils_1.Utils.stringToUnicode('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') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET));
  1293. NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
  1294. return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
  1295. }
  1296. }]);
  1297. return SelfDefendingUnicodeNode;
  1298. }(Node_1.Node);
  1299. exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
  1300. /***/ },
  1301. /* 25 */
  1302. /***/ function(module, exports, __webpack_require__) {
  1303. "use strict";
  1304. "use strict";
  1305. 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; }; }();
  1306. 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); } };
  1307. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1308. 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; }
  1309. 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; }
  1310. var esprima = __webpack_require__(7);
  1311. var AppendState_1 = __webpack_require__(6);
  1312. var Node_1 = __webpack_require__(4);
  1313. var NodeUtils_1 = __webpack_require__(1);
  1314. var Utils_1 = __webpack_require__(0);
  1315. var UnicodeArrayCallsWrapper = function (_Node_1$Node) {
  1316. _inherits(UnicodeArrayCallsWrapper, _Node_1$Node);
  1317. function UnicodeArrayCallsWrapper(unicodeArrayCallsWrapperName, unicodeArrayName, unicodeArray, options) {
  1318. _classCallCheck(this, UnicodeArrayCallsWrapper);
  1319. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayCallsWrapper).call(this, options));
  1320. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1321. _this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
  1322. _this.unicodeArrayName = unicodeArrayName;
  1323. _this.unicodeArray = unicodeArray;
  1324. _this.node = _this.getNodeStructure();
  1325. return _this;
  1326. }
  1327. _createClass(UnicodeArrayCallsWrapper, [{
  1328. key: "appendNode",
  1329. value: function appendNode(blockScopeNode) {
  1330. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
  1331. }
  1332. }, {
  1333. key: "getNodeIdentifier",
  1334. value: function getNodeIdentifier() {
  1335. return this.unicodeArrayCallsWrapperName;
  1336. }
  1337. }, {
  1338. key: "getNode",
  1339. value: function getNode() {
  1340. if (!this.unicodeArray.length) {
  1341. return;
  1342. }
  1343. this.updateNode();
  1344. return _get(Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), "getNode", this).call(this);
  1345. }
  1346. }, {
  1347. key: "getNodeStructure",
  1348. value: function getNodeStructure() {
  1349. var keyName = Utils_1.Utils.getRandomVariableName(),
  1350. node = void 0;
  1351. node = esprima.parse("\n var " + this.unicodeArrayCallsWrapperName + " = function (" + keyName + ") {\n return " + this.unicodeArrayName + "[parseInt(" + keyName + ", 0x010)];\n };\n ");
  1352. NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
  1353. return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
  1354. }
  1355. }]);
  1356. return UnicodeArrayCallsWrapper;
  1357. }(Node_1.Node);
  1358. exports.UnicodeArrayCallsWrapper = UnicodeArrayCallsWrapper;
  1359. /***/ },
  1360. /* 26 */
  1361. /***/ function(module, exports, __webpack_require__) {
  1362. "use strict";
  1363. "use strict";
  1364. 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; }; }();
  1365. 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); } };
  1366. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1367. 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; }
  1368. 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; }
  1369. var esprima = __webpack_require__(7);
  1370. var JavaScriptObfuscator_1 = __webpack_require__(9);
  1371. var AppendState_1 = __webpack_require__(6);
  1372. var JSFuck_1 = __webpack_require__(10);
  1373. var NoCustomNodesPreset_1 = __webpack_require__(13);
  1374. var Node_1 = __webpack_require__(4);
  1375. var NodeUtils_1 = __webpack_require__(1);
  1376. var Utils_1 = __webpack_require__(0);
  1377. var UnicodeArrayDecodeNode = function (_Node_1$Node) {
  1378. _inherits(UnicodeArrayDecodeNode, _Node_1$Node);
  1379. function UnicodeArrayDecodeNode(unicodeArrayName, unicodeArray, options) {
  1380. _classCallCheck(this, UnicodeArrayDecodeNode);
  1381. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayDecodeNode).call(this, options));
  1382. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1383. _this.unicodeArrayName = unicodeArrayName;
  1384. _this.unicodeArray = unicodeArray;
  1385. _this.node = _this.getNodeStructure();
  1386. return _this;
  1387. }
  1388. _createClass(UnicodeArrayDecodeNode, [{
  1389. key: 'appendNode',
  1390. value: function appendNode(blockScopeNode) {
  1391. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
  1392. }
  1393. }, {
  1394. key: 'getNode',
  1395. value: function getNode() {
  1396. if (!this.unicodeArray.length) {
  1397. return;
  1398. }
  1399. this.updateNode();
  1400. return _get(Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), 'getNode', this).call(this);
  1401. }
  1402. }, {
  1403. key: 'getNodeStructure',
  1404. value: function getNodeStructure() {
  1405. var environmentName = Utils_1.Utils.getRandomVariableName(),
  1406. forLoopFunctionName = Utils_1.Utils.getRandomVariableName(),
  1407. indexVariableName = Utils_1.Utils.getRandomVariableName(),
  1408. tempArrayName = Utils_1.Utils.getRandomVariableName();
  1409. var code = '',
  1410. node = void 0;
  1411. if (this.options.get('selfDefending')) {
  1412. code = '\n var ' + environmentName + ' = function(){return ' + Utils_1.Utils.stringToUnicode('dev') + ';};\n \n Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')()[' + Utils_1.Utils.stringToUnicode('test') + '](' + environmentName + '[' + Utils_1.Utils.stringToUnicode('toString') + ']()) !== ' + JSFuck_1.JSFuck.True + ' && !' + this.unicodeArrayName + '++ ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.True + '){}\')() : Function(' + Utils_1.Utils.stringToUnicode('a') + ', atob(' + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + '))(' + forLoopFunctionName + ') ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.False + '){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.False + '){}\')();\n ';
  1413. } else {
  1414. code = forLoopFunctionName + '();';
  1415. }
  1416. node = esprima.parse('\n (function () {\n ' + JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate('\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 ', NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET) + '\n \n var ' + forLoopFunctionName + ' = function () {\n var ' + tempArrayName + ' = [];\n \n for (var ' + indexVariableName + ' in ' + this.unicodeArrayName + ') {\n ' + tempArrayName + '[' + Utils_1.Utils.stringToUnicode('push') + '](decodeURI(atob(' + this.unicodeArrayName + '[' + indexVariableName + '])));\n }\n \n ' + this.unicodeArrayName + ' = ' + tempArrayName + ';\n };\n \n ' + code + '\n })();\n ');
  1417. NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
  1418. return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
  1419. }
  1420. }]);
  1421. return UnicodeArrayDecodeNode;
  1422. }(Node_1.Node);
  1423. exports.UnicodeArrayDecodeNode = UnicodeArrayDecodeNode;
  1424. /***/ },
  1425. /* 27 */
  1426. /***/ function(module, exports, __webpack_require__) {
  1427. "use strict";
  1428. "use strict";
  1429. 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; }; }();
  1430. 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); } };
  1431. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1432. 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; }
  1433. 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; }
  1434. var escodegen = __webpack_require__(11);
  1435. var AppendState_1 = __webpack_require__(6);
  1436. var NodeType_1 = __webpack_require__(2);
  1437. var Node_1 = __webpack_require__(4);
  1438. var NodeUtils_1 = __webpack_require__(1);
  1439. var Utils_1 = __webpack_require__(0);
  1440. var UnicodeArrayNode = function (_Node_1$Node) {
  1441. _inherits(UnicodeArrayNode, _Node_1$Node);
  1442. function UnicodeArrayNode(unicodeArrayName) {
  1443. var unicodeArrayRotateValue = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
  1444. var options = arguments[2];
  1445. _classCallCheck(this, UnicodeArrayNode);
  1446. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNode).call(this, options));
  1447. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1448. _this.unicodeArray = [];
  1449. _this.unicodeArrayName = unicodeArrayName;
  1450. _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
  1451. _this.node = _this.getNodeStructure();
  1452. return _this;
  1453. }
  1454. _createClass(UnicodeArrayNode, [{
  1455. key: 'appendNode',
  1456. value: function appendNode(blockScopeNode) {
  1457. NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
  1458. }
  1459. }, {
  1460. key: 'getNodeIdentifier',
  1461. value: function getNodeIdentifier() {
  1462. return this.unicodeArrayName;
  1463. }
  1464. }, {
  1465. key: 'getNodeData',
  1466. value: function getNodeData() {
  1467. return this.unicodeArray;
  1468. }
  1469. }, {
  1470. key: 'getNode',
  1471. value: function getNode() {
  1472. if (!this.unicodeArray.length) {
  1473. return;
  1474. }
  1475. Utils_1.Utils.arrayRotate(this.unicodeArray, this.unicodeArrayRotateValue);
  1476. this.updateNode();
  1477. return _get(Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
  1478. }
  1479. }, {
  1480. key: 'updateNodeData',
  1481. value: function updateNodeData(data) {
  1482. this.unicodeArray.push(data);
  1483. }
  1484. }, {
  1485. key: 'getNodeStructure',
  1486. value: function getNodeStructure() {
  1487. return {
  1488. 'type': NodeType_1.NodeType.VariableDeclaration,
  1489. 'declarations': [{
  1490. 'type': NodeType_1.NodeType.VariableDeclarator,
  1491. 'id': {
  1492. 'type': NodeType_1.NodeType.Identifier,
  1493. 'name': this.unicodeArrayName
  1494. },
  1495. 'init': {
  1496. 'type': NodeType_1.NodeType.ArrayExpression,
  1497. 'elements': this.unicodeArray.map(function (value) {
  1498. return {
  1499. 'type': NodeType_1.NodeType.Literal,
  1500. 'value': value,
  1501. 'raw': '\'' + value + '\'',
  1502. 'x-verbatim-property': {
  1503. 'content': value,
  1504. precedence: escodegen.Precedence.Primary
  1505. }
  1506. };
  1507. })
  1508. }
  1509. }],
  1510. 'kind': 'var'
  1511. };
  1512. }
  1513. }]);
  1514. return UnicodeArrayNode;
  1515. }(Node_1.Node);
  1516. UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH = 4;
  1517. exports.UnicodeArrayNode = UnicodeArrayNode;
  1518. /***/ },
  1519. /* 28 */
  1520. /***/ function(module, exports, __webpack_require__) {
  1521. "use strict";
  1522. "use strict";
  1523. 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; }; }();
  1524. 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); } };
  1525. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1526. 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; }
  1527. 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; }
  1528. var esprima = __webpack_require__(7);
  1529. var AppendState_1 = __webpack_require__(6);
  1530. var JSFuck_1 = __webpack_require__(10);
  1531. var NoCustomNodesPreset_1 = __webpack_require__(13);
  1532. var JavaScriptObfuscator_1 = __webpack_require__(9);
  1533. var Node_1 = __webpack_require__(4);
  1534. var NodeUtils_1 = __webpack_require__(1);
  1535. var Utils_1 = __webpack_require__(0);
  1536. var UnicodeArrayRotateFunctionNode = function (_Node_1$Node) {
  1537. _inherits(UnicodeArrayRotateFunctionNode, _Node_1$Node);
  1538. function UnicodeArrayRotateFunctionNode(unicodeArrayName, unicodeArray, unicodeArrayRotateValue, options) {
  1539. _classCallCheck(this, UnicodeArrayRotateFunctionNode);
  1540. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayRotateFunctionNode).call(this, options));
  1541. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1542. _this.unicodeArrayName = unicodeArrayName;
  1543. _this.unicodeArray = unicodeArray;
  1544. _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
  1545. _this.node = _this.getNodeStructure();
  1546. return _this;
  1547. }
  1548. _createClass(UnicodeArrayRotateFunctionNode, [{
  1549. key: "appendNode",
  1550. value: function appendNode(blockScopeNode) {
  1551. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
  1552. }
  1553. }, {
  1554. key: "getNode",
  1555. value: function getNode() {
  1556. if (!this.unicodeArray.length) {
  1557. return;
  1558. }
  1559. return _get(Object.getPrototypeOf(UnicodeArrayRotateFunctionNode.prototype), "getNode", this).call(this);
  1560. }
  1561. }, {
  1562. key: "getNodeStructure",
  1563. value: function getNodeStructure() {
  1564. var arrayName = Utils_1.Utils.getRandomVariableName(),
  1565. code = '',
  1566. timesName = Utils_1.Utils.getRandomVariableName(),
  1567. timesArgumentName = Utils_1.Utils.getRandomVariableName(),
  1568. whileFunctionName = Utils_1.Utils.getRandomVariableName(),
  1569. node = void 0;
  1570. if (this.options.get('selfDefending')) {
  1571. code = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () {\n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", " + Utils_1.Utils.stringToUnicode('b') + ", " + Utils_1.Utils.stringToUnicode('a(++b)') + ")(" + whileFunctionName + ", " + timesName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET);
  1572. } else {
  1573. code = whileFunctionName + "(++" + timesName + ")";
  1574. }
  1575. node = esprima.parse("\n (function (" + arrayName + ", " + timesName + ") {\n var " + whileFunctionName + " = function (" + timesArgumentName + ") {\n while (--" + timesArgumentName + ") {\n " + arrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](" + arrayName + "[" + Utils_1.Utils.stringToUnicode('shift') + "]());\n }\n };\n \n " + code + "\n })(" + this.unicodeArrayName + ", 0x" + Utils_1.Utils.decToHex(this.unicodeArrayRotateValue) + ");\n ");
  1576. NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
  1577. return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
  1578. }
  1579. }]);
  1580. return UnicodeArrayRotateFunctionNode;
  1581. }(Node_1.Node);
  1582. exports.UnicodeArrayRotateFunctionNode = UnicodeArrayRotateFunctionNode;
  1583. /***/ },
  1584. /* 29 */
  1585. /***/ function(module, exports, __webpack_require__) {
  1586. "use strict";
  1587. "use strict";
  1588. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1589. 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; }
  1590. 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; }
  1591. var DebugProtectionFunctionCallNode_1 = __webpack_require__(21);
  1592. var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(22);
  1593. var DebugProtectionFunctionNode_1 = __webpack_require__(23);
  1594. var NodesGroup_1 = __webpack_require__(12);
  1595. var Utils_1 = __webpack_require__(0);
  1596. var DebugProtectionNodesGroup = function (_NodesGroup_1$NodesGr) {
  1597. _inherits(DebugProtectionNodesGroup, _NodesGroup_1$NodesGr);
  1598. function DebugProtectionNodesGroup(options) {
  1599. _classCallCheck(this, DebugProtectionNodesGroup);
  1600. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionNodesGroup).call(this, options));
  1601. _this.debugProtectionFunctionIdentifier = Utils_1.Utils.getRandomVariableName();
  1602. _this.nodes.set('debugProtectionFunctionNode', new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(_this.debugProtectionFunctionIdentifier, _this.options));
  1603. _this.nodes.set('debugProtectionFunctionCallNode', new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(_this.debugProtectionFunctionIdentifier, _this.options));
  1604. if (_this.options.get('debugProtectionInterval')) {
  1605. _this.nodes.set('debugProtectionFunctionIntervalNode', new DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode(_this.debugProtectionFunctionIdentifier, _this.options));
  1606. }
  1607. return _this;
  1608. }
  1609. return DebugProtectionNodesGroup;
  1610. }(NodesGroup_1.NodesGroup);
  1611. exports.DebugProtectionNodesGroup = DebugProtectionNodesGroup;
  1612. /***/ },
  1613. /* 30 */
  1614. /***/ function(module, exports, __webpack_require__) {
  1615. "use strict";
  1616. "use strict";
  1617. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1618. 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; }
  1619. 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; }
  1620. var NodesGroup_1 = __webpack_require__(12);
  1621. var SelfDefendingUnicodeNode_1 = __webpack_require__(24);
  1622. var SelfDefendingNodesGroup = function (_NodesGroup_1$NodesGr) {
  1623. _inherits(SelfDefendingNodesGroup, _NodesGroup_1$NodesGr);
  1624. function SelfDefendingNodesGroup(options) {
  1625. _classCallCheck(this, SelfDefendingNodesGroup);
  1626. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SelfDefendingNodesGroup).call(this, options));
  1627. _this.nodes.set('selfDefendingUnicodeNode', new SelfDefendingUnicodeNode_1.SelfDefendingUnicodeNode(_this.options));
  1628. return _this;
  1629. }
  1630. return SelfDefendingNodesGroup;
  1631. }(NodesGroup_1.NodesGroup);
  1632. exports.SelfDefendingNodesGroup = SelfDefendingNodesGroup;
  1633. /***/ },
  1634. /* 31 */
  1635. /***/ function(module, exports, __webpack_require__) {
  1636. "use strict";
  1637. "use strict";
  1638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1639. 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; }
  1640. 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; }
  1641. var NodesGroup_1 = __webpack_require__(12);
  1642. var UnicodeArrayCallsWrapper_1 = __webpack_require__(25);
  1643. var UnicodeArrayDecodeNode_1 = __webpack_require__(26);
  1644. var UnicodeArrayNode_1 = __webpack_require__(27);
  1645. var UnicodeArrayRotateFunctionNode_1 = __webpack_require__(28);
  1646. var Utils_1 = __webpack_require__(0);
  1647. var UnicodeArrayNodesGroup = function (_NodesGroup_1$NodesGr) {
  1648. _inherits(UnicodeArrayNodesGroup, _NodesGroup_1$NodesGr);
  1649. function UnicodeArrayNodesGroup(options) {
  1650. _classCallCheck(this, UnicodeArrayNodesGroup);
  1651. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UnicodeArrayNodesGroup).call(this, options));
  1652. _this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
  1653. _this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
  1654. if (_this.options.get('rotateUnicodeArray')) {
  1655. _this.unicodeArrayRotateValue = Utils_1.Utils.getRandomGenerator().integer({
  1656. min: 100,
  1657. max: 500
  1658. });
  1659. } else {
  1660. _this.unicodeArrayRotateValue = 0;
  1661. }
  1662. var unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(_this.unicodeArrayName, _this.unicodeArrayRotateValue, _this.options),
  1663. unicodeArray = unicodeArrayNode.getNodeData();
  1664. _this.nodes.set('unicodeArrayNode', unicodeArrayNode);
  1665. if (_this.options.get('wrapUnicodeArrayCalls')) {
  1666. _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
  1667. }
  1668. if (_this.options.get('encodeUnicodeLiterals')) {
  1669. _this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(_this.unicodeArrayName, unicodeArray, _this.options));
  1670. }
  1671. if (_this.options.get('rotateUnicodeArray')) {
  1672. _this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(_this.unicodeArrayName, unicodeArray, _this.unicodeArrayRotateValue, _this.options));
  1673. }
  1674. return _this;
  1675. }
  1676. return UnicodeArrayNodesGroup;
  1677. }(NodesGroup_1.NodesGroup);
  1678. exports.UnicodeArrayNodesGroup = UnicodeArrayNodesGroup;
  1679. /***/ },
  1680. /* 32 */
  1681. /***/ function(module, exports, __webpack_require__) {
  1682. "use strict";
  1683. "use strict";
  1684. 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; }; }();
  1685. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1686. 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; }
  1687. 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; }
  1688. var estraverse = __webpack_require__(3);
  1689. var NodeObfuscator_1 = __webpack_require__(5);
  1690. var CatchClauseObfuscator = function (_NodeObfuscator_1$Nod) {
  1691. _inherits(CatchClauseObfuscator, _NodeObfuscator_1$Nod);
  1692. function CatchClauseObfuscator() {
  1693. var _Object$getPrototypeO;
  1694. _classCallCheck(this, CatchClauseObfuscator);
  1695. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  1696. args[_key] = arguments[_key];
  1697. }
  1698. var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CatchClauseObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
  1699. _this.catchClauseParam = new Map();
  1700. return _this;
  1701. }
  1702. _createClass(CatchClauseObfuscator, [{
  1703. key: 'obfuscateNode',
  1704. value: function obfuscateNode(catchClauseNode) {
  1705. this.storeCatchClauseParam(catchClauseNode);
  1706. this.replaceCatchClauseParam(catchClauseNode);
  1707. }
  1708. }, {
  1709. key: 'storeCatchClauseParam',
  1710. value: function storeCatchClauseParam(catchClauseNode) {
  1711. var _this2 = this;
  1712. estraverse.traverse(catchClauseNode.param, {
  1713. leave: function leave(node) {
  1714. return _this2.storeIdentifiersNames(node, _this2.catchClauseParam);
  1715. }
  1716. });
  1717. }
  1718. }, {
  1719. key: 'replaceCatchClauseParam',
  1720. value: function replaceCatchClauseParam(catchClauseNode) {
  1721. var _this3 = this;
  1722. estraverse.replace(catchClauseNode, {
  1723. leave: function leave(node, parentNode) {
  1724. _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.catchClauseParam);
  1725. }
  1726. });
  1727. }
  1728. }]);
  1729. return CatchClauseObfuscator;
  1730. }(NodeObfuscator_1.NodeObfuscator);
  1731. exports.CatchClauseObfuscator = CatchClauseObfuscator;
  1732. /***/ },
  1733. /* 33 */
  1734. /***/ function(module, exports, __webpack_require__) {
  1735. "use strict";
  1736. "use strict";
  1737. 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; }; }();
  1738. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1739. 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; }
  1740. 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; }
  1741. var estraverse = __webpack_require__(3);
  1742. var NodeType_1 = __webpack_require__(2);
  1743. var NodeObfuscator_1 = __webpack_require__(5);
  1744. var NodeUtils_1 = __webpack_require__(1);
  1745. var FunctionDeclarationObfuscator = function (_NodeObfuscator_1$Nod) {
  1746. _inherits(FunctionDeclarationObfuscator, _NodeObfuscator_1$Nod);
  1747. function FunctionDeclarationObfuscator() {
  1748. var _Object$getPrototypeO;
  1749. _classCallCheck(this, FunctionDeclarationObfuscator);
  1750. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  1751. args[_key] = arguments[_key];
  1752. }
  1753. var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(FunctionDeclarationObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
  1754. _this.functionName = new Map();
  1755. return _this;
  1756. }
  1757. _createClass(FunctionDeclarationObfuscator, [{
  1758. key: "obfuscateNode",
  1759. value: function obfuscateNode(functionDeclarationNode, parentNode) {
  1760. if (parentNode.type === NodeType_1.NodeType.Program) {
  1761. return;
  1762. }
  1763. this.storeFunctionName(functionDeclarationNode);
  1764. this.replaceFunctionName(functionDeclarationNode);
  1765. }
  1766. }, {
  1767. key: "storeFunctionName",
  1768. value: function storeFunctionName(functionDeclarationNode) {
  1769. var _this2 = this;
  1770. estraverse.traverse(functionDeclarationNode.id, {
  1771. leave: function leave(node) {
  1772. return _this2.storeIdentifiersNames(node, _this2.functionName);
  1773. }
  1774. });
  1775. }
  1776. }, {
  1777. key: "replaceFunctionName",
  1778. value: function replaceFunctionName(functionDeclarationNode) {
  1779. var _this3 = this;
  1780. var scopeNode = NodeUtils_1.NodeUtils.getBlockScopeOfNode(functionDeclarationNode);
  1781. estraverse.replace(scopeNode, {
  1782. enter: function enter(node, parentNode) {
  1783. _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.functionName);
  1784. }
  1785. });
  1786. }
  1787. }]);
  1788. return FunctionDeclarationObfuscator;
  1789. }(NodeObfuscator_1.NodeObfuscator);
  1790. exports.FunctionDeclarationObfuscator = FunctionDeclarationObfuscator;
  1791. /***/ },
  1792. /* 34 */
  1793. /***/ function(module, exports, __webpack_require__) {
  1794. "use strict";
  1795. "use strict";
  1796. 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; }; }();
  1797. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1798. 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; }
  1799. 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; }
  1800. var estraverse = __webpack_require__(3);
  1801. var NodeObfuscator_1 = __webpack_require__(5);
  1802. var FunctionObfuscator = function (_NodeObfuscator_1$Nod) {
  1803. _inherits(FunctionObfuscator, _NodeObfuscator_1$Nod);
  1804. function FunctionObfuscator() {
  1805. var _Object$getPrototypeO;
  1806. _classCallCheck(this, FunctionObfuscator);
  1807. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  1808. args[_key] = arguments[_key];
  1809. }
  1810. var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(FunctionObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
  1811. _this.functionParams = new Map();
  1812. return _this;
  1813. }
  1814. _createClass(FunctionObfuscator, [{
  1815. key: 'obfuscateNode',
  1816. value: function obfuscateNode(functionNode) {
  1817. this.storeFunctionParams(functionNode);
  1818. this.replaceFunctionParams(functionNode);
  1819. }
  1820. }, {
  1821. key: 'storeFunctionParams',
  1822. value: function storeFunctionParams(functionNode) {
  1823. var _this2 = this;
  1824. functionNode.params.forEach(function (paramsNode) {
  1825. estraverse.traverse(paramsNode, {
  1826. leave: function leave(node) {
  1827. return _this2.storeIdentifiersNames(node, _this2.functionParams);
  1828. }
  1829. });
  1830. });
  1831. }
  1832. }, {
  1833. key: 'replaceFunctionParams',
  1834. value: function replaceFunctionParams(functionNode) {
  1835. var _this3 = this;
  1836. var replaceVisitor = {
  1837. leave: function leave(node, parentNode) {
  1838. _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.functionParams);
  1839. }
  1840. };
  1841. functionNode.params.forEach(function (paramsNode) {
  1842. estraverse.replace(paramsNode, replaceVisitor);
  1843. });
  1844. estraverse.replace(functionNode.body, replaceVisitor);
  1845. }
  1846. }]);
  1847. return FunctionObfuscator;
  1848. }(NodeObfuscator_1.NodeObfuscator);
  1849. exports.FunctionObfuscator = FunctionObfuscator;
  1850. /***/ },
  1851. /* 35 */
  1852. /***/ function(module, exports, __webpack_require__) {
  1853. "use strict";
  1854. "use strict";
  1855. 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; };
  1856. 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; }; }();
  1857. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1858. 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; }
  1859. 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; }
  1860. var escodegen = __webpack_require__(11);
  1861. var NodeObfuscator_1 = __webpack_require__(5);
  1862. var Nodes_1 = __webpack_require__(8);
  1863. var LiteralObfuscator = function (_NodeObfuscator_1$Nod) {
  1864. _inherits(LiteralObfuscator, _NodeObfuscator_1$Nod);
  1865. function LiteralObfuscator() {
  1866. _classCallCheck(this, LiteralObfuscator);
  1867. return _possibleConstructorReturn(this, Object.getPrototypeOf(LiteralObfuscator).apply(this, arguments));
  1868. }
  1869. _createClass(LiteralObfuscator, [{
  1870. key: 'obfuscateNode',
  1871. value: function obfuscateNode(literalNode, parentNode) {
  1872. if (Nodes_1.Nodes.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  1873. return;
  1874. }
  1875. if (literalNode['x-verbatim-property']) {
  1876. return;
  1877. }
  1878. var content = void 0;
  1879. switch (_typeof(literalNode.value)) {
  1880. case 'boolean':
  1881. content = this.replaceLiteralBooleanWithJSFuck(literalNode.value);
  1882. break;
  1883. case 'number':
  1884. content = this.replaceLiteralNumberWithHexadecimalValue(literalNode.value);
  1885. break;
  1886. case 'string':
  1887. content = this.replaceLiteralValueWithUnicodeValue(literalNode.value);
  1888. break;
  1889. default:
  1890. return;
  1891. }
  1892. literalNode['x-verbatim-property'] = {
  1893. content: content,
  1894. precedence: escodegen.Precedence.Primary
  1895. };
  1896. }
  1897. }]);
  1898. return LiteralObfuscator;
  1899. }(NodeObfuscator_1.NodeObfuscator);
  1900. exports.LiteralObfuscator = LiteralObfuscator;
  1901. /***/ },
  1902. /* 36 */
  1903. /***/ function(module, exports, __webpack_require__) {
  1904. "use strict";
  1905. "use strict";
  1906. 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; };
  1907. 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; }; }();
  1908. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1909. 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; }
  1910. 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; }
  1911. var escodegen = __webpack_require__(11);
  1912. var estraverse = __webpack_require__(3);
  1913. var NodeType_1 = __webpack_require__(2);
  1914. var NodeObfuscator_1 = __webpack_require__(5);
  1915. var Nodes_1 = __webpack_require__(8);
  1916. var MemberExpressionObfuscator = function (_NodeObfuscator_1$Nod) {
  1917. _inherits(MemberExpressionObfuscator, _NodeObfuscator_1$Nod);
  1918. function MemberExpressionObfuscator() {
  1919. _classCallCheck(this, MemberExpressionObfuscator);
  1920. return _possibleConstructorReturn(this, Object.getPrototypeOf(MemberExpressionObfuscator).apply(this, arguments));
  1921. }
  1922. _createClass(MemberExpressionObfuscator, [{
  1923. key: 'obfuscateNode',
  1924. value: function obfuscateNode(memberExpressionNode) {
  1925. var _this2 = this;
  1926. estraverse.replace(memberExpressionNode.property, {
  1927. leave: function leave(node, parentNode) {
  1928. if (Nodes_1.Nodes.isLiteralNode(node)) {
  1929. _this2.obfuscateLiteralProperty(node);
  1930. return;
  1931. }
  1932. if (Nodes_1.Nodes.isIdentifierNode(node)) {
  1933. if (memberExpressionNode.computed) {
  1934. return;
  1935. }
  1936. memberExpressionNode.computed = true;
  1937. _this2.obfuscateIdentifierProperty(node);
  1938. }
  1939. }
  1940. });
  1941. }
  1942. }, {
  1943. key: 'obfuscateIdentifierProperty',
  1944. value: function obfuscateIdentifierProperty(node) {
  1945. var nodeValue = node.name,
  1946. literalNode = {
  1947. raw: '\'' + nodeValue + '\'',
  1948. 'x-verbatim-property': {
  1949. content: this.replaceLiteralValueWithUnicodeValue(nodeValue),
  1950. precedence: escodegen.Precedence.Primary
  1951. },
  1952. type: NodeType_1.NodeType.Literal,
  1953. value: nodeValue
  1954. };
  1955. delete node.name;
  1956. Object.assign(node, literalNode);
  1957. }
  1958. }, {
  1959. key: 'obfuscateLiteralProperty',
  1960. value: function obfuscateLiteralProperty(node) {
  1961. switch (_typeof(node.value)) {
  1962. case 'string':
  1963. if (node['x-verbatim-property']) {
  1964. break;
  1965. }
  1966. node['x-verbatim-property'] = {
  1967. content: this.replaceLiteralValueWithUnicodeValue(node.value),
  1968. precedence: escodegen.Precedence.Primary
  1969. };
  1970. break;
  1971. default:
  1972. break;
  1973. }
  1974. }
  1975. }]);
  1976. return MemberExpressionObfuscator;
  1977. }(NodeObfuscator_1.NodeObfuscator);
  1978. exports.MemberExpressionObfuscator = MemberExpressionObfuscator;
  1979. /***/ },
  1980. /* 37 */
  1981. /***/ function(module, exports, __webpack_require__) {
  1982. "use strict";
  1983. "use strict";
  1984. 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; }; }();
  1985. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1986. 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; }
  1987. 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; }
  1988. var estraverse = __webpack_require__(3);
  1989. var NodeObfuscator_1 = __webpack_require__(5);
  1990. var Nodes_1 = __webpack_require__(8);
  1991. var Utils_1 = __webpack_require__(0);
  1992. var MethodDefinitionObfuscator = function (_NodeObfuscator_1$Nod) {
  1993. _inherits(MethodDefinitionObfuscator, _NodeObfuscator_1$Nod);
  1994. function MethodDefinitionObfuscator() {
  1995. var _Object$getPrototypeO;
  1996. _classCallCheck(this, MethodDefinitionObfuscator);
  1997. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  1998. args[_key] = arguments[_key];
  1999. }
  2000. var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(MethodDefinitionObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
  2001. _this.ignoredNames = ['constructor'];
  2002. return _this;
  2003. }
  2004. _createClass(MethodDefinitionObfuscator, [{
  2005. key: 'obfuscateNode',
  2006. value: function obfuscateNode(methodDefinitionNode, parentNode) {
  2007. this.replaceMethodName(methodDefinitionNode);
  2008. }
  2009. }, {
  2010. key: 'replaceMethodName',
  2011. value: function replaceMethodName(methodDefinitionNode) {
  2012. var _this2 = this;
  2013. estraverse.replace(methodDefinitionNode.key, {
  2014. leave: function leave(node) {
  2015. if (Nodes_1.Nodes.isIdentifierNode(node) && !Utils_1.Utils.arrayContains(_this2.ignoredNames, node.name) && methodDefinitionNode.computed === false) {
  2016. methodDefinitionNode.computed = true;
  2017. node.name = _this2.replaceLiteralValueWithUnicodeValue(node.name);
  2018. return;
  2019. }
  2020. return estraverse.VisitorOption.Skip;
  2021. }
  2022. });
  2023. }
  2024. }]);
  2025. return MethodDefinitionObfuscator;
  2026. }(NodeObfuscator_1.NodeObfuscator);
  2027. exports.MethodDefinitionObfuscator = MethodDefinitionObfuscator;
  2028. /***/ },
  2029. /* 38 */
  2030. /***/ function(module, exports, __webpack_require__) {
  2031. "use strict";
  2032. "use strict";
  2033. 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; };
  2034. 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; }; }();
  2035. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2036. 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; }
  2037. 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; }
  2038. var escodegen = __webpack_require__(11);
  2039. var estraverse = __webpack_require__(3);
  2040. var NodeType_1 = __webpack_require__(2);
  2041. var NodeObfuscator_1 = __webpack_require__(5);
  2042. var Nodes_1 = __webpack_require__(8);
  2043. var Utils_1 = __webpack_require__(0);
  2044. var ObjectExpressionObfuscator = function (_NodeObfuscator_1$Nod) {
  2045. _inherits(ObjectExpressionObfuscator, _NodeObfuscator_1$Nod);
  2046. function ObjectExpressionObfuscator() {
  2047. _classCallCheck(this, ObjectExpressionObfuscator);
  2048. return _possibleConstructorReturn(this, Object.getPrototypeOf(ObjectExpressionObfuscator).apply(this, arguments));
  2049. }
  2050. _createClass(ObjectExpressionObfuscator, [{
  2051. key: 'obfuscateNode',
  2052. value: function obfuscateNode(objectExpressionNode) {
  2053. var _this2 = this;
  2054. objectExpressionNode.properties.forEach(function (property) {
  2055. estraverse.replace(property.key, {
  2056. leave: function leave(node, parentNode) {
  2057. if (Nodes_1.Nodes.isLiteralNode(node)) {
  2058. _this2.obfuscateLiteralPropertyKey(node);
  2059. return;
  2060. }
  2061. if (Nodes_1.Nodes.isIdentifierNode(node)) {
  2062. _this2.obfuscateIdentifierPropertyKey(node);
  2063. }
  2064. }
  2065. });
  2066. });
  2067. }
  2068. }, {
  2069. key: 'obfuscateLiteralPropertyKey',
  2070. value: function obfuscateLiteralPropertyKey(node) {
  2071. switch (_typeof(node.value)) {
  2072. case 'string':
  2073. if (node['x-verbatim-property']) {
  2074. break;
  2075. }
  2076. node['x-verbatim-property'] = {
  2077. content: Utils_1.Utils.stringToUnicode(node.value),
  2078. precedence: escodegen.Precedence.Primary
  2079. };
  2080. break;
  2081. default:
  2082. break;
  2083. }
  2084. }
  2085. }, {
  2086. key: 'obfuscateIdentifierPropertyKey',
  2087. value: function obfuscateIdentifierPropertyKey(node) {
  2088. var nodeValue = node.name,
  2089. literalNode = {
  2090. raw: '\'' + nodeValue + '\'',
  2091. 'x-verbatim-property': {
  2092. content: Utils_1.Utils.stringToUnicode(nodeValue),
  2093. precedence: escodegen.Precedence.Primary
  2094. },
  2095. type: NodeType_1.NodeType.Literal,
  2096. value: nodeValue
  2097. };
  2098. delete node.name;
  2099. Object.assign(node, literalNode);
  2100. }
  2101. }]);
  2102. return ObjectExpressionObfuscator;
  2103. }(NodeObfuscator_1.NodeObfuscator);
  2104. exports.ObjectExpressionObfuscator = ObjectExpressionObfuscator;
  2105. /***/ },
  2106. /* 39 */
  2107. /***/ function(module, exports, __webpack_require__) {
  2108. "use strict";
  2109. "use strict";
  2110. 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; }; }();
  2111. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2112. 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; }
  2113. 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; }
  2114. var estraverse = __webpack_require__(3);
  2115. var NodeType_1 = __webpack_require__(2);
  2116. var NodeObfuscator_1 = __webpack_require__(5);
  2117. var NodeUtils_1 = __webpack_require__(1);
  2118. var Utils_1 = __webpack_require__(0);
  2119. var VariableDeclarationObfuscator = function (_NodeObfuscator_1$Nod) {
  2120. _inherits(VariableDeclarationObfuscator, _NodeObfuscator_1$Nod);
  2121. function VariableDeclarationObfuscator() {
  2122. var _Object$getPrototypeO;
  2123. _classCallCheck(this, VariableDeclarationObfuscator);
  2124. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  2125. args[_key] = arguments[_key];
  2126. }
  2127. var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(VariableDeclarationObfuscator)).call.apply(_Object$getPrototypeO, [this].concat(args)));
  2128. _this.variableNames = new Map();
  2129. return _this;
  2130. }
  2131. _createClass(VariableDeclarationObfuscator, [{
  2132. key: "obfuscateNode",
  2133. value: function obfuscateNode(variableDeclarationNode, parentNode) {
  2134. if (parentNode.type === NodeType_1.NodeType.Program) {
  2135. return;
  2136. }
  2137. this.storeVariableNames(variableDeclarationNode);
  2138. this.replaceVariableNames(variableDeclarationNode, parentNode);
  2139. }
  2140. }, {
  2141. key: "storeVariableNames",
  2142. value: function storeVariableNames(variableDeclarationNode) {
  2143. var _this2 = this;
  2144. variableDeclarationNode.declarations.forEach(function (declarationNode) {
  2145. estraverse.traverse(declarationNode.id, {
  2146. enter: function enter(node) {
  2147. return _this2.storeIdentifiersNames(node, _this2.variableNames);
  2148. }
  2149. });
  2150. });
  2151. }
  2152. }, {
  2153. key: "replaceVariableNames",
  2154. value: function replaceVariableNames(variableDeclarationNode, variableParentNode) {
  2155. var _this3 = this;
  2156. var scopeNode = variableDeclarationNode.kind === 'var' ? NodeUtils_1.NodeUtils.getBlockScopeOfNode(variableDeclarationNode) : variableParentNode,
  2157. isNodeAfterVariableDeclaratorFlag = false;
  2158. estraverse.replace(scopeNode, {
  2159. enter: function enter(node, parentNode) {
  2160. var functionNodes = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression];
  2161. if (Utils_1.Utils.arrayContains(functionNodes, node.type)) {
  2162. estraverse.replace(node, {
  2163. enter: function enter(node, parentNode) {
  2164. _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.variableNames);
  2165. }
  2166. });
  2167. }
  2168. if (node === variableDeclarationNode) {
  2169. isNodeAfterVariableDeclaratorFlag = true;
  2170. }
  2171. if (isNodeAfterVariableDeclaratorFlag) {
  2172. _this3.replaceIdentifiersWithRandomNames(node, parentNode, _this3.variableNames);
  2173. }
  2174. }
  2175. });
  2176. }
  2177. }]);
  2178. return VariableDeclarationObfuscator;
  2179. }(NodeObfuscator_1.NodeObfuscator);
  2180. exports.VariableDeclarationObfuscator = VariableDeclarationObfuscator;
  2181. /***/ },
  2182. /* 40 */
  2183. /***/ function(module, exports) {
  2184. module.exports = require("chance");
  2185. /***/ },
  2186. /* 41 */
  2187. /***/ function(module, exports) {
  2188. module.exports = require("child_process");
  2189. /***/ },
  2190. /* 42 */
  2191. /***/ function(module, exports) {
  2192. module.exports = require("commander");
  2193. /***/ },
  2194. /* 43 */
  2195. /***/ function(module, exports) {
  2196. module.exports = require("fs");
  2197. /***/ },
  2198. /* 44 */
  2199. /***/ function(module, exports) {
  2200. module.exports = require("mkdirp");
  2201. /***/ },
  2202. /* 45 */
  2203. /***/ function(module, exports) {
  2204. module.exports = require("path");
  2205. /***/ }
  2206. /******/ ]);
  2207. //# sourceMappingURL=index.js.map