Skip to main content
This guide walks you through setting up everything needed to reverse engineer bet365’s obfuscated JavaScript.

Prerequisites

Before you begin, ensure you have the following installed:
  • miniforge/miniconda - For Python environment management
  • nvm - For Node.js version management
  • Google Chrome - For browser-based testing
Using a fresh Conda environment is recommended to avoid dependency conflicts with your existing Python setup.

Python Environment Setup

1

Create a new Python 3.12 environment

Run the automated setup script to create and activate a new Conda environment:
source new-conda-environment.sh
This script will:
  • Create a new Conda environment named bet365-re-js with Python 3.12
  • Activate the environment
  • Automatically install pip dependencies
If you prefer to use your existing Python environment, you can skip this step, but be aware of potential dependency conflicts.
2

Install Python dependencies manually (if needed)

If you skipped the Conda environment creation or need to reinstall dependencies:
./python-dependencies.sh
This installs the following key dependencies:
  • mitmproxy - For intercepting and modifying HTTP traffic
  • jsbeautifier - For formatting JavaScript output
  • rjsmin - For minifying JavaScript
  • playwright - For automated browser testing
  • pytest - For running tests
The requirements are located in mitmproxy/src/python/requirements-test.txt, which includes both core and testing dependencies.

Node.js Setup

1

Verify Node.js installation

Check if Node.js is installed:
node --version
The project currently uses Node.js v22.15.0 (specified in .nvmrc).
2

Install Node.js via nvm (if needed)

If Node.js is not installed, use nvm to install the correct version:
nvm install $(cat .nvmrc) && nvm use
This reads the version from .nvmrc and automatically installs and activates it.
3

Update npm

Ensure you’re using the latest npm version:
npm update -g npm
4

Install Node.js dependencies

Install all required npm packages:
npm install
Key dependencies include:
  • jscodeshift - For AST-based JavaScript transformations
  • escodegen - For generating JavaScript code from AST
  • recast - For parsing and pretty-printing JavaScript
  • babel-jest & jest - For testing transformations

Environment Verification

After completing the setup, verify everything is working:
python --version
# Expected output: Python 3.12.x

Directory Structure

Your environment should have these key directories:
.
├── mitmproxy/
│   └── src/
│       ├── python/          # Python scripts for interception
│       └── javascript/       # Deobfuscation transforms
├── output/                   # Intercepted files appear here
├── chrome-profile/           # Isolated Chrome profile (created on first run)
└── node_modules/             # Node dependencies
The output/ directory is automatically created when you run mitmproxy and will contain all intercepted and deobfuscated JavaScript files.

Troubleshooting

Conda Environment Not Found

If conda activate bet365-re-js fails:
conda init bash  # or zsh, depending on your shell
# Restart your terminal
conda activate bet365-re-js

Node Version Mismatch

If you’re using a different Node version:
nvm use
# This will automatically switch to the version in .nvmrc

Permission Issues

If you encounter permission errors with the shell scripts:
chmod +x *.sh
chmod +x mitmproxy.sh

Next Steps

Now that your environment is set up, you can:

Build docs developers (and LLMs) love