How can I obfuscate (protect) my ionic (hybrid mobile app) project from reverse engneering/decompile?

5.1k views Asked by At

I want to Securing a PhoneGap/Cordova Ionic Hybrid Mobile App from reverse engneering/decompile apk/ipa to source code.

What are the tools available for obfuscation? please suggest

2

There are 2 answers

0
Priyank On BEST ANSWER

Finally Got the answer of my query:

Javascript Obfuscator converts the JavaScript source code into obfuscated and completely unreadable form, preventing it from analysing and theft. It's a 100% safe JavaScript minifier and the best JavaScript compressor. It supports all the hybrid mobile apps.

Use This Link and download the GUI to protect JavaScript source code into obfuscated code

4
Manoj Bhardwaj On

If you want secure your Ionic app from reverse-engineering and fully secure your source code, I recommended two steps:

First use Enable ProGuard into your cordova/ionic project

  1. To implement this, open /platforms/android/project.properties and uncomment this line by removing the # at left: #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard- project.txt
  2. Copy this proguard-custom.txt file to android/assets/www/proguard-custom.txt and remove the '#' at the beginning of these lines:
    #-keepclassmembers class android.webkit.WebView {
    # public *;
    # }
    
  3. Add this snippet to build.gradle:
    buildTypes {
        debug {
            minifyEnabled true
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    

Second, install cordova-plugin-crypt-file to obfuscate or encrypt your code:

  1. Install: cordova plugin add cordova-plugin-crypt-file
  2. Update plugins/cordova-plugin-crypt-file/plugin.xml:
    //Using Reference of cordova-plugin-crypt
    <cryptfiles>
       <include>
         <file regex="\.(htm|html|js|css)$" />
      </include>
      <exclude>
        <file regex="exclude_file\.js$" />
      </exclude>
    </cryptfiles>
    

Final step:

ionic cordova build android --release

Now extract your apk or try an APK decompiler.