Skip to content

Commit 70b6715

Browse files
authored
obfuscator: update stringArrayV2 to support rotate function before 2.10.0 (#61)
Signed-off-by: echo094 <20028238+echo094@users.noreply.github.com>
1 parent 15db164 commit 70b6715

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/plugin/obfuscator.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,13 @@ function stringArrayV2(ast) {
123123
return
124124
}
125125
const arr = callee.node.params[0].name
126-
// const cmpV = callee.node.params[1].name
127-
const fp = `(){try{if()break${arr}push(${arr}shift())}catch(){${arr}push(${arr}shift())}}`
126+
const cmpV = callee.node.params[1].name
127+
// >= 2.10.0
128+
const fp1 = `(){try{if()break${arr}push(${arr}shift())}catch(){${arr}push(${arr}shift())}}`
129+
// < 2.10.0
130+
const fp2 = `const=function(){while(--){${arr}push(${arr}shift)}}${cmpV}`
128131
const code = '' + callee.get('body')
129-
if (!checkPattern(code, fp)) {
132+
if (!checkPattern(code, fp1) && !checkPattern(code, fp2)) {
130133
return
131134
}
132135
obj.stringArrayName = args[0].name

0 commit comments

Comments
 (0)