Pure Python JavaScript deobfuscator
Project description
PyJSClear
Pure Python JavaScript deobfuscator.
Installation
pip install pyjsclear
For development:
git clone https://github.com/intezer/PyJSClear.git
cd PyJSClear
pip install -e .
pip install pytest
Usage
Python API
from pyjsclear import deobfuscate, deobfuscate_file
# From a string
cleaned = deobfuscate(obfuscated_code)
# From a file
deobfuscate_file("input.js", "output.js")
# Or get the result as a string
cleaned = deobfuscate_file("input.js")
Command line
# File to stdout
pyjsclear input.js
# File to file
pyjsclear input.js -o output.js
# Stdin to stdout
cat input.js | pyjsclear -
# With custom iteration limit
pyjsclear input.js --max-iterations 20
What it does
PyJSClear applies ~40 transforms in a multi-pass loop until the code stabilises (default limit: 50 iterations). A final one-shot pass renames variables and converts var/let to const.
Capabilities:
- String array decoding (obfuscator.io basic/base64/RC4, XOR, class-based)
- Constant propagation & reassignment elimination
- Dead code / dead branch / unreachable code removal
- Control-flow unflattening (switch-dispatch recovery)
- Proxy function & proxy object inlining
- Expression simplification & modern syntax recovery (?., ??)
- Anti-tamper / anti-debug removal
- Variable renaming (_0x… → readable names)
Large files (>500 KB / >50 K AST nodes) automatically use a lite mode that skips expensive transforms.
Testing
pytest tests/ # all tests
pytest tests/test_regression.py # regression suite (62 tests across 25 samples)
pytest tests/ -n auto # parallel execution (requires pytest-xdist)
Limitations
- Optimised for obfuscator.io output. Other obfuscation tools may only partially deobfuscate.
- Large files get reduced treatment. Files >500 KB or ASTs >50 K nodes skip expensive transforms; files >2 MB use a minimal lite mode.
- No minification reversal. Minified-but-not-obfuscated code won't be reformatted or beautified.
- Recursive AST traversal may hit Python's default recursion limit (~1 000 frames) on extremely deep nesting.
License
Apache License 2.0 — see LICENSE.
This project is a derivative work based on obfuscator-io-deobfuscator (Apache 2.0) and javascript-deobfuscator (Apache 2.0). See THIRD_PARTY_LICENSES.md and NOTICE for full attribution.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyjsclear-0.1.2.tar.gz.
File metadata
- Download URL: pyjsclear-0.1.2.tar.gz
- Upload date:
- Size: 87.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7494f0f0bceaa907406261eb1d9a0ed3a9391735c59f19246780aea193d5beaa
|
|
| MD5 |
74e35c18f41e386ed37ebba01c14095a
|
|
| BLAKE2b-256 |
8423894529ace087861128ed82f16ffe2b7c414253bb08075c3f7dd40b4042e1
|
File details
Details for the file pyjsclear-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyjsclear-0.1.2-py3-none-any.whl
- Upload date:
- Size: 101.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60e65aef1d40eb5f8522b040bf925b55bef75d9d27bf654f12740e22d9200ebc
|
|
| MD5 |
6100620e297fc897d66d190b95992caf
|
|
| BLAKE2b-256 |
850d564f4ccfb8e93e4c46005ff990e47527887546d1fca3dab7b655ce268225
|