抽离混淆关键函数:

    混淆处理 - 图1

    把混淆的关键函数,换成node.js参数传参的格式:

    混淆处理 - 图2

    写替换脚本,对所有类似CZ(0X495)的文本统统替换成真实函数,比如:

    e.g:

    1. import re
    2. import subprocess
    3. def exec_value(hex_string):
    4. res = subprocess.check_output(f"node part.js {hex_string}")
    5. char_string = res.decode('utf-8').strip()
    6. return char_string
    7. def run():
    8. with open("f1.js", mode='r', encoding='utf-8') as f1, open("f2.js", mode='w', encoding='utf-8') as f2:
    9. for line in f1:
    10. if not line:
    11. f2.write(line)
    12. continue
    13. match_list = re.findall(r"(QC\((.*?)\))", line)
    14. for total, arg in match_list:
    15. real_value = exec_value(arg)
    16. line = line.replace(total, f'"{real_value}"')
    17. f2.write(line)
    18. if __name__ == '__main__':
    19. run()