Link Search Menu Expand Document

Obfuscate JS Code - Demo


In this video, we’ll obfuscate one js file using this JavaScript Obfuscator tool. A JavaScript Obfuscator is a powerful and open-source obfuscator tool that obfuscates your js files using node.js. We’ll write one node js code to obfuscate our js file using this tool.

In this session, we will obfuscate one JS file using the JavaScript Obfuscator tool. It is a very powerful and open-source obfuscator tool. We obfuscate your JS file using the NODE DOT JS. We will write one Node JS code to obfuscate our JS files using this tool. For the demo, I have created one HTML page and there is also one JS file that contains one function validating email addresses.

I have added this JS file reference to this HTML page and called the valid email address function. If the email address is valid, then I’m logging that message in the console. If the email is invalid, then we will get this (Invalid Email Address) message and if the email is valid, then we’ll get this (Valid Email Address) message.

JS Demo

Before we go ahead, first we need to install the Javascript Obfuscator tool in this application.  Click on the Terminal menu and click on New Terminal. Now to install the Javascript Obfuscator I need to write a command (npm install javascript-obfuscator) and click enter. You can see that our Javascript Obfuscator tool is installed. Close the terminal and you can see all the related node modules in this folder.

I want to obfuscate these JS files using this tool. Write NODE JS code in the (ObfuscaterUtil.js) file. In the Js file, you can see that I have already referenced the file system module. I have already referenced our newly installed JavaScript Obfuscator tool in this variable. Read the CommonOperation.js file using this [fs = require (“fs”)] file system reference module. We will get the obfuscated code in this (obfuscateResult) variable.

We need to write this (obfuscateResult) variable content into a separate JS file. That’s our newly generated JS filename: fs.writeFile(’./CommonOperation.Obfuscated.js). Then we get the obfuscated code from this (obfuscateResult) variable. Then define the callback function. Our code is ready and it’s time to run the code.

JS Demo Coding

Again open the Terminal and write the command (node obfuscateUtil.js) then press enter. You can see that we are successfully able to generate our newly obfuscated JS file. Open the JS file, you can see the newly generated obfuscated file is really hard to read and interpret. But this is a totally valid code.

To confirm this, let’s reference this newly generated obfuscated JS file. If we run the file then we are able to get this (Obsfuscate your JS using JabaScript Obsfuscate) message. If I enter the wrong email ID, then we are getting an invalid email address. In short, this newly generated, obfuscated file is totally a valid code. This is how you can generate the obfuscated JS file using the JavaScript Obfuscator tool.

For more videos and articles visit:

👉 GET YOUR FREE API KEY for PDF.co

https://app.pdf.co/signup?utm_source=youtube

✅ ON-PREMISE SDK FREE TRIAL:

https://bytescout.com/download/web-installer?utm_source=youtube

🔎 SDK DOCUMENTATION:

https://bytescout.com/documentation/

🔑 WEB API DOCUMENTATION :

https://pdf.co/rest-web-api