PyJSClear
Pure Python JavaScript deobfuscator for malware analysis and security automation.
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 transforms in a multi-pass loop until the code stabilizes (default limit: 50 iterations). A final one-shot pass renames variables and converts var/let to const.
Capabilities:
- Whole-file encoding detection: JSFuck, JJEncode, AAEncode, eval-packing
- 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 / >50K AST nodes) automatically use a lite mode that skips expensive transforms.
Limitations
- Best results on obfuscator.io output. JSFuck, JJEncode, AAEncode, and eval-packed code are fully decoded; 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.
- Very deep AST nesting — traversal automatically falls back from recursion to an iterative strategy at depth thresholds, but pathologically deep inputs may still produce partial results.
License
Apache License 2.0 — see LICENSE.
This project is a derivative work based on obfuscator-io-deobfuscator (Apache 2.0), javascript-deobfuscator (Apache 2.0), and webcrack (MIT). See THIRD_PARTY_LICENSES.md and NOTICE for full attribution.
Test samples include obfuscated JavaScript from the JSIMPLIFIER dataset (GPL-3.0) and the Obfuscated JavaScript Dataset, used solely for evaluation purposes.
Metadata
Release files for pyjsclear 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyjsclear-0.1.7.tar.gz | 114.8 kB | Without provenance | Details for pyjsclear-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyjsclear-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for pyjsclear-0.1.7-py3-none-any.whl |
Total release size: 246.0 kB
Release files / pyjsclear-0.1.7.tar.gz
| Download URL | pyjsclear-0.1.7.tar.gz |
|---|---|
| Size | 114.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47080346022f12aa4ac0787b400d76736c7ab328a00232404a2d725a020c0dc5
|
|
BLAKE2b-256 checksum How to use checksums |
ea822b601d81e83dd08d4713087a55ce83e24bea9d7fe6fc839b3a614ca874a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pyjsclear-0.1.7-py3-none-any.whl
| Download URL | pyjsclear-0.1.7-py3-none-any.whl |
|---|---|
| Size | 131.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6ecf77af348c2478108f468b9110c22a0add1aeba9b402808f97779124ecc64
|
|
BLAKE2b-256 checksum How to use checksums |
4e7457ce303c27d1305ad1df5242afe40423cc3d9448a9d57d5850b4d9b42df0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for pyjsclear 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.