String obfuscator for Android applications

Related tags

Kotlin paranoid
Overview

Build

Paranoid

String obfuscator for Android applications.

Usage

In order to make Paranoid work with your project you have to apply the Paranoid Gradle plugin to the project. Please notice that the Paranoid plugin must be applied after the Android plugin.

buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath 'com.joom.paranoid:paranoid-gradle-plugin:0.3.7'
  }
}

apply plugin: 'com.android.application'
apply plugin: 'com.joom.paranoid'

Now you can just annotate classes with strings that need to be obfuscated with @Obfuscate. After you project compiles every string in annotated classes will be obfuscated.

Configuration

Paranoid plugin can be configured using paranoid extension object:

paranoid {
  // ...
}

The extension object contains the following properties:

  • enabledboolean. Allows to disable obfuscation for the project. Default value is true.
  • cacheableboolean. Allows to enable caching for the transform. Default value is false.
  • includeSubprojectsboolean. Allows to enable obfuscation for subprojects. Default value is false.
  • obfuscationSeed - Integer. A seed that can be used to make obfuscation stable across builds. Default value is null, which means that the seed is computed from input files on each build.

How it works

Let's say you have an Activity that contains some string you want to be obfuscated.

@Obfuscate
public class MainActivity extends AppCompatActivity {
  private static final String QUESTION = "Q: %s";
  private static final String ANSWER = "A: %s";

  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    final TextView questionTextView = (TextView) findViewById(R.id.questionTextView);
    questionTextView.setText(String.format(QUESTION, "Does it work?"));

    final TextView answerTextView = (TextView) findViewById(R.id.answerTextView);
    answerTextView.setText(String.format(ANSWER, "Sure it does!"));
  }
}

The class contains both string constants (QUESTION and ANSWER) and string literals. After compilation this class will be transformed to something like this.

@Obfuscate
public class MainActivity extends AppCompatActivity {
  private static final String QUESTION = Deobfuscator.getString(4);
  private static final String ANSWER = Deobfuscator.getString(5);

  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    final TextView questionTextView = (TextView) findViewById(R.id.questionTextView);
    questionTextView.setText(String.format(Deobfuscator.getString(0), Deobfuscator.getString(1)));

    final TextView answerTextView = (TextView) findViewById(R.id.answerTextView);
    answerTextView.setText(String.format(Deobfuscator.getString(2), Deobfuscator.getString(3)));
  }
}

License

Copyright 2021 SIA Joom

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Fix applyToBuildVariants = 'NONE' parameter.

    Fix applyToBuildVariants = 'NONE' parameter.

    check applyToBuildTypes == BuildType.NONE is performed right after plugin is applied. At this moment ParanoidExtension has not been not initialized yet, so check doesn't work.

    I've moved check to onlyIf block of paranoid tasks for java projects and to variant filter for android projects

    opened by nesterov-n 0
  • Fix gradle configuration cache and java tasks

    Fix gradle configuration cache and java tasks

    This PR fixes incompatible configuration cache usage:

    1. Usage of getProject() during task execution.
    2. Modification of Jar task inputs.

    Enabled Gradle configuration cache when executing check / connectedCheck tasks in GitHub actions.

    opened by dkostyrev 0
  • Fix duplicated asm in paranoid-gradle-plugin shadow jar

    Fix duplicated asm in paranoid-gradle-plugin shadow jar

    Due to the hack in pablo.gradle that extends relocate configuration from implementation, asm was relocated to paranoid-gradle-plugin shadow jar twice. This fix disables the hack when publishing dependencies.

    opened by dkostyrev 0
  • AndroidComponents API support

    AndroidComponents API support

    • Refactored ParanoidPlugin so it can be applied to java modules as well as android modules.
    • Introduced support for Android Components Variant API for projects using AGP >= 7.2.0. In this case paranoid plugin should be applied to every module that declares @Obfuscate annotation.
    • Classes transformed by paranoid plugin now marked with special attribute (see WatermarkClassVisitor), so ParanoidProcessor can validate paranoid plugin usage by checking whether this attribute is present in should-be-transformed classes available in classpath.
    • Deprecated some paranoid extension properties, since they are no longer applicable for projects transformed by ParanoidTransformTask.
    opened by dkostyrev 0
  • Add paranoid plugin as included build

    Add paranoid plugin as included build

    Moved plugin and related projects into paranoid subdirectory, and included it as separate build. This makes plugin development easier, removing the need to publish it to maven local repository.

    Introduced new gradle property development instead of bootstrap, which enables dependencySubstitution in included build. The sole purpose of this flag is to allow samples to run with published dependencies instead of included build.

    Upgraded AGP to 7.2.0 and Gradle to 7.3.3, since AGP 7.0.3 used incompatible ASM version.

    opened by dkostyrev 0
  • Add settings to apply paranoid only to specific build types

    Add settings to apply paranoid only to specific build types

    Added config param applyToBuildTypes to switch off transform for specific build types. Possible values are: ALL - add transforms for all build types NOT_DEBBUGABLE - add transforms only for build types with debuggable = false (release build type in most cases) NONE - Do not add transforms at all.

    applyToBuildTypes = 'NONE' works exactly as enabled = false

    Added deprecation warning to build log if enabled is used.

    opened by nesterov-n 0
