npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babel-plugin-array-reveal

v1.0.0

Published

A babel plugin to deobfuscate array-based JavaScript obfuscation

Downloads

58

Readme

babel-plugin-array-reveal

Table of Contents

Overview

The ArrayReveal Babel Plugin was developed to simplify and automate the process of deobfuscating low-level JavaScript obfuscations based on shuffled arrays and indexing functions. This type of obfuscation, which we will refer to as Array-Index Obfuscation, is commonly encountered in basic anti-bot scripts and simple website JavaScript code. Examples of this obfuscation structure include:

Example Structures

Obfuscated Code:

function YA() {
  var A = ["obfuscatedValue1", "obfuscatedValue2", "..."];
  return (YA = function () { return A; })();
}

function dB(index) {
  var arr = YA();
  return arr[index - 270];
}

console.log(dB(270)); // "obfuscatedValue1"

Deobfuscated Code:

console.log("obfuscatedValue1");

This plugin was created to eliminate the need for manual deobfuscation or repetitive custom function writing, allowing you to focus on higher-level tasks.

Why This Plugin?

While deobfuscating a large number of files, this pattern repeatedly appeared in low-level scripts, especially in basic anti-bot mechanisms or obfuscated web assets. By automating the process, this plugin saves significant time.

Note: For more advanced obfuscations, such as PerimeterX scripts with multiple interdependent array-based obfuscations (e.g., 10-15 instances), additional custom logic will be required to track associations and calls, as this plugin assumes a single array-obfuscation per script.

Installation

Install the plugin using npm:

npm install babel-plugin-array-reveal --save-dev

Usage

Via Babel Configuration

Add the plugin to your Babel configuration file (babel.config.js or .babelrc):

module.exports = {
  plugins: ["babel-plugin-array-reveal"]
};

Run Babel to deobfuscate your script:

npx babel input.js --out-file output.js

Directly in Your Script

You can also use the plugin programmatically:

const babel = require("@babel/core");
const arrayReveal = require("babel-plugin-array-reveal");

const code = `/* your obfuscated JavaScript code here */`;
const output = babel.transform(code, {
  plugins: [arrayReveal]
});

console.log(output.code);

Limitations

The plugin is designed for low-level obfuscations and assumes a single array-based obfuscation per script. Advanced scripts with multiple layers of obfuscation may require manual intervention or additional tooling.

Use the Web App

If you prefer not to set up an environment, use the web app version of ArrayReveal to quickly deobfuscate your code. Simply paste your obfuscated code into the interface, and the app will process it using the same core logic.

Check it out on array-reveal.com

Credits

Made with ❤️ by @glizzykingdreko sponsord by TakionAPI