The deobfuscation pipeline uses jscodeshift to perform multiple AST (Abstract Syntax Tree) transformations on bet365’s obfuscated JavaScript. The process is automated but understanding each step helps when bet365 updates their obfuscation techniques.
bet365 frequently updates their obfuscation patterns. This project maintains multiple transformation scripts (numbered 0-10) to handle different obfuscation techniques.
Each script is tested with corresponding .test.js files.
The transformation scripts are modular. You can add new transformations by creating refactor-obfuscated-code-jscodeshift-11.js and importing it into the chain.
Use AST Explorer to understand JavaScript AST structure:
Paste obfuscated code in the left panel
Select “JavaScript” → “esprima” or “recast” as the parser
Select “jscodeshift” as the transformer
Write transformation code in the transform panel
AST Explorer is invaluable for prototyping new transformations. Once you have working code, copy it into a new refactor-obfuscated-code-jscodeshift-*.js file.
# Run the interception./mitmproxy.sh# Navigate to bet365 in the proxied browser# Save the obfuscated codepython mitmproxy/src/python/save_obfuscated_code.py
2
Compare with previous versions
# List historical obfuscated filesls -lh mitmproxy/src/javascript/obfuscated/# Use a diff tool to comparediff -u mitmproxy/src/javascript/obfuscated/previous.js \ mitmproxy/src/javascript/obfuscated-new-raw.js
3
Identify the new pattern
Look for:
New obfuscation wrapper functions
Changed variable name patterns
New control flow obfuscation techniques
Additional string encoding layers
4
Update transformations
Create or modify transformation scripts to handle the new pattern, then test:
npm test # Run all tests# Test manuallynode mitmproxy/src/javascript/refactor-obfuscated-code-jscodeshift.js \ mitmproxy/src/javascript/obfuscated-new-raw.js \ test-output.js