Skip to content

Commit

Permalink
新UI
Browse files Browse the repository at this point in the history
  • Loading branch information
wukaicheng committed May 23, 2021
1 parent efc3907 commit f8e7c18
Show file tree
Hide file tree
Showing 49 changed files with 1,273 additions and 368 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![](https://img.shields.io/badge/language-java-brightgreen.svg)

BlackDex是一个运行在Android手机上的脱壳工具,支持5.0~12,无需依赖任何环境任何手机都可以使用,包括模拟器。只需5秒,即可对已安装包括未安装的APK进行脱壳。
BlackDex是一个运行在Android手机上的脱壳工具,支持5.0~12,无需依赖任何环境任何手机都可以使用,包括模拟器。只需数秒,即可对已安装包括未安装的APK进行脱壳。

## 项目声明
- 由于 [黑盒BlackBox](https://github.com/nnjun/BlackBox) 已被抄家,多的不想说了,请关注本项目或者其他未来项目吧。
Expand Down
41 changes: 37 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
Expand All @@ -14,10 +15,12 @@ android {
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

ndk {
// 设置支持的SO库架构
abiFilters 'armeabi-v7a', 'x86'
}

}

buildTypes {
Expand All @@ -26,20 +29,50 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

buildFeatures{
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation project(':Bcore')

//coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2"

//viewModel liveData lifecycle
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"

//third

implementation 'com.afollestad.material-dialogs:core:3.3.0'
//dialog
implementation 'com.github.nukc.stateview:kotlin:2.2.0'
//状态控制控件
implementation 'com.roger.catloadinglibrary:catloadinglibrary:1.0.9'
//加载dialog
implementation 'com.github.Ferfalk:SimpleSearchView:0.2.0'
//searchView


testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package top.niunaijun.blackdex

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("top.niunaijun.blackdex", appContext.packageName)
}
}
23 changes: 14 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="top.niunaijun.blackdex">
xmlns:tools="http://schemas.android.com/tools"
package="top.niunaijun.blackdex">

<!-- Android 11 需要 -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.BlackDex">
<activity android:name=".MainActivity">
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".App"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.BlackDex">
<activity android:name=".view.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
43 changes: 0 additions & 43 deletions app/src/main/java/top/niunaijun/blackdex/App.java

This file was deleted.

26 changes: 26 additions & 0 deletions app/src/main/java/top/niunaijun/blackdex/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package top.niunaijun.blackdex

import android.app.Application
import android.content.Context
import top.niunaijun.blackbox.BlackDexCore
import top.niunaijun.blackbox.app.configuration.ClientConfiguration
import top.niunaijun.blackdex.data.BlackDexConfiguration

/**
*
* @Description:
* @Author: wukaicheng
* @CreateDate: 2021/5/23 14:00
*/
class App : Application() {

override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
BlackDexCore.get().doAttachBaseContext(base,BlackDexConfiguration(base!!))
}

override fun onCreate() {
super.onCreate()
BlackDexCore.get().doCreate()
}
}
45 changes: 0 additions & 45 deletions app/src/main/java/top/niunaijun/blackdex/MainActivity.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package top.niunaijun.blackdex.data

import android.content.Context
import top.niunaijun.blackbox.app.configuration.ClientConfiguration

/**
*
* @Description: 启动配置文件
* @Author: wukaicheng
* @CreateDate: 2021/5/23 14:04
*/
class BlackDexConfiguration(private val context: Context) : ClientConfiguration() {
override fun getHostPackageName(): String {
return context.packageName
}


}
88 changes: 88 additions & 0 deletions app/src/main/java/top/niunaijun/blackdex/data/DexDumpRepository.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package top.niunaijun.blackdex.data

import android.content.pm.ApplicationInfo
import android.net.Uri
import android.webkit.URLUtil
import androidx.lifecycle.MutableLiveData
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import top.niunaijun.blackbox.BlackBoxCore
import top.niunaijun.blackbox.BlackBoxCore.getPackageManager
import top.niunaijun.blackbox.BlackDexCore
import top.niunaijun.blackbox.utils.AbiUtils
import top.niunaijun.blackbox.utils.FileUtils
import top.niunaijun.blackdex.data.entity.AppInfo
import top.niunaijun.blackdex.data.entity.DumpInfo
import java.io.File

/**
*
* @Description:
* @Author: wukaicheng
* @CreateDate: 2021/5/23 14:29
*/
class DexDumpRepository {

private var dumpTaskId = 0

fun getAppList(mAppListLiveData: MutableLiveData<List<AppInfo>>) {

val installedApplications: List<ApplicationInfo> = getPackageManager().getInstalledApplications(0)
val installedList = mutableListOf<AppInfo>()

for (installedApplication in installedApplications) {
val file = File(installedApplication.sourceDir)

if ((installedApplication.flags and ApplicationInfo.FLAG_SYSTEM) != 0) continue

if (!AbiUtils.isSupport(file)) continue


val info = AppInfo(
installedApplication.loadLabel(getPackageManager()).toString(),
installedApplication.packageName,
installedApplication.loadIcon(getPackageManager())
)
installedList.add(info)
}

mAppListLiveData.postValue(installedList)
}

fun dumpDex(source: String, dexDumpLiveData: MutableLiveData<DumpInfo>) {

dexDumpLiveData.postValue(DumpInfo(DumpInfo.LOADING))

val result = if (URLUtil.isValidUrl(source)) {
BlackDexCore.get().dumpDex(Uri.parse(source))
} else {
BlackDexCore.get().dumpDex(source)
}

if(result){
dumpTaskId++
startCountdown(dexDumpLiveData)
}else{
dexDumpLiveData.postValue(DumpInfo(DumpInfo.TIMEOUT))
}

}


fun dumpSuccess(){
dumpTaskId++
}

private fun startCountdown(dexDumpLiveData: MutableLiveData<DumpInfo>){
GlobalScope.launch {
val tempId = dumpTaskId
delay(10000)

if(tempId == dumpTaskId){
dexDumpLiveData.postValue(DumpInfo(DumpInfo.TIMEOUT))
}
}

}
}
Loading

0 comments on commit f8e7c18

Please sign in to comment.