Giter Site home page Giter Site logo

christopherney / enigma Goto Github PK

View Code? Open in Web Editor NEW
155.0 155.0 25.0 309 KB

Gradle Plugin - Obfuscator String Encryption (Android/Java)

License: MIT License

Groovy 4.99% Java 95.01%
android android-application encrypt encryption gradle gradle-plugin java obfuscation obfuscator proguard security string-encryption

enigma's People

Contributors

chris-ney avatar christopherney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

enigma's Issues

Fake Key injection does not function for singleton enum classes

Looking at the source and tracing down what is happening, the Java Parser doesn't know to treat top-level enum classes as a ClassBlock. Since fake injection requires a class block in the array, it fails to pass and thus nothing is actually injected to the class.

I have a singleton handler for secrets in my test example in a class HiddenTreasure.java

This class starts as:

public enum HiddenTreasure {
INSTANCE;

public static final String key = "akfjakgjag";
public static final String iv = "akfkjakgthg";

This is a valid class to provide fake values on, but nothing is added since the parser does not think it can. I do wonder why there is a separate parser to determine things like classes or functions vs just using the reflection API, but this is still an issue regardless. I can address it locally by modifying the class I am 'enigmafying', but it is still a gap in the full solution.

Could not find gradle.plugin.chrisney:enigma:1.0.0.8.

Hi there,

I have initialised my app with Github in Android Studio by going to VCS / Import into Version Control / Share Project on GitHub.
I have never done that but I hope that this is ok.
After implementing the described information I get the following error:

Could not find gradle.plugin.chrisney:enigma:1.0.0.8.
Searched in the following locations:

Do you have an idea?
I am looking forward to your reply!

Doesn't recognize source code management if in a sub folder of repository

I have a number of android projects in one large repository. When I attempted to use enigma in one of these projects, I get the message:

?? The project has no Source Code Management. Please setup one (Git, SVN, Mercurial) before use Enigma plugin!

Android Studio clearly shows that I am using Git and am on the androidx_enigma branch.

Is there a way to get enigma to work in this case? Any help would be appreciated.

Gradle's dependency cache may be corrupt

org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to org.codehaus.groovy.ast.expr.ArgumentListExpression
org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to org.codehaus.groovy.ast.expr.ArgumentListExpression

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

We try all possible solutions but it's not working, please help us to resolve this issue.

Plugin not applying to modules except app even if the build.gradle of the module has plugin entry

I have added this plugin to a project which has 2 modules, one app and another library type.

The plugin is only accessing app module, and not the library module, even though the plugin was added to library's build.gradle by specifying: apply plugin: 'com.chrisney.enigma' and enigma.enabled = true .

Project level build.gradle:

buildscript {
    
    repositories {
        google()
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'

        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'gradle.plugin.chrisney:enigma:1.0.0.8'
    }
}

library's module level build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.chrisney.enigma'

enigma.enabled = true

android {
    compileSdkVersion 29

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 6
        versionName "3.3"

//        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    def room_version = "2.2.5"

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "androidx.work:work-runtime:2.4.0"
    implementation "com.google.code.gson:gson:2.8.6"

    //room
    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version"
    testImplementation "android.arch.persistence.room:testing:$room_version"

    testImplementation 'junit:junit:4.13.1'
//    androidTestImplementation 'androidx.test:runner:1.3.0-rc01'
//    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc01'
}

app module's build.gradle was not changed.

When running assemble, I can see the app's java files getting encrypted but not the module's:

11:57:12: Executing task 'assemble'...

Executing tasks: [assemble] in project E:\xxxxxxx\xxxxxxxxx\xxxxx   // masking personal info here

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE

> Task :<library module's name here>:backup                                  // masking personal info here
? Backup: \app\src\main\java\xxx\xxx\xxx\MainActivity.java
? Backup: \app\src\main\java\xxx\xxx\xxx\MyFirebaseMessagingService.java

> Task :<library module's name here>:encrypt
? MainActivity.java encrypted
? MyFirebaseMessagingService.java encrypted

> Task :<library module's name here>:injectCode
?? Add Enigma code

> Task :<library module's name here>:preBuild
> Task :<library module's name here>:extractProguardFiles UP-TO-DATE
> Task :<library module's name here>:preDebugBuild
.
. // skipping generic tasks
.
> Task :<library module's name here>:verifyReleaseResources UP-TO-DATE
> Task :<library module's name here>:assembleRelease UP-TO-DATE

> Task :<library module's name here>:restore
?? Restore: \app\src\main\java\xxx\xxx\xxx\MainActivity.java
?? Restore: \app\src\main\java\xxx\xxx\xxx\MyFirebaseMessagingService.java
? Remove Enigma code: E:\xxxxxxxxxx\xxxxxxxx\xxxxxxxx\app\src\main\java\com\chrisney\enigma

> Task :<library module's name here>:assemble UP-TO-DATE
> Task :app:mergeReleaseJavaResource
> Task :app:transformClassesAndResourcesWithR8ForRelease
> Task :app:packageRelease
> Task :app:assembleRelease
> Task :app:assemble

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 1m 19s
115 actionable tasks: 61 executed, 54 up-to-date
11:58:32: Task execution finished 'assemble'.

project's settings.gradle:

include ':app', ':<library module name here>'

Can you check if this plugin can only support app module and not additional modules in same project?

Encrypted file doesn't restore after compile error

So if my compilation ends with error (for example error in my code like syntax etc) encrypted file does not restore, so i have to use git to restore it or my app just crash if try to access such string. Fix it please.

Multi module support?

Is this plugin supports multi module? I see it's creates package in app but i don't have app in multi module and don't get my values encrypted.

How to use?

Can you please share a sample video?

Nothing happening in my project

Not Working !

i test this plugin to adding in my code to protect some Strings in Java class, but after Build apk and test to reverse it by JadX, i found same String values is not change or make a fake values...

How to execute :app:restore

Greetings! Sir, I'm sorry, probably my question is a bit dumb. The thing is that I don't know how to execute :app:resore task. Pls help, thanks in advance

LICENSE

Can you pls tell me the license of this lib? And can you add license type in description too? Thanks

Use

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at com.chrisney.enigma.utils.Utils.insertInArray(Utils.java:88)
at com.chrisney.enigma.parser.JavaCode.addBlockAtFirst(JavaCode.java:297)
at com.chrisney.enigma.parser.JavaCode.addAttribute(JavaCode.java:215)
at com.chrisney.enigma.parser.JavaCode.addAttribute(JavaCode.java:189)
at com.chrisney.enigma.parser.JavaCode.injectFakeKeys(JavaCode.java:408)
at com.chrisney.enigma.parser.JavaCode.injectFakeKeys(JavaCode.java:388)
at com.chrisney.enigma.tasks.EnigmaTask.encryptJavaFile(EnigmaTask.java:102)
at com.chrisney.enigma.tasks.EnigmaTask.encrypt(EnigmaTask.java:54)

Illegal Forward Reference

Greetings.

First off, great work! I started using enigma to obfuscate Strings and it worked perfectly so far, but when I use static initializer to load native library (NDK) it fails with the title's name.
Is there any way to prevent Enigma from obfuscate that static initializer without excluding the whole code, or obfuscate it as well?

Example error:

public class A {
  static { 
    System.loadLibrary("somelib"); <- Illegal Forward Reference
  }
}

Appreciate any guidance or help.

Thanks!

Can this be applied to string resources?

Amazing plugin!! I absolutely adore it and it's made my life leaps and bounds easier.

Now, is it possible to use this on a string resource file to encrypt the strings at build time like the rest? I'd rather not manage encrypted values in the Java code itself, and instead in xml. However, if that's just not doable no worries, I figured I'd check.

Thanks!

App size issue

Greetings,

First of all, thanks for a great plugin! I started using it for almost all of my apps. In one of them I currently don`t need to use it. Before using the plugin my app size was about 3,5 Mb and after it increased to 10. So I tried removing it(removed from gradle). But the app size is still 10 mb. Can you please help me with an suggestion of how to remove all the files so app size can be 3,5Mb back :D. I would also appreciate any kind of guidance and hope for the quick answer!

Best regards!

Cannot find plugin dependency

Could not set unknown property 'checkSCM'

Hi,

Implemented in react native 0.64.2

classpath 'gradle.plugin.chrisney:enigma:1.0.0.8'

inside app/build.gradle

enigma.enabled = true
enigma.injectFakeKeys = true
enigma.ignoredClasses = []
enigma.checkSCM = false

  • What went wrong:
    A problem occurred evaluating project ':app'.

Could not set unknown property 'checkSCM' for extension 'enigma' of type com.chrisney.enigma.EnigmaPluginExtension.

Question is checkSCM is implemented or not ?
Is always necessary define source code ?

Big encryption problem!!!

I found out how to easy decrypt files please give me your private contacts for example email or telegram so i can whore you and not share this publicly

Cannot backup an encrypted file

When i compile the app and run it and there is a syntax error it just encrypt the code and won't comeback to the original code!
Screen Shot 2020-12-24 at 09 36 25

Can i encrypt only in specific build variant?

For example

buildTypes {
        release {
            enigma.enabled = true
            enigma.injectFakeKeys = true
           
        }
        debug {
            enigma.enabled = false
            enigma.injectFakeKeys = false
           
        }
}

I tried it, but it still always encrypted

Problem with hard code the source path

I tested with my project it not work, but with "hello world" create from Android Studio it work.
So that is why many user report it is not work. In my project create with android studio for both phone and watch it create name "mobile", "wear".
In the source code you hard code the source patch, so must have an option to change it or change the code.

String srcJava = "/app/src/main/java"

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.