Skip to content

Commit

Permalink
Added regexp matching, internal storing mechanism update, refactoring…
Browse files Browse the repository at this point in the history
…, switched to md5 hash algorithm, UI test changes, better support for Lucky Patcher
  • Loading branch information
cioccarellia committed Mar 14, 2019
1 parent 981f3eb commit 0bbac12
Show file tree
Hide file tree
Showing 16 changed files with 297 additions and 62 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Remember that a skilled hacker will always find a way to crack your code. This l
- At the end of December 2018, Lucky Patcher 8.0.0 was released, along with the possibility to randomize package name and make the app invisible from Google Play Protect and other defense systems.
The 5th of January, BillingProtector 1.1.0 update introduces support for custom package parameter matching and comes along with the ability of detecting every masked lucky patcher installation
- Lucky Patcher (12 March 2018) had a nasty trick which allowed them to show their label normally, [but instread with different charset](https://twitter.com/ACioccarelli/status/1105249064147472385), avoiding normal detction.
BillingProtector 1.1.1 detects that version, the Lucky Patcher emulation server, Installer and the Proxy package to bypass app purchase logic.
BillingProtector 1.3.0 detects that version, the Lucky Patcher emulation server, Installer and the Proxy to bypass app purchase mechanism.


# Setup
Expand All @@ -35,7 +35,7 @@ allprojects {
And the dependency to your module build.gradle file:
```gradle
dependencies {
implementation 'com.github.AndreaCioccarelli:BillingProtector:1.2.0'
implementation 'com.github.AndreaCioccarelli:BillingProtector:1.3.0'
}
```

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.andreacioccarelli.billingprotectorsample"
minSdkVersion 14
targetSdkVersion 28
versionCode 3
versionName "1.0.2"
versionCode 7
versionName "1.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import android.support.design.widget.FloatingActionButton;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.andreacioccarelli.billingprotector.BillingProtector;

import java.util.concurrent.TimeUnit;

public class DetectionActivity extends Activity {

BillingProtector bp;
Expand All @@ -18,10 +21,10 @@ public class DetectionActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_secondary);
setContentView(R.layout.activity);

bp = new BillingProtector(this);
updateData();
runRefresh();

FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
Expand All @@ -30,11 +33,32 @@ public void onClick(View v) {
Vibrator vib = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vib.vibrate(100);

updateData();
runRefresh();
}
});
}

void runRefresh() {
new Thread(new Runnable() {
@Override
public void run() {
long mills = System.currentTimeMillis();
updateData();

long millsAfter = System.currentTimeMillis();
long diff = millsAfter - mills;
final long seconds = TimeUnit.MILLISECONDS.toSeconds(diff);

runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(DetectionActivity.this, "Re-computed. Time: " + seconds + "s", Toast.LENGTH_SHORT).show();
}
});
}
}).run();
}

