瀏覽代碼

selfDefending template for unicode array calls wrapper

sanex3339 8 年之前
父節點
當前提交
c89a9202c9

+ 6 - 4
dist/index.js

@@ -88,7 +88,7 @@ module.exports =
 /******/ 	__webpack_require__.p = "";
 /******/
 /******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(__webpack_require__.s = 86);
+/******/ 	return __webpack_require__(__webpack_require__.s = 87);
 /******/ })
 /************************************************************************/
 /******/ ([
@@ -4195,13 +4195,14 @@ exports.SelfDefendingTemplate = SelfDefendingTemplate;
 
 /***/ },
 /* 72 */
-/***/ function(module, exports) {
+/***/ function(module, exports, __webpack_require__) {
 
 "use strict";
 "use strict";
 
+var Utils_1 = __webpack_require__(0);
 function SelfDefendingTemplate() {
-    return "\n        \n    ";
+    return "\n        var StatesClass = function (rc4Bytes) {\n            this.rc4Bytes = rc4Bytes;\n            this.states = [1, 0, 0];\n            this.newState = function(){return 'newState';};\n            this.firstState = " + Utils_1.Utils.stringToUnicode("\\w+ *\\(\\) *{\\w+ *") + ";\n            this.secondState = " + Utils_1.Utils.stringToUnicode("['|\"].+['|\"];? *}") + ";\n        };\n        \n        StatesClass.prototype.checkState = function () {\n            var regExp = new RegExp(this.firstState + this.secondState);\n\n            return this.runState(regExp.test(this.newState.toString()) ? --this.states[1] : --this.states[0]);\n        };\n        \n        StatesClass.prototype.runState = function (stateResult) {\n            if (!Boolean(~stateResult)) {\n                return stateResult;\n            }\n            \n            return this.getState(this.rc4Bytes);\n        };\n\n        StatesClass.prototype.getState = function (rc4Bytes) {\n            for (var i = 0, len = this.states.length; i < len; i++) {\n                this.states.push(Math.round(Math.random()));\n                len = this.states.length;\n            }\n            \n            return rc4Bytes(this.states[0]);\n        };\n\n        new StatesClass({unicodeArrayCallsWrapperName}).checkState();\n    ";
 }
 exports.SelfDefendingTemplate = SelfDefendingTemplate;
 
@@ -4323,7 +4324,8 @@ module.exports = require("fs");
 module.exports = require("mkdirp");
 
 /***/ },
-/* 86 */
+/* 86 */,
+/* 87 */
 /***/ function(module, exports, __webpack_require__) {
 
 "use strict";

+ 33 - 0
src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/SelfDefendingTemplate.ts

@@ -1,8 +1,41 @@
+import { Utils } from '../../../../Utils';
+
 /**
  * @returns {string}
  */
 export function SelfDefendingTemplate (): string {
     return `
+        var StatesClass = function (rc4Bytes) {
+            this.rc4Bytes = rc4Bytes;
+            this.states = [1, 0, 0];
+            this.newState = function(){return 'newState';};
+            this.firstState = ${Utils.stringToUnicode(`\\w+ *\\(\\) *{\\w+ *`)};
+            this.secondState = ${Utils.stringToUnicode(`['|"].+['|"];? *}`)};
+        };
         
+        StatesClass.prototype.checkState = function () {
+            var regExp = new RegExp(this.firstState + this.secondState);
+
+            return this.runState(regExp.test(this.newState.toString()) ? --this.states[1] : --this.states[0]);
+        };
+        
+        StatesClass.prototype.runState = function (stateResult) {
+            if (!Boolean(~stateResult)) {
+                return stateResult;
+            }
+            
+            return this.getState(this.rc4Bytes);
+        };
+
+        StatesClass.prototype.getState = function (rc4Bytes) {
+            for (var i = 0, len = this.states.length; i < len; i++) {
+                this.states.push(Math.round(Math.random()));
+                len = this.states.length;
+            }
+            
+            return rc4Bytes(this.states[0]);
+        };
+
+        new StatesClass({unicodeArrayCallsWrapperName}).checkState();
     `;
 }

+ 0 - 1
test/dev/dev.ts

@@ -71,7 +71,6 @@ if (!(<any>global)._babelPolyfill) {
         {
             disableConsoleOutput: false,
             unicodeArrayEncoding: 'rc4',
-            domainLock: ['google.ru'],
             selfDefending: true
         }
     ).getObfuscatedCode();