Giter Site home page Giter Site logo

jsobfuscator's Introduction

JSObfuscator

Open in Visual Studio Code VersionInstallsRating

Features

This extension will obfuscate and minify your JavaScript code to make it more secure.

Note

Once the code gets obfuscated you cannot revert it to it's original state. For best use, use this before deployment of your code.

Commands

JSObfuscator : Obfuscate Current Workspace

This command will go through and obfuscate all the js files in your current Workspace. See settings for options to limit which files will be obfuscated.

JSObfuscator : Obfuscate Current File

This command will obfuscate the file you currently have open. This requires you to have saved this file before obfuscating it. This command will also ignore the settings Ignore Min Files and Files To Ignore

Note

By default code pages will be saved as a new file with their extension changed to .min.js and by default existing files will not be overwriten.

Usage

Press Ctrl+Shift+P and search for JSObfuscator: Obfuscate Current Workspace to obfuscate your current Workspace recursively or search for JSObfuscator: Obfuscate Current File to obfuscate the current file. You have to have saved the current file before you can obfuscate it.

Preview

Settings

Change File Extension

Default: obfuscated.js
Description: Save the file with a new extension after obfuscating. For example if you put obfuscated.js the file would be changed from test.js to test.obfuscated.js. But, if you try to obfuscating test.obfuscated.js this file will be skipped.

Files To Ignore

Default:
Description: Enter comma separated list of file names to be ignored

Ignore Min Files

Default: true
Description: When processing the Workspace to obfuscate all js files do you want to ignore files with the extension .min.js NOTE: This option is ignored when processing a single file.

Overwrite Existing Files

Default: false
Description: When saving the obfuscated file if a file of the same name exists overwrite it with the obfuscated file.

Sub Path In Workspace

Default:
Description: Specified some relative path where you only want to Obfuscate JavaScript.

JavaScript-obfuscator

Default:

{
    "compact": true,
    "controlFlowFlattening": true,
    "deadCodeInjection": false,
    "debugProtection": false,
    "debugProtectionInterval": false,
    "disableConsoleOutput": true,
    "identifierNamesGenerator": "hexadecimal",
    "log": false,
    "renameGlobals": false,
    "rotateStringArray": true,
    "selfDefending": true,
    "shuffleStringArray": true,
    "splitStrings": false,
    "stringArray": true,
    "stringArrayEncoding": false,
    "stringArrayThreshold": 0.75,
    "unicodeEscapeSequence": false
}

Description: Enter options to be passed into javascript-obfuscator see the javascript-obfuscator documentation
Note: This needs to be done by editing your settings.json file. Here is an example of a settings.json file for just the JSObfuscator plugin.

{
    "JSObfuscator" : {
        "changeExtension": "min.js",
        "filesToIgnore": "",
        "ignoreMinFiles": true,
        "javascript-obfuscator": {
            "compact": true,
            "controlFlowFlattening": true,
            "deadCodeInjection": false,
            "debugProtection": false,
            "debugProtectionInterval": false,
            "disableConsoleOutput": true,
            "identifierNamesGenerator": "hexadecimal",
            "log": false,
            "renameGlobals": false,
            "rotateStringArray": true,
            "selfDefending": true,
            "shuffleStringArray": true,
            "splitStrings": false,
            "stringArray": true,
            "stringArrayEncoding": false,
            "stringArrayThreshold": 0.75,
            "unicodeEscapeSequence": false
        },
        "overwriteExistingFiles" : false,
        "subPathInWorkspace": ""
    } 
}

⚠ Important

Only obfuscate code that belongs to you

It is not recommended to obfuscate vendor scripts and polyfills, since the obfuscated code is 15-80% slower (depending on options) and the files are significantly larger.

Dependencies

This extension use JavaScript obfuscator

TODO

  • Update gif in Usage

Github & Issues

Feel free to modify/change or create a new better version using this Repo. If you find any issues you can report Here.

Write a review if this plugin helps you out anyhow

Enjoy! 🤗

jsobfuscator's People

Contributors

softheroes avatar subhamtnk11 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jsobfuscator's Issues

Module import doesn't seem to obfuscate

Hey Guys, please find code below. It obfuscates fine unless I comment out the module import statement. That line doesn't seem to obfuscate. Thanks for letting me know what the issue is.
Many thanks and great work, love the tool!

export default class Test {
    myMethod() {
        (async () => {
            //The below line fails to obfuscate. If you comment it out, the file obfuscates fine.
            const myModule = await import('some path to a JS module');
        })();   
    }
}

Add option to auto obfuscate to vscode extension

Hay Thanks for nice work.

It would be better if there will be the option to auto obfuscate to .min.js or any other specific sub extension while saving the JS file in vscode extension.

In this way fresh copy of code will be automatically secured and .min.js will be created when we save the .js file same like js minification system.

Regards.

Nothing happens

