Skip to content

Commit

Permalink
feat: strong remove option
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizuo committed Dec 1, 2023
1 parent f482fe2 commit 64bd6f1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
4 changes: 4 additions & 0 deletions website/components/OuputOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ watchEffect(() => {
<div p-4 w-30vw>
<div flex="~ col gap-2" text-base w-full>
<label class="inline-flex items-center gap-2">
<span class="flex-1">强力清除(会对解混淆后的代码再次执行,慎用)</span>
<input v-model="options.isStrongRemove" type="checkbox">
</label>
<label class="inline-flex items-center gap-2">
<span class="flex-1">执行解密函数</span>
调用次数
Expand Down
3 changes: 3 additions & 0 deletions website/composables/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const error = shallowRef<unknown>()
export const parseTime = ref(0)

export interface Options {
/** 是否强力清除 */
isStrongRemove: boolean
/** 解密函数调用次数 */
decryptFnCallCount: number
/** 是否执行解密操作 */
Expand Down Expand Up @@ -42,6 +44,7 @@ export interface Options {
}

const defaultOptions: Options = {
isStrongRemove: false,
decryptFnCallCount: 150,
isDecryptFnEnabled: true,
isRemoveDecryptFn: true,
Expand Down
55 changes: 31 additions & 24 deletions website/utils/deobfuscator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,45 @@ self.addEventListener(
},
})

deob.splitMultipleDeclarations()
const process = (deob: Deob) => {
deob.splitMultipleDeclarations()

if (options.isDecryptFnEnabled) {
deob.nestedFnReplace()
deob.findDecryptFnByCallCount(options.decryptFnCallCount, options.isRemoveDecryptFn)
}
if (options.isDecryptFnEnabled) {
deob.nestedFnReplace()
deob.findDecryptFnByCallCount(options.decryptFnCallCount, options.isRemoveDecryptFn)
}

for (let i = 1; i <= options.execCount; i++) {
deob.saveAllObject()
deob.objectMemberReplace()
deob.switchFlat()
}
for (let i = 1; i <= options.execCount; i++) {
deob.saveAllObject()
deob.objectMemberReplace()
deob.switchFlat()
}

// 最后通用处理
if (options.isCalcBinaryEnable)
deob.calcBinary()

// 最后通用处理
if (options.isCalcBinaryEnable)
deob.calcBinary()
if (options.isReplaceConstantEnable)
deob.replaceConstant()

if (options.isReplaceConstantEnable)
deob.replaceConstant()
if (options.isRemoveUnusedBlock)
deob.removeUnusedBlock()
if (options.isRemoveUnusedVariables)
deob.removeUnusedVariables()

if (options.isRemoveUnusedBlock)
deob.removeUnusedBlock()
if (options.isRemoveUnusedVariables)
deob.removeUnusedVariables()
deob.selfCallFnReplace()

deob.selfCallFnReplace()
if (options.deleteExtraEnable)
deob.deleteExtra()

if (options.isMarkEnable)
deob.markComment(options.keywords)
}

if (options.deleteExtraEnable)
deob.deleteExtra()
process(deob)

if (options.isMarkEnable)
deob.markComment(options.keywords)
if (options.isStrongRemove)
process(deob)

const output = deob.getCode()

Expand Down

0 comments on commit 64bd6f1

Please sign in to comment.