7

Protect Your JavaScript Code with Obfuscation Tool

 2 years ago
source link: https://joets.medium.com/protect-your-javascript-code-with-obfuscation-tool-50a0155fa49c
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Protect Your JavaScript Code with Obfuscation Tool

A simple method to prevent people from stealing your work.

Photo by Clint Patterson on Unsplash

Nowadays, getting access and extracting JavaScript codes from any website becomes very easy with just a common web browser. In this article, I would like to introduce a code Obfuscation tool that modifies your code in a way that is impossible for hackers to understand but is still fully functional and executable.

For example:

After Obfuscating:

Wow, now the script looks much more complex.
But, after testing on the browser dev-tool, they give the same result on the web browser!!

Using JavaScript Obfuscator Directly on the Web Tool.

URL: https://obfuscator.io/

This tool is an online web service where you can just copy&paste your code and you would get the Obfuscated version instantly. This tool would fit if you would just need a quick Obfuscator for your small project.

Install Obfuscator as a Module/Middleware Package

You can simply install the package with Yarn or NPM and add it to your dependencies. Feel free to check the full commands at https://obfuscator.io/

$ npm install --save-dev javascript-obfuscator
or
$ yarn add --dev javascript-obfuscator

As an example in Node.js application, you can load the JSObfuscator as a module and pass your script as a script to be obfuscated as an example below:

Or, you can install the obfuscator directly into your automated workflow or CI/CD pipelines. These are some examples:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK