Skip to main content

PyJSClear

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjsclear-0.1.7.tar.gz (114.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyjsclear-0.1.7-py3-none-any.whl (131.2 kB view details)

Uploaded Python 3

File details

Details for the file pyjsclear-0.1.7.tar.gz.

File metadata

  • Download URL: pyjsclear-0.1.7.tar.gz
  • Upload date:
  • Size: 114.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyjsclear-0.1.7.tar.gz
Algorithm Hash digest
SHA256 47080346022f12aa4ac0787b400d76736c7ab328a00232404a2d725a020c0dc5
MD5 7f5f1c5e4d6c687ea0751a4c6291755b
BLAKE2b-256 ea822b601d81e83dd08d4713087a55ce83e24bea9d7fe6fc839b3a614ca874a2

See more details on using hashes here.

File details

Details for the file pyjsclear-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pyjsclear-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 131.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyjsclear-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c6ecf77af348c2478108f468b9110c22a0add1aeba9b402808f97779124ecc64
MD5 95485c07a0aaddd9cb2d76fca90c43f7
BLAKE2b-256 4e7457ce303c27d1305ad1df5242afe40423cc3d9448a9d57d5850b4d9b42df0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page