whoami-shubham / obfuscator-io-metro-plugin

A metro plugin to use the javascript-obfuscator library with react-native to obfuscate the bundle after the build.
https://www.npmjs.com/package/obfuscator-io-metro-plugin
MIT License
63 stars 17 forks source link

Doesn't seem to make any impact on the bundle files #6

Closed Mubashirkhan closed 2 years ago

Mubashirkhan commented 2 years ago

i have used this module with my react-native project to obfuscate the code in the bundle files but doesn't seems to change anything specially in the case of ios my main.jsbundle file remains the same

my metro.config.json file

const jsoMetroPlugin = require("obfuscator-io-metro-plugin")(
    {
        // for these option look javascript-obfuscator library options from  above url
        compact: false,
        controlFlowFlattening: true,
        controlFlowFlatteningThreshold: 1,
        numbersToExpressions: true,
        shuffleStringArray: true,
        simplify: true,
        sourceMap: true,
        splitStrings: true,
        stringArrayThreshold: 1,
    },
    {
        runInDev: false /* optional */,
    }
);

module.exports = {
    transformer: {
        getTransformOptions: async () => ({
            transform: {
                experimentalImportSupport: false,
                inlineRequires: false,
            },
        }),
    },
    ...jsoMetroPlugin,
};
Mubashirkhan commented 2 years ago

more importantly is there a way or setting to obfuscate json files

whoami-shubham commented 2 years ago

Hi @Mubashirkhan have you checked this https://github.com/whoami-shubham/obfuscator-io-metro-plugin/issues/2

Mubashirkhan commented 2 years ago

@whoami-shubham can't seem to find the ram-bundle / bundle option in my build phases which i mentioned in this thread

Screenshot 2022-02-08 at 1 11 38 PM

danielbcarvalho commented 2 years ago

Hello @Mubashirkhan , have you find a way or setting to obfuscate json files?

Thanks.

muhammadarsal commented 2 years ago

Hello... I am also unable to find ram-bundle option as mentioned by @Mubashirkhan Any idea?

whoami-shubham commented 2 years ago

Hi @danielbcarvalho you can check after changing regex in EXTS in constant file https://github.com/whoami-shubham/obfuscator-io-metro-plugin/blob/master/lib/constants.js#L11

whoami-shubham commented 2 years ago

try with this regex /(.(j|t)s(x)?$|.json$)/i , if it works then please create a PR

whoami-shubham commented 2 years ago

try version 2.1.0 https://www.npmjs.com/package/obfuscator-io-metro-plugin/v/2.1.0 , it might work for JSON obfuscation

whoami-shubham commented 2 years ago

closing this due to no activity.