Installation Issues
Node.js Version Mismatch
Problem: Node.js version incompatible
Problem: Node.js version incompatible
.nvmrc:Python Dependencies Failed
Problem: pip install fails
Problem: pip install fails
- miniforge/miniconda installed
- Python 3.12
npm Update Required
Problem: Outdated npm version
Problem: Outdated npm version
mitmproxy Issues
mitmproxy Not Starting
Problem: mitmproxy fails to start
Problem: mitmproxy fails to start
./mitmproxy.sh.Solutions:- Verify mitmproxy is installed:
- Check Python environment is activated:
- Ensure port 8080 is not in use:
- Run mitmproxy with verbose logging:
Browser Not Using Proxy
Problem: Browser not routing through mitmproxy
Problem: Browser not routing through mitmproxy
- Navigate to any HTTPS site
- You should see a certificate warning (first time)
- mitmproxy should show requests in the console
- Using existing Chrome instance (close all Chrome windows first)
- Not specifying
--user-data-dir(Chrome won’t use proxy without it) - Firewall blocking localhost:8080
Certificate Errors
Problem: SSL certificate errors in browser
Problem: SSL certificate errors in browser
- Start mitmproxy
- Navigate to
http://mitm.it - Download and install the certificate for your platform
- Restart the browser
Code Interception Issues
Obfuscated Code Not Captured
Problem: No files generated in /output directory
Problem: No files generated in /output directory
- Check mitmproxy is intercepting requests:
- Verify the filter is working:
- Check file detection logic:
- bet365 may have changed their URL structure - update the filter
- Obfuscated code signature may have changed - update
obfuscated_start_string - Clear browser cache and reload
Wrong Code Version Intercepted
Problem: Different obfuscated code than expected
Problem: Different obfuscated code than expected
- Location (IP address)
- Time (periodic rotation)
- User agent
- Random distribution
- Save the new version:
- Update your transforms to handle the new patterns:
- All obfuscated versions are tracked in:
Deobfuscation Issues
Transform Errors
Problem: refactor-obfuscated-code-jscodeshift.js crashes
Problem: refactor-obfuscated-code-jscodeshift.js crashes
- Syntax Error in Input:
- Transform Bug:
- Memory Issues:
Invalid JavaScript Output
Problem: Deobfuscated code is not valid JavaScript
Problem: Deobfuscated code is not valid JavaScript
node --check fails.Diagnostics:- Validate each transform step:
- Identify the problematic transform:
- Review the failing transform’s logic
- Check if it handles all edge cases
- Use AST Explorer to verify replacement patterns
- Add additional guards to prevent invalid replacements
Variable Renaming Conflicts
Problem: Renamed variables cause conflicts
Problem: Renamed variables cause conflicts
refactorVariables mapping.Solution:Review the variable mapping in refactor-obfuscated-code-jscodeshift-2.js:Runtime Issues
DevTools Detection
Problem: bet365 detects debugging
Problem: bet365 detects debugging
tapeKeywords[27269]changes- Timing differences
- Console API modifications
- Use remote debugging:
- Monitor via log files instead:
- Disable detection code in transformed output (educational purposes only)
Webdriver Detection
Problem: bet365 detects automated browsers
Problem: bet365 detects automated browsers
- Use mitmproxy with a real browser session
- For data scraping, prefer WebSocket connections (more efficient)
- Future work will focus on WebSocket reverse engineering
Cache Issues
Problem: Changes not reflected in browser
Problem: Changes not reflected in browser
- Clear all cache:
- Use Clear Cache extension:
- Install from Chrome Web Store
- Bind to keyboard shortcut
- Clear cache before each test
- Disable cache in DevTools:
- Open DevTools
- Network tab → Disable cache checkbox
- (But remember this triggers detection)
Development Workflow Issues
watchexec Not Working
Problem: Auto-recompilation not triggering
Problem: Auto-recompilation not triggering
- Install watchexec:
- Verify pattern matching:
- Check for file system issues:
Output Directory Permissions
Problem: Cannot write to /output directory
Problem: Cannot write to /output directory
Performance Issues
Slow Transformation
Problem: Deobfuscation takes too long
Problem: Deobfuscation takes too long
- Disable intermediate output in production:
- Profile transforms:
- Pre-compute transformations:
- Use
refactor_script_on_fly = False - Manually generate
deobfuscated.jsonce - Serve the cached version
- Optimize transform logic:
- Avoid redundant AST traversals
- Use more specific node queries
- Cache intermediate results
High Memory Usage
Problem: Node.js runs out of memory
Problem: Node.js runs out of memory
FATAL ERROR: Reached heap limit Allocation failedSolutions:Testing Issues
Jest Tests Failing
Problem: npm test fails
Problem: npm test fails
- Verify Babel configuration:
- Clear Jest cache:
- Run specific test:
Unknown Issues
Getting Help
If you encounter an issue not covered here:Gather Information
- Error messages (full stack trace)
- Node.js version:
node --version - Python version:
python --version - Operating system
- Steps to reproduce
Common Error Messages
”oldString not found in content”
Cause: The Edit tool couldn’t find the exact string to replace. Solution: Check for whitespace differences, ensure you’re reading the file first, and verify the string exists.”Cannot find module”
Cause: Missing Node.js dependency. Solution:“EADDRINUSE: address already in use”
Cause: Port 8080 already in use. Solution:“SyntaxError: Unexpected token”
Cause: Invalid JavaScript input or output from transform. Solution: Validate at each step usingnode --check filename.js
