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.6.tar.gz (113.6 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.6-py3-none-any.whl (129.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyjsclear-0.1.6.tar.gz
Algorithm Hash digest
SHA256 48de79d7c4dcd2a92195d93d69ab98bdd30b18402271204b61b349fcb993eb9a
MD5 c1ba17c25baaadef1feb20113c8a7302
BLAKE2b-256 67d1301dfcc80b3334b896d2fe7e69848bb1de09e3c70c2f6b95276e56e3e1c3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyjsclear-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 93fba8b7f62545e2966b419ef12191b3d7a11d637df67fdf87322d761c7247c1
MD5 e9993bb4b3cf8838a9f07685418d5bf7
BLAKE2b-256 27c6818f968cb0451d48624b2d860b1be2f1670c90adf4f9bf25d775c1d498af

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.7

2 files

This release

0.1.6 This release

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