Skip to content

Commit 516c7d2

Browse files
committed
OpaquePredicates prepare
1 parent 588ca62 commit 516c7d2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/plugin/jsconfuser.js

+31
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,35 @@ const deStringConcealing = {
12041204
},
12051205
}
12061206

1207+
/**
1208+
* Template:
1209+
* ```javascript
1210+
* // This is defined in the glocal space
1211+
* var predicateName = (function () {
1212+
* var tempName = {
1213+
* prop_array_1: [],
1214+
* prop_array: function (paramName = 'length') {
1215+
* if (!predicateName[prop_array_1][0]) {
1216+
* predicateName[prop_array_1][0].push(rand1)
1217+
* }
1218+
* return predicateName[prop_array_1][paramName]
1219+
* },
1220+
* prop_number: rand2,
1221+
* prop_string: rand_str,
1222+
* }
1223+
* return tempName
1224+
* })()
1225+
* // Below will appear multiple times
1226+
* predicateName[prop_array]() ? test : fake
1227+
* predicateName[prop_number] > rand3 ? test : fake
1228+
* predicateName[prop_string].charAt(index) == real_char ? test : fake
1229+
* predicateName[prop_string].charCodeAt(index) == real_char ? test : fake
1230+
* ```
1231+
*/
1232+
const deOpaquePredicates = {
1233+
MemberExpression(path) {},
1234+
}
1235+
12071236
module.exports = function (code) {
12081237
let ast
12091238
try {
@@ -1227,6 +1256,8 @@ module.exports = function (code) {
12271256
traverse(ast, deStringConcealing)
12281257
// StringSplitting
12291258
traverse(ast, calculateConstantExp)
1259+
// OpaquePredicates
1260+
traverse(ast, deOpaquePredicates)
12301261
code = generator(ast, {
12311262
comments: false,
12321263
jsescOption: { minimal: true },

0 commit comments

Comments
 (0)