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
62 stars 17 forks source link

Check whether this library works for iOS apps #2

Closed whoami-shubham closed 2 years ago

whoami-shubham commented 2 years ago

It works for android apps. Just wanted to confirm whether it works for iOS apps. steps to test.

andresarezo commented 2 years ago

Hi,

Just wanted to let you know this warning when make an archive in xcode:

warning: Obfuscation SKIPPED [Not a bundle command]

Seems it's not working on iOS.

Regards

whoami-shubham commented 2 years ago

@andresarezo Thanks for checking this. Could you please tell me what was the options that you passed.

andresarezo commented 2 years ago

Hi,

I figure out that if I change in xcode -> build Pahses and change ram-bundle to bundle under "Bundle React Native code.."

The warning still showing but the main.jsbundle it's obfuscated!!!

andresarezo commented 2 years ago

Im passing this config:

const jsoMetroPlugin = require('obfuscator-io-metro-plugin')( { compact: false, sourceMap: true, controlFlowFlattening: true, controlFlowFlatteningThreshold: 1, numbersToExpressions: true, simplify: true, shuffleStringArray: true, splitStrings: true, stringArrayThreshold: 1, }, { runInDev: true, logObfuscatedFiles: true / generated files will be located at ./.jso /, } );

And it's working on iOS.

Sounds good for you?

whoami-shubham commented 2 years ago

Yes. Thanks I will add this in readme file.

houmie commented 1 year ago

@whoami-shubham I would love to verify if this works for iOS. How did you decompile .ipa file to extract the .ios.bundle file, please?

@andresarezo May you please elaborate a bit more on your findings? Under build-phases of a react-Native iOS project, I can't see "Bundle React Native code".

And where do you paste this code?

const jsoMetroPlugin = require('obfuscator-io-metro-plugin')(
{
compact: false,
sourceMap: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
numbersToExpressions: true,
simplify: true,
shuffleStringArray: true,
splitStrings: true,
stringArrayThreshold: 1,
},
{
runInDev: true,
logObfuscatedFiles: true /* generated files will be located at ./.jso */,
}
);

Thanks

aamir-ds commented 1 year ago

Its still not fixed @whoami-shubham

aamir-ds commented 1 year ago

it is generating .jso folder with obfuscated code in it but after creating .ipa file its not showing obfuscated code in main.jsbundle file. Do I need to make some changes in Build phases Bundle React native code & images?

I am passing this config: const jsoMetroPlugin = require("obfuscator-io-metro-plugin")( { compact: true, controlFlowFlattening: false, deadCodeInjection: false, debugProtection: false, debugProtectionInterval: 0, disableConsoleOutput: false, identifierNamesGenerator: 'hexadecimal', log: false, numbersToExpressions: false, renameGlobals: false, selfDefending: false, simplify: true, splitStrings: false, stringArray: true, stringArrayCallsTransform: false, stringArrayCallsTransformThreshold: 0.5, stringArrayEncoding: [], stringArrayIndexShift: true, stringArrayRotate: true, stringArrayShuffle: true, stringArrayWrappersCount: 1, stringArrayWrappersChainedCalls: true, stringArrayWrappersParametersMaxCount: 2, stringArrayWrappersType: 'variable', stringArrayThreshold: 0.75, unicodeEscapeSequence: false }, { runInDev: true / optional /, logObfuscatedFiles: true / optional generated files will be located at ./.jso /, } );

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