Releases(v0.3.13)
Owner
Joom
Joom
KMP library for string unicode normalization

doistx-normalize Kotlin Multiplatform (KMP) library that adds support for normalization as described by Unicode Standard Annex #15 - Unicode Normaliza

Doist 31 Nov 22, 2022
Detekt rule no string parameter with kotlin

Detekt custom rule template This repository is a template. You can use it to generate your own repository to write and share your custom rules. How to

Christian Wüstner 0 Nov 26, 2021
Embeddable custom voice assistant for Android applications

Aimybox voice assistant Open source voice assistant built on top of Aimybox SDK iOS version is available here Key Features Provides ready to use UI co

Just AI 176 Jan 2, 2023
A plugin for Termux to use native Android GUI components from CLI applications.

Termux:GUI This is a plugin for Termux that enables command line programs to use the native android GUI. In the examples directory you can find demo v

null 342 Dec 23, 2022
Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android applications.

Compose Multi-Module Architecture Sample Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android a

Pavlo Stavytskyi 77 Jan 3, 2023
Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Chris Russell 1 Feb 11, 2022
🚀Optimizer for mobile applications

Overview | 概览 Booster is an easy-to-use, lightweight, powerful and extensible quality optimization toolkit designed specially for mobile applications.

DiDi 4.3k Dec 29, 2022
A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

Varabyte 349 Jan 9, 2023
A Template for a Github Actions Pipeline for building and publishing Gradle-JVM Applications

github-actions-cd-template-jvm A Template for a Github Actions Pipeline for building and publishing Gradle-JVM Applications It build a executable shad

Raphael Panic 0 Dec 5, 2021
Framework for quickly creating connected applications in Kotlin with minimal effort

Ktor is an asynchronous framework for creating microservices, web applications and more. Written in Kotlin from the ground up. import io.ktor.server.n

ktor.io 10.7k Jan 9, 2023
A pair of applications provide a direct means of integrating with one another via application programming interfaces (APIs)

What is a native integration? It's when a pair of applications provide a direct means of integrating with one another via application programming interfaces (APIs). Once integrated, data can flow between the apps and become more readily available to your employees.

Behruz Hurramov 2 Jan 17, 2022
Link-converter - A web service that converts links between web url and deeplink for mobile and web applications

Deep Link Converter Linkleri, mobil ve web uygulamaları için web url ile deeplin

Muhammed Eren DURSUN 2 Apr 9, 2022
Com.hhvvg.anytext - An application provides features to modify any TextView in any other applications

AnyText What's this This application provides features to modify any TextView in

null 6 Dec 2, 2022
A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.

native_memory_allocator A library which uses sun.misc.Unsafe to allocate off-heap native memory. Motivation The goal of this project is to provide a s

Target 5 Dec 8, 2022
Android MVVM framework write in kotlin, develop Android has never been so fun.

KBinding 中文版 Android MVVM framework write in kotlin, base on anko, simple but powerful. It depends on my another project AutoAdapter(A library for sim

Benny 413 Dec 5, 2022
Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android.

Klimatic Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android. Built using Android Architectu

Shivam Satija 34 Oct 11, 2022
Oratio Library for Android Studio helps you simplify your Android TTS codes

Oratio Oratio is a library for Android Studio. This library is useful to a number of developers who are currently making apps using android TTS(Text-T

Jacob Lim 1 Oct 28, 2021
This is a demo android app representing implementation of SE principles in android app development

Articles Demo This repository contains a sample Android App that shows most popular articles data from NY Times API. This is a sample app that shows h

Waesem Abbas 2 Jan 20, 2022
Android-Boilerplate - Base project for android development with new technology

Android-Boilerplate Base project for android development with new technology, in

Muhammad Rizky Arifin 1 Aug 15, 2022