Link Search Menu Expand Document

Obfuscate Your JS Code using CLI Option - Demo


In this video, we’ll obfuscate one js file using the command line option provided by the JavaScript-Obfuscator tool. A JavaScript Obfuscator is a powerful and open-source obfuscator tool that also provides the option to obfuscate your js files using the command line. In this video, we’ll use PowerShell to obfuscate our js file.

Welcome back to the third session of the series, How to Obfuscate JavaScript Code. In this session, we will install the JavaScript Obfuscatory tool globally. Then we will obfuscate the JS file using the command line option which this tool provides. To obfuscate a JS file, we will use this (javascript-obfuscator <Original.js> –output <Changed.js>) command using the command line option.

 

In this demo application, we had obfuscated these CommonOperation.js files using node.js in the previous session. Now once again, we will obfuscate these JS files, but this time using the command line option. Before that, let’s install the JavaScript Obfuscator tool globally. To install that tool press Shift+ Mouse right click and click ‘Open Powershell window here’ option which will open the PowerShell window.

JS Demo Coding Tutorial

Now to install the JavaScript Obfuscator tool, we will again use the same NPM command. As I want to install this tool globally, I am going to use this (npm install -g javascript-obfuscator) option then press enter. After installing the JavaScript-Obfuscator tool successfully, I am now listing the file of the demo application.

As I said, to obfuscate the CommonOperation.js file, I have to use the command-line option. I need to specify the input JS file which is a CommonOperation.js in our case. In the output option, I need to specify the new filename which contains the obfuscated code for this JS file. When I press the enter key, here you can see the new obfuscated JS file is generated.

JS Demo Code

Before I open the file, let me explain something regarding this command line. Here the output option is optional. If you have not specified this option, then the newly generated obfuscated file will be generated with this (CommonOperation-obfuscated.js) name.

Open the obfuscated file. You can see that our newly generated obfuscated file is really hard to read and understand. But one thing is clear that this is totally a valid code. This is how you can obfuscate your JS file using the command line option provided by 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