Coder Social home page Coder Social logo

enigma's Introduction

Enigma

Gradle Plugin - Obfuscator Strings Encryption (Android/Java)

This project is a simple Gradle plugin to help you to encrypt all String values of your Android Java code at the compilation time.

Important: Enigma plugin won't execute if your project is not managed by a SCM tool such as git or SVN.

Recommended: commit your changes before compile your app with Enigma activated

Links:

How integrate it?

First of all, be sure that a SCM is initialized in your project, such as Git for example:

$ cd /path/of/your/project/
$ git init
$ git add .
$ git commit -m "Initial commit"

build.gradle (project)

buildscript {
  repositories {
    google()
    jcenter()
    // Add Maven repo
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {     
    classpath 'com.android.tools.build:gradle:3.5.2'
    // Add the Enigma classpath
    classpath 'gradle.plugin.chrisney:enigma:1.0.0.8'
  }
}

build.gradle (app)

apply plugin: 'com.android.application'

// Add Enigma Plugin
apply plugin: 'com.chrisney.enigma'

// Set Enigma options:
enigma.enabled = true
enigma.injectFakeKeys = true
enigma.ignoredClasses = ["com.my.packagename.MainActivity.java"]

android {
    buildTypes {
        release {
            // Don't forget to enable ProGuard !
            minifyEnabled true
        }
    }
}

Compile your App

During the compilation process, Enigma plugin will:

  • Backup all Java files in backup directory enigma-backup
  • Parse your code and encrypt all String values for each Java file
  • Inject Enigma source code (encryption code)
  • Inject fake secrete keys (optional - check enigma.injectFakeKeys option)
  • Compile your App (classic process)
  • Restore your original Java files
$ ./gradlew assembleRelease
> Task :app:backup
๐Ÿ’พ Backup: /app/src/main/java/com/app/helloworld/MainActivity.java
๐Ÿ’พ Backup: /app/src/main/java/com/app/helloworld/helpers/IResponse.java
๐Ÿ’พ Backup: /app/src/main/java/com/app/helloworld/helpers/Utils.java
๐Ÿ’พ Backup: /app/src/main/java/com/app/helloworld/helpers/ATest.java
๐Ÿ’พ Backup: /app/src/main/java/com/app/helloworld/helpers/TestImpl.java
๐Ÿ’พ Backup: /app/src/main/java/com/app/helloworld/Constants.java

> Task :app:encrypt
๐Ÿ” MainActivity.java encrypted
๐Ÿ” IResponse.java encrypted
๐Ÿ” Utils.java encrypted
๐Ÿ” ATest.java encrypted
๐Ÿ” TestImpl.java encrypted
๐Ÿ” Constants.java encrypted

> Task :app:injectCode
โœ๏ธ Add Enigma code

> Task :app:restore
โ™ป๏ธ Restore: /app/src/main/java/com/proto/helloworld/MainActivity.java
โ™ป๏ธ Restore: /app/src/main/java/com/app/helloworld/helpers/IResponse.java
โ™ป๏ธ Restore: /app/src/main/java/com/app/helloworld/helpers/Utils.java
โ™ป๏ธ Restore: /app/src/main/java/com/app/helloworld/helpers/ATest.java
โ™ป๏ธ Restore: /app/src/main/java/com/app/helloworld/helpers/TestImpl.java
โ™ป๏ธ Restore: /app/src/main/java/com/app/helloworld/Constants.java
๐Ÿงน Remove Enigma code: ~/HelloWorld/app/src/main/java/com/app

Options

Bellow the options of Enigma plugin:

  • enigma.enabled (true | false) : Enable or disable the string encryption process (default: true)
  • enigma.injectFakeKeys (true | false) : if activated, create fake string keys and injected it into your code (default: true)
  • enigma.hash (string) : let you define your own encryption key (32 characters recommended)
  • enigma.classes (array of strings) : let you defined the only classes to encrypt
  • enigma.ignoredClasses (array of strings): define the classes to not encrypt
  • enigma.srcJava (string): root path of your JAVA files (default: /app/src/main/java)

Unit Tests

The JAVA parser is unit tested with more than 300 complex JAVA classes:

enigma's People

Contributors

chris-ney avatar christopherney avatar

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.