@SuppressLint("SetTextI18n")
void updateData() {
final TextView mxp = findViewById(R.id.mxp);
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 6
versionName "1.2.0"
versionCode 7
versionName "1.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ package com.andreacioccarelli.billingprotector

import android.content.Context
import android.content.pm.PackageManager
import com.andreacioccarelli.billingprotector.data.DetectionCause
import com.andreacioccarelli.billingprotector.data.PirateApp
import com.andreacioccarelli.billingprotector.data.SelectionCriteria
import com.andreacioccarelli.billingprotector.data.createPirateAppsList
import com.andreacioccarelli.billingprotector.extensions.removeDuplicatedPackages
import com.andreacioccarelli.billingprotector.extensions.valueOrNull
import com.andreacioccarelli.billingprotector.utils.RootUtils
import com.andreacioccarelli.billingprotector.utils.assembleAppList


/**
* Created by andrea on 2018/Jul.
* Part of the package com.andreacioccarelli.billingprotector
* Designed and Developed by Andrea Cioccarelli
*/

class BillingProtector(private val context: Context) {

/**
Expand All @@ -38,16 +40,16 @@ class BillingProtector(private val context: Context) {
fun getPirateAppsList(): List<PirateApp> {
val foundThreats = mutableListOf<PirateApp>()
val installedApps = context.packageManager.getInstalledApplications(PackageManager.GET_META_DATA)
val pirateApps = createPirateAppsList()
val pirateApps = assembleAppList(DetectionCause.PIRACY)

installedApps.forEach { installedApp ->
pirateApps.forEach {
when (it.criteria) {
SelectionCriteria.SLICE -> {
SelectionCriteria.CONTAINS -> {
if (installedApp.packageName.contains(it.field)) foundThreats.add(it)
}

SelectionCriteria.MATCH_PACKAGE -> {
SelectionCriteria.MATCH -> {
if (it.field == installedApp.packageName) foundThreats.add(it)
}

Expand All @@ -57,12 +59,13 @@ class BillingProtector(private val context: Context) {
}
}

SelectionCriteria.LABEL -> {
val label = installedApp.loadLabel(context.packageManager)
val nonLocalizedLabel = installedApp.nonLocalizedLabel
SelectionCriteria.LABEL_REGEXP -> {
val label = installedApp.loadLabel(context.packageManager).valueOrNull()
val nonLocalizedLabel = installedApp.nonLocalizedLabel.valueOrNull()

when (it.field) {
label, nonLocalizedLabel -> foundThreats.add(it)
when {
label.matches(it.field.toRegex())
|| nonLocalizedLabel.matches(it.field.toRegex()) -> foundThreats.add(it)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
@file:Suppress("ClassName")

package com.andreacioccarelli.billingprotector.assets

/**
* Designed and Developed by Andrea Cioccarelli
*/

object definitions {

private const val lucky_patcher = "Lucky Patcher"
private const val freedom = "Freedom"
private const val xmodgames = "XModGames"
private const val uret_patcher = "Uret Patcher"
private const val creeplays_patcher = "Creeplays Patcher"
private const val creehack = "Creehack"
private const val playcards = "Leo Playcards"
private const val appsara = "AppSara"
private const val modded_store = "Modded Google Play Store"


object match {
/**
* Lucky Patcher
*/
const val field1 = "com.chelpus.lackypatch"
const val khash1 = "419cb6875f3fa235ed925c28afc44f2e"
const val kname1 = lucky_patcher

const val field2 = "com.dimonvideo.luckypatcher"
const val khash2 = "cd9de8549c3e6e151300734f112091b3"
const val kname2 = lucky_patcher

const val field3 = "com.forpda.lp"
const val khash3 = "c2f5ef59294b96727c061ecc0a792392"
const val kname3 = lucky_patcher

const val field4 = "ru.aaaaaaac.installer"
const val khash4 = "e74010e84eb49bc67f51554c60b8e222"
const val kname4 = lucky_patcher

const val field5 = "com.android.vending.licensing.ILicensingService"
const val khash5 = "238b2cc715459f7b9458e0e0744b15e2"
const val kname5 = lucky_patcher

/**
* Uret patcher
* */
const val field6 = "uret.jasi2169.patcher"
const val khash6 = "7a3a1cdb08b74117b3c20f2e04ba099e"
const val kname6 = uret_patcher

/**
* Creeplays Patcher
* */
const val field7 = "org.creeplays.hack"
const val khash7 = "b30bec898f00f528e382b95856ebb909"
const val kname7 = creeplays_patcher

/**
* CreeHack
* */
const val field8 = "apps.zhasik007.hack"
const val khash8 = "48e3b21aec993834ca0a91f48a7099c6"
const val kname8 = creehack

/**
* Leo Playcards
* */
const val field9 = "com.leo.playcard"
const val khash9 = "9d8a3405cd058e411c224fb680fa103c"
const val kname9 = playcards

/**
* AppSara
* */
const val field10 = "com.appsara.app"
const val khash10 = "a00e921d238bb1b84d104e293313d225"
const val kname10 = appsara
}


object slice {
/**
* Lucky Patcher
*/
const val field1 = "com.android.vending.billing.InAppBillingService."
const val khash1 = "48b19168f8f466638c400c2e8eb8eebe"
const val kname1 = lucky_patcher

const val field2 = "com.android.vending.billing.InAppBillingService."
const val khash2 = "48b19168f8f466638c400c2e8eb8eebe"
const val kname2 = lucky_patcher

/**
* Freedom
* */
const val field3 = "jase.freedom"
const val khash3 = "fde5230b767d93fbc23010f9de757f04"
const val kname3 = freedom

const val field4 = "madkite.freedom"
const val khash4 = "771df92f8cc82ad893bb3378a155338d"
const val kname4 = freedom

/**
* Modded Play Store
* */
const val field5 = "com.android.vendinc"
const val khash5 = "81907933708408ddc91af1f381e65bff"
const val kname5 = modded_store

/**
* XModGames
* */
const val field6 = "com.xmodgame"
const val khash6 = "00d0c2bf72590fd9281bb0d60a408092"
const val kname6 = xmodgames
}

object classname {
/**
* Lucky Patcher
* */
const val field1 = "com.lp"
const val khash1 = "38d21e850edd2a6c6253918770a59b27"
const val kname1 = lucky_patcher

}

object regexp {
/**
* Lucky Patcher
* */
const val field1 = "-*[LІ][uцџ][cс][kкќӄ][yуӳӱӰӯӮУў][-.#@_*/\\+`\"$   ~][PРҎҏр][aаӑӓ][tт][cс][hнһӈҺ][eєёеҽзэҿ][rя][sѕ]?-*"
const val khash1 = "6a730bba41046d0a9a9ec2a24f871380"
const val kname1 = lucky_patcher
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.andreacioccarelli.billingprotector.crypt

import java.security.MessageDigest
import kotlin.experimental.and


/**
* Designed and Developed by Andrea Cioccarelli
*/

object HashGeneratior {
fun hash(input: String): String {
val md = MessageDigest.getInstance("MD5")
md.update(input.toByteArray())
val digest = md.digest()
val sb = StringBuffer()
for (b in digest) {
sb.append(String.format("%02x", b and 0xff.toByte()))
}

return sb.toString()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.andreacioccarelli.billingprotector.data

/**
* Designed and Developed by Andrea Cioccarelli
*/

abstract class AppDefinition{
abstract val field: String
abstract val hash: String
abstract val criteria: SelectionCriteria
abstract val name: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.andreacioccarelli.billingprotector.data

/**
* Designed and Developed by Andrea Cioccarelli
*/

enum class DetectionCause { PIRACY }
Loading

0 comments on commit 0bbac12

Please sign in to comment.