I installed the extension in VSCode and nothing happens when I have a js file open and click to obfuscate the current file.
I also installed Javascript Obfuscator through npm, restarted VSCode, and still nothing happens. This is on Ubunto 20.04.

Error

installed it into VS Code and just tried running it didn't change anything yet and I get this
any idea why?

image

Also when I run current work place I get this
image

Error in Obfuscating Current File

Hi, I'm having error when obfuscating the current open file.
Here is the error message from VSCode:
image

Here is my settings:
image

JSObfuscator version: v1.3.2
VSCode version:
Version: 1.51.1 (user setup)
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19041

Internet links text no being obfuscated in Visual Studio Code.

I started to use this extension for VS Code because I already know the online one at https://obfuscator.io.
I am experimenting one problem, when there are some http links in js file, because the obfuscated code stil retain the string of the http links.

for example, if I have this:

["TEST", "https://test.com/levelone/index.html", "images/channel.png", "0"]

The https://test.com/levelone/index.html will not be obfuscated.
I tried the same files at the address of the original obfuscator and it works fine, obfuscating even these addresses.
I opied the configuration parameters at that site (for the Options Preset High), but still not working.

My VSCode configuration is:

"[JSObfuscator]": {
    "changeExtension"      : "obf.js",
    "filesToIgnore"        : "",
    "ignoreMinFiles"       : true,
    "javascript-obfuscator": {
        "optionPreset"                         : "high",
        "target"                               : "browser",
        "seed"                                 : 0,
        "compact"                              : true,
        "controlFlowFlattening"                : true,
        "controlFlowFlatteningThreshold"       : 1,
        "deadCodeInjection"                    : true,
        "deadCodeInjectionThreshold"           : 1,
        "debugProtection"                      : true,
        "debugProtectionInterval"              : true,
        "disableConsoleOutput"                 : true,
        "identifierNamesGenerator"             : "hexadecimal",
        "log"                                  : false,
        "numbersToExpressions"                 : true,
        "renameGlobals"                        : true,
        "renameProperties"                     : true,
        "renamePropertiesMode"                 : "safe",
        "rotateStringArray"                    : true,
        "selfDefending"                        : true,
        "simplify"                             : true,
        "shuffleStringArray"                   : true,
        "splitStrings"                         : true,
        "splitStringsChunkLength"              : 5,            
        "stringArray"                          : true,
        "stringArrayEncoding"                  : ["rc4"],
        "stringArrayIndexShift"                : true,
        "stringArrayIndexesType"               : "hexadecimal",
        "stringArrayRotate"                    : true,
        "stringArrayShuffle"                   : true,
        "stringArrayWrappersCount"             : 5,
        "stringArrayWrappersChainedCalls"      : true,
        "stringArrayWrappersParametersMaxCount": 5,
        "stringArrayWrappersType"              : "function",
        "stringArrayThreshold"                 : 1,
        "transformObjectKeys"                  : true,
        "unicodeEscapeSequence"                : false
    },
    "overwriteExistingFiles": false,
    "subPathInWorkspace"    : ""
}

Any help would be apreciated.

Cannot read property 'appendLine' of undefined:

I'm trying to obfuscate a javascript file, es6 but nothing happens and that is the log

[2021-03-24 10:46:52.858] [renderer1] [error] Cannot read property 'appendLine' of undefined: TypeError: Cannot read property 'appendLine' of undefined at /home/xxxx/.vscode/extensions/softheroes.jsobfuscator-1.3.2/extension.js:102:32 at fs.js:1347:7 at FSReqCallback.oncomplete (fs.js:160:23)

i installed extension on Linux from Flatpak

Extension didnt want to run. Problem was that outName = filePathOnly + '\\' + fileName was building invalid path begining with \/..... so i changed code a little bit to check if two begining characters of path are \/ and deleting first char if its true:

outName = filePathOnly + '\\' + fileName
if (outName.charAt(0) === "\\" && outName.charAt(1) === "\/") {
outName = outName.substring(1);
}

Now extension is working and i think it will work on Windows too. Just inform U about issue and how i resolved it simple. I made a fork and pull request. Test it on windows if that works...

Can't obfuscate file with static member

Can't obfuscate file with static member.
Like this

class Test {
static instance = null;
get getInstance() {
if (Test.insatnce == null) {
Test.instance = new Test();
}
return Test.instance;
}
constructor() { }
}

The line

static instance = null;

Stop the obfuscate process

No obfuscated file is created in Code 1.51.1

The issue still persists, no file is created when obfuscating a JS file is v1.3.2

Version: 1.51.1
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-11T01:11:34.018Z (2 wks ago)
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 20.1.0

Cannot install in Visual Studio as Extension

Visual Studio Market Place "No items found for search items(s): JSObfuscator"

Also cannot install from vsix file

Browser error when clic install button: "Failed to launch 'vscode:extension/SoftHeroes.JSObfuscator' because the scheme does not have a registered handler"

this extension still works in visual studio?

Any help would be apreciated

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.