Skip to content

Commit

Permalink
obfuscator: Support old version of SelfDefending and DebugProtection (#…
Browse files Browse the repository at this point in the history
…49)

Signed-off-by: echo094 <[email protected]>
  • Loading branch information
echo094 authored Oct 18, 2023
1 parent c6b7283 commit b632986
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/plugin/obfuscator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1143,8 +1143,17 @@ const deleteSelfDefendingCode = {
return
}
const block = generator(args[1]).code
const pattern = `return${selfName}.toString().search().toString().constructor(${selfName}).search()`
if (!checkPattern(block, pattern)) {
const patterns = [
// @7920538
`return${selfName}.toString().search().toString().constructor(${selfName}).search()`,
// @7135b09
`const=function(){const=.constructor()return.test(${selfName})}return()`,
]
let valid = false
for (let pattern of patterns) {
valid |= checkPattern(block, pattern)
}
if (!valid) {
return
}
const refs = path.scope.bindings[selfName].referencePaths
Expand Down Expand Up @@ -1205,14 +1214,21 @@ const deleteDebugProtectionCode = {
continue
}
if (ref.key == 0) {
// DebugProtectionFunctionInterval
// DebugProtectionFunctionInterval @e8e92c6
const rm = ref.getFunctionParent().parentPath
rm.remove()
continue
}
// DebugProtectionFunctionCall
// ref.key == 'callee'
const up1 = ref.getFunctionParent()
const callName = up1.parent.callee.name
if (callName === 'setInterval') {
// DebugProtectionFunctionInterval @51523c0
const rm = up1.parentPath
rm.remove()
continue
}
// DebugProtectionFunctionCall
const up2 = up1.getFunctionParent().parentPath
const scope2 = up2.scope.getBinding(callName).scope
up2.remove()
Expand Down

0 comments on commit b632986

Please sign in to